fixed issue with receiving data. the interrupt overhead was too high so i switch to an interrupt/polling hybrid. idk how im going to do the queue but i have the library finished

stable
Penguin 3 years ago
parent 4bc852b44a
commit 9f0877c746

@ -1,150 +1,3 @@
q
q
q
b main
file build/motor_controller.hex
q
r
q
r
q
b main
r
n
n
n
n
n
n
n
n
n
n
n
n
n
n
b 129
c
qq
q
b main
r
n
n
n
n
n
n
n
n
n
n
n
b 128
n
n
n
n
b 129
de
del
b 129
r
c
n
s
s
s
q
q
q
b 129
r
q
b Core/Src/main.c:380
r
q
q
q
q
q
b 392
r
s
s
c
p huart1_rxc
s
s
s
c
q
q
q
b 392
r
c
c
del
b main()
b 124
r
n
q
b 392
r
p huart1_rxc
c
p huart1_rxc
p huart1_rxc
c
p huart1_rxc
q
b 411
r
q
b 145
r
s
n
q
b 146
q
b 146
b main.c:146
r
q
b main.c:146
r
s
del
b main.c:147
r
q
b main.c:147
r
b p_serial_mgr.c:43
r
p rxc
p/c rxc
p/x rxc
c
c
n
r
p rxc
del
b p_serial_mgr.c:113
r
b p_serial_mgr.c:68
r
q
b p_serial_mgr.c:68
r
p rxc
c
q
b p_serial_mgr.c:113
r
q
@ -230,3 +83,174 @@ r
c
del
q
q
b p_serial_mgr.c:43 if rxc == 0x7D
r
make -j20
load
r
make -j20
load
r
del
b p_serial_mgr.c:44
r
b p_serial_mgr.c:44 if rxc == 0x7D
del
b p_serial_mgr.c:44 if rxc == 0x7D
r
del
b p_serial_mgr.c:44 if (rxc == 0x7D)
r
r
s
s
s
q
b putil.c:34
r
p bytep byte
p byte
/xp byte
p/x byte
make -j20
load
q
b putil.c:34
r
n
n
make -j20
load
r
n
n
make -j20
make
load
r
n
n
q
b putil.c:34
r
c
make -j20
load
r
n
n
n
q
b putil.c:35
r
n
make -j20; load; r
make -j20
load
r
n
n
n
c
c
c
q
b main.c:148
r
q
b putil.c:36
b putil.c:36
r
p main.c:161
b main.c:161
r
del
b p_serial_mgr.c:161
r
c
b p_serial_mgr_service
r
c
n
p serial_pkt_cb.buffer[0]
p serial_pkt_cb.buffer[0]
c
s
p ind
c
p ind
n
p ind
p serial_pkt_cb.max_len
p ind
s
p serial_pkt_cb.buffer[ind]
p serial_pkt_cb.buffer
p serial_pkt_cb.buffer[0]
p serial_pkt_cb.buffer[1]
p serial_pkt_cb.buffer[2]
p serial_pkt_cb.buffer[3]
p serial_pkt_cb.buffer[4]
del
b p_serial_mgr_service if serial_pkt_cb.buffer[0].frame_data[0] != 0
r
q
q
q
b UART1_RxCpltCallback
r
c
p b_go
b main.c:141
r
c
n
n
n
n
n
n
step
f
finish
finish
n
n
n
n
n
n
n
n
finish
n
finish
c 20
p b_go
q
b 141
r
n
p ret
make
load
r
n
p ret
q
make
load
r
n
make
load
r
n
n
n
n
n
p ret
make clean
q

@ -133,8 +133,22 @@ int main(void)
/* Infinite loop */
/* USER CODE BEGIN WHILE */
uint8_t rxb[256] = {0};
while (1)
{
if (p_serial_mgr_service())
{
volatile HAL_StatusTypeDef ret;
ret = HAL_UART_Receive(&huart1, rxb, 256, 5);
for (int ind = 0; ind < 20; ind++)
{
p_uart_async_write_byte(rxb[ind]);
}
PDEBUG("\n\n\n\n");
memset(rxb, 0, 256);
p_serial_mgr_start();
}
// if (b_timer_struck)
// {
// // PDEBUG("%d\n", sys_time);
@ -142,24 +156,24 @@ int main(void)
// motor_degrees = (motor_degrees + 1) % 360;
// mc_service(motor_degrees, 50);
// }
serial_pkt_t *pkt = NULL;
if ((pkt = p_serial_mgr_service()) != NULL)
{
PDEBUG("Source: %02x\n"
"Destination: %02x\n",
pkt->src_addr, pkt->dest_addr);
PDEBUG("Frame Data: \n");
for (int ind = 0; ind < pkt->len; pkt++)
{
if (ind % 8 == 0)
{
PDEBUG("\n");
}
PDEBUG("%02x ", pkt->frame_data[ind]);
}
PDEBUG("\nChecksum: %02x\n\n");
memset(pkt, 0, sizeof(serial_pkt_t));
}
// serial_pkt_t *pkt = NULL;
// if ((pkt = p_serial_mgr_service()) != NULL)
// {
// PDEBUG("Source: %02x\n"
// "Destination: %02x\n",
// pkt->src_addr, pkt->dest_addr);
// PDEBUG("Frame Data: \n");
// for (int ind = 0; ind < pkt->len; pkt++)
// {
// if (ind % 8 == 0)
// {
// PDEBUG("\n");
// }
// PDEBUG("%02x ", pkt->frame_data[ind]);
// }
// PDEBUG("\nChecksum: %02x\n\n");
// memset(pkt, 0, sizeof(serial_pkt_t));
// }
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */

@ -1,109 +1,4 @@
[
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_msp.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_msp.lst",
"-o",
"build/stm32l4xx_hal_msp.o",
"Core/Src/stm32l4xx_hal_msp.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/stm32l4xx_hal_msp.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_dma.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma.lst",
"-o",
"build/stm32l4xx_hal_dma.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_gpio.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_gpio.lst",
"-o",
"build/stm32l4xx_hal_gpio.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
@ -138,846 +33,5 @@
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/main.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_rcc_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc_ex.lst",
"-o",
"build/stm32l4xx_hal_rcc_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_flash_ramfunc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ramfunc.lst",
"-o",
"build/stm32l4xx_hal_flash_ramfunc.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_tim.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim.lst",
"-o",
"build/stm32l4xx_hal_tim.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/p_serial_mgr.d",
"-Wa,-a,-ad,-alms=build/p_serial_mgr.lst",
"-o",
"build/p_serial_mgr.o",
"shared/drivers/p_serial_mgr.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "shared/drivers/p_serial_mgr.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal.lst",
"-o",
"build/stm32l4xx_hal.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_cortex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_cortex.lst",
"-o",
"build/stm32l4xx_hal_cortex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_flash.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash.lst",
"-o",
"build/stm32l4xx_hal_flash.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_it.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_it.lst",
"-o",
"build/stm32l4xx_it.o",
"Core/Src/stm32l4xx_it.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/stm32l4xx_it.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_i2c.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c.lst",
"-o",
"build/stm32l4xx_hal_i2c.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_pwr_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr_ex.lst",
"-o",
"build/stm32l4xx_hal_pwr_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/putil.d",
"-Wa,-a,-ad,-alms=build/putil.lst",
"-o",
"build/putil.o",
"shared/util/putil.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "shared/util/putil.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_dma_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma_ex.lst",
"-o",
"build/stm32l4xx_hal_dma_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_tim_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim_ex.lst",
"-o",
"build/stm32l4xx_hal_tim_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_pwr.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr.lst",
"-o",
"build/stm32l4xx_hal_pwr.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/motor_controller.d",
"-Wa,-a,-ad,-alms=build/motor_controller.lst",
"-o",
"build/motor_controller.o",
"shared/devices/motor_controller.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "shared/devices/motor_controller.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_exti.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_exti.lst",
"-o",
"build/stm32l4xx_hal_exti.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/system_stm32l4xx.d",
"-Wa,-a,-ad,-alms=build/system_stm32l4xx.lst",
"-o",
"build/system_stm32l4xx.o",
"Core/Src/system_stm32l4xx.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/system_stm32l4xx.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_flash_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ex.lst",
"-o",
"build/stm32l4xx_hal_flash_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_uart_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart_ex.lst",
"-o",
"build/stm32l4xx_hal_uart_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_uart.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart.lst",
"-o",
"build/stm32l4xx_hal_uart.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-x",
"assembler-with-cpp",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/startup_stm32l432xx.d",
"-o",
"build/startup_stm32l432xx.o",
"startup_stm32l432xx.s"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "startup_stm32l432xx.s"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/PCircularBuffer.d",
"-Wa,-a,-ad,-alms=build/PCircularBuffer.lst",
"-o",
"build/PCircularBuffer.o",
"shared/util/PCircularBuffer.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "shared/util/PCircularBuffer.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_rcc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc.lst",
"-o",
"build/stm32l4xx_hal_rcc.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_i2c_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c_ex.lst",
"-o",
"build/stm32l4xx_hal_i2c_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c"
}
]

@ -0,0 +1,6 @@
elf="./build/motor_controller.elf"
alias pregen="make clean; rdos2unix"
alias ppush="make -j20; arm-none-eabi-gdb ${elf} -x generic_push.gdb"
alias pdebug="make -j20; arm-none-eabi-gdb ${elf} -x generic_debug.gdb"

8959
gdb.txt

File diff suppressed because it is too large Load Diff

@ -26,144 +26,35 @@ typedef enum serial_state_t
} serial_state_t;
static UART_HandleTypeDef *_serial_huart_inst = NULL;
static serial_state_t sstate = SS_IDLE;
static uint8_t rxc = '\0';
volatile serial_pkt_t pkt_bank[10];
volatile p_cb_serial_pkt_t serial_pkt_cb;
static volatile uint8_t start_index_tracker = 0;
static volatile uint8_t frame_index_tracker = 0;
#pragma message(Reminder "Move away from cirular buffer to a managed queue")
static uint8_t rxc = '\0';
static bool b_go = false;
void UART1_RxCpltCallback(UART_HandleTypeDef *huart)
{
switch (sstate)
{
case SS_IDLE: // packet start
{
if (rxc == 0x7E)
{
sstate = SS_START;
}
}
break;
case SS_START:
{
switch (start_index_tracker)
{
case 0: // source addr
{
serial_pkt_cb.buffer[serial_pkt_cb.head].src_addr = rxc;
start_index_tracker++;
}
break;
case 1:
{
serial_pkt_cb.buffer[serial_pkt_cb.head].dest_addr = rxc;
start_index_tracker++;
}
break;
case 2:
{
start_index_tracker = 0;
frame_index_tracker = 0;
serial_pkt_cb.buffer[serial_pkt_cb.head].len = rxc;
sstate = SS_FRAME;
}
break;
default:
{
// shouldnt get here
asm volatile("nop");
}
};
}
break;
case SS_FRAME:
{
if (rxc == 0x7E)
{
asm volatile("nop");
// error occured. bail
#pragma message(Reminder "add a safe escape routine for this")
sstate = SS_IDLE;
memset(&serial_pkt_cb.buffer[serial_pkt_cb.head], 0, sizeof(serial_pkt_t));
}
else if (rxc == 0x7D)
{
sstate = SS_ESC;
}
else
{
serial_pkt_cb.buffer[serial_pkt_cb.head].frame_data[frame_index_tracker++] = rxc;
if (frame_index_tracker >= serial_pkt_cb.buffer[serial_pkt_cb.head].len)
{
sstate = SS_CHECKSUM;
}
}
}
break;
case SS_ESC:
{
serial_pkt_cb.buffer[serial_pkt_cb.head].frame_data[frame_index_tracker++] = rxc ^ 0x20;
if (frame_index_tracker >= serial_pkt_cb.buffer[serial_pkt_cb.head].len)
{
sstate = SS_CHECKSUM;
}
else
{
sstate = SS_FRAME;
}
}
break;
case SS_CHECKSUM:
{
frame_index_tracker = 0;
serial_pkt_cb.buffer[serial_pkt_cb.head].checksum = rxc;
serial_pkt_cb.buffer[serial_pkt_cb.head].b_ready = true;
serial_pkt_cb.head = (serial_pkt_cb.head + 1) % serial_pkt_cb.max_len;
sstate = SS_IDLE;
}
break;
default:
{
PDEBUG("Shouldn't have hit this!\n");
}
};
HAL_UART_Receive_IT(_serial_huart_inst, &rxc, 1);
// serial_cb.push(&serial_cb, serial_cb_rxc);
// HAL_GPIO_WritePin(USART1_DE_GPIO_Port, USART1_DE_Pin, 1);
// huart2_rxc = huart1_rxc;
// HAL_UART_Transmit(&huart2, &huart2_rxc, 1, 500);
// HAL_UART_Receive_IT(&huart1, &huart1_rxc, 1);
// HAL_GPIO_WritePin(USART1_DE_GPIO_Port, USART1_DE_Pin, 0);
b_go = true;
}
void p_serial_mgr_init(UART_HandleTypeDef *huart)
{
_serial_huart_inst = huart;
_serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback;
memset(pkt_bank, 0, sizeof(serial_pkt_t) * 10);
p_cb_serial_pkt_init(&serial_pkt_cb, pkt_bank, 10);
b_go = false;
}
serial_pkt_t *p_serial_mgr_service(void)
{
// this will be less garbage when i switch to a queue
for (int ind = 0; ind < serial_pkt_cb.max_len; ind++)
bool p_serial_mgr_service(void)
{
if (serial_pkt_cb.buffer[ind].b_ready)
{
return &serial_pkt_cb.buffer[ind];
}
}
return NULL;
// // this will be less garbage when i switch to a queue
// for (int ind = 0; ind < serial_pkt_cb.max_len; ind++)
// {
// if (serial_pkt_cb.buffer[ind].b_ready)
// {
// return &serial_pkt_cb.buffer[ind];
// }
// }
return b_go;
}
void p_serial_mgr_start()
{
b_go = false;
HAL_UART_Receive_IT(_serial_huart_inst, &rxc, 1);
}

@ -16,7 +16,7 @@ typedef struct serial_pkt_t
void p_serial_mgr_init(UART_HandleTypeDef *huart);
serial_pkt_t *p_serial_mgr_service(void);
bool p_serial_mgr_service(void);
void p_serial_mgr_start();

@ -109,14 +109,12 @@ PB_CB_STATUS p_cb_serial_pkt_init(p_cb_serial_pkt_t *inst, serial_pkt_t *buff, u
PB_CB_STATUS ret = PB_CB_GOOD;
do
{
// Make sure the buffer isn't bad (null)
if (!buff)
{
ret = PB_CB_NULL_BUFFER;
break;
}
// Make sure the max buffer is a useable size
if (max_length > PB_CB_MAX_BUFFER_SIZE || max_length <= 0)
{
ret = PB_CB_BAD_BUFFER_SIZE;
@ -126,6 +124,12 @@ PB_CB_STATUS p_cb_serial_pkt_init(p_cb_serial_pkt_t *inst, serial_pkt_t *buff, u
{
memset(inst->buffer[ind].frame_data, 0, 256);
}
inst->buffer = buff;
inst->max_len = (uint16_t)max_length;
inst->head = 0;
inst->push = p_cb_serial_pkt_push;
inst->empty = p_cb_serial_pkt_empty;
inst->empty(inst);
} while (0);
// Debugging

@ -80,8 +80,8 @@ typedef struct p_cb_serial_pkt_t
// Useful for knowing if data is being received
bool b_empty;
PB_CB_STATUS (*push)(struct p_cb_u8 *cbuffer, uint8_t value);
PB_CB_STATUS (*empty)(struct p_cb_u8 *cbuffer);
PB_CB_STATUS (*push)(struct p_cb_serial_pkt_t *cbuffer, serial_pkt_t value);
PB_CB_STATUS (*empty)(struct p_cb_serial_pkt_t *cbuffer);
} p_cb_serial_pkt_t;
PB_CB_STATUS p_cb_serial_pkt_init(p_cb_serial_pkt_t *inst, serial_pkt_t *buff, uint32_t max_length);

@ -1,12 +1,13 @@
#include "putil.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#define MAX_PRINTF_BUFFER (256)
UART_HandleTypeDef *huart_inst = NULL;
static char send[10] = {'\0'};
int p_printf(const char *fmt, ...)
{
size_t size_str = strlen(fmt);
@ -22,8 +23,6 @@ int p_printf(const char* fmt, ...)
va_end(args);
HAL_UART_Transmit(huart_inst, printf_buffer, strlen(printf_buffer), 100);
return 0;
}
void p_uart_init(UART_HandleTypeDef *huart)
{
@ -31,3 +30,8 @@ void p_uart_init(UART_HandleTypeDef* huart)
PDEBUG("...\n");
PDEBUG("UART2 Initialized\n");
}
void p_uart_async_write_byte(uint8_t byte)
{
sprintf(send, "%02x\n", byte);
HAL_UART_Transmit(huart_inst, send, 3, 100);
}

@ -5,6 +5,7 @@
int p_printf(const char *fmt, ...);
void p_uart_init(UART_HandleTypeDef *huart);
void p_uart_async_write_byte(uint8_t byte);
#define Stringize(L) #L
#define MakeString(M, L) M(L)

Loading…
Cancel
Save