testing protocol

stable
Penguin 3 years ago
parent c2b2f2c14d
commit b5ef056990

@ -15,7 +15,7 @@ AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All

@ -101,3 +101,6 @@ p huart1_rxc
c
p huart1_rxc
q
b 411
r
q

@ -133,12 +133,30 @@ int main(void)
/* USER CODE BEGIN WHILE */
while (1)
{
if (b_timer_struck)
// if (b_timer_struck)
// {
// // PDEBUG("%d\n", sys_time);
// b_timer_struck = false;
// motor_degrees = (motor_degrees + 1) % 360;
// mc_service(motor_degrees, 50);
// }
serial_pkt_t *pkt = NULL;
if ((pkt = p_serial_mgr_service()) != NULL)
{
// PDEBUG("%d\n", sys_time);
b_timer_struck = false;
motor_degrees = (motor_degrees + 1) % 360;
mc_service(motor_degrees, 50);
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 */
@ -392,7 +410,7 @@ static void MX_GPIO_Init(void)
void UART2_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Transmit(&huart1, &huart2_rxc, 1, 100);
HAL_UART_Transmit(&huart2, &huart2_rxc, 1, 100);
HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1);
}
// void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
@ -437,9 +455,7 @@ void Error_Handler(void)
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
while (1)
{
}
while (1) {}
/* USER CODE END Error_Handler_Debug */
}

@ -25,14 +25,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_uart.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart.lst",
"-MFbuild/stm32l4xx_hal_msp.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_msp.lst",
"-o",
"build/stm32l4xx_hal_uart.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c"
"build/stm32l4xx_hal_msp.o",
"Core/Src/stm32l4xx_hal_msp.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c"
"file": "Core/Src/stm32l4xx_hal_msp.c"
},
{
"arguments": [
@ -60,14 +60,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_tim_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim_ex.lst",
"-MFbuild/stm32l4xx_hal_dma.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma.lst",
"-o",
"build/stm32l4xx_hal_tim_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c"
"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_tim_ex.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c"
},
{
"arguments": [
@ -95,14 +95,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_tim.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim.lst",
"-MFbuild/stm32l4xx_hal_gpio.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_gpio.lst",
"-o",
"build/stm32l4xx_hal_tim.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c"
"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_tim.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c"
},
{
"arguments": [
@ -130,14 +130,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_flash.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash.lst",
"-MFbuild/main.d",
"-Wa,-a,-ad,-alms=build/main.lst",
"-o",
"build/stm32l4xx_hal_flash.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c"
"build/main.o",
"Core/Src/main.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c"
"file": "Core/Src/main.c"
},
{
"arguments": [
@ -165,14 +165,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_rcc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc.lst",
"-MFbuild/stm32l4xx_hal_rcc_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc_ex.lst",
"-o",
"build/stm32l4xx_hal_rcc.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c"
"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.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c"
},
{
"arguments": [
@ -200,14 +200,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_i2c.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c.lst",
"-MFbuild/stm32l4xx_hal_flash_ramfunc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ramfunc.lst",
"-o",
"build/stm32l4xx_hal_i2c.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c"
"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_i2c.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c"
},
{
"arguments": [
@ -235,14 +235,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_cortex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_cortex.lst",
"-MFbuild/stm32l4xx_hal_tim.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim.lst",
"-o",
"build/stm32l4xx_hal_cortex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c"
"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_cortex.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c"
},
{
"arguments": [
@ -270,14 +270,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_flash_ramfunc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ramfunc.lst",
"-MFbuild/p_serial_mgr.d",
"-Wa,-a,-ad,-alms=build/p_serial_mgr.lst",
"-o",
"build/stm32l4xx_hal_flash_ramfunc.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c"
"build/p_serial_mgr.o",
"shared/drivers/p_serial_mgr.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c"
"file": "shared/drivers/p_serial_mgr.c"
},
{
"arguments": [
@ -305,14 +305,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_msp.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_msp.lst",
"-MFbuild/stm32l4xx_hal.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal.lst",
"-o",
"build/stm32l4xx_hal_msp.o",
"Core/Src/stm32l4xx_hal_msp.c"
"build/stm32l4xx_hal.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/stm32l4xx_hal_msp.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
},
{
"arguments": [
@ -340,14 +340,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/system_stm32l4xx.d",
"-Wa,-a,-ad,-alms=build/system_stm32l4xx.lst",
"-MFbuild/stm32l4xx_hal_cortex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_cortex.lst",
"-o",
"build/system_stm32l4xx.o",
"Core/Src/system_stm32l4xx.c"
"build/stm32l4xx_hal_cortex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/system_stm32l4xx.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c"
},
{
"arguments": [
@ -375,14 +375,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_dma.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma.lst",
"-MFbuild/stm32l4xx_hal_flash.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash.lst",
"-o",
"build/stm32l4xx_hal_dma.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c"
"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_dma.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c"
},
{
"arguments": [
@ -410,14 +410,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_gpio.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_gpio.lst",
"-MFbuild/stm32l4xx_it.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_it.lst",
"-o",
"build/stm32l4xx_hal_gpio.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c"
"build/stm32l4xx_it.o",
"Core/Src/stm32l4xx_it.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c"
"file": "Core/Src/stm32l4xx_it.c"
},
{
"arguments": [
@ -445,14 +445,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/main.d",
"-Wa,-a,-ad,-alms=build/main.lst",
"-MFbuild/stm32l4xx_hal_i2c.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c.lst",
"-o",
"build/main.o",
"Core/Src/main.c"
"build/stm32l4xx_hal_i2c.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/main.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c"
},
{
"arguments": [
@ -480,14 +480,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_flash_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ex.lst",
"-MFbuild/stm32l4xx_hal_pwr_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr_ex.lst",
"-o",
"build/stm32l4xx_hal_flash_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c"
"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_flash_ex.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c"
},
{
"arguments": [
@ -515,14 +515,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal.lst",
"-MFbuild/putil.d",
"-Wa,-a,-ad,-alms=build/putil.lst",
"-o",
"build/stm32l4xx_hal.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
"build/putil.o",
"shared/util/putil.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
"file": "shared/util/putil.c"
},
{
"arguments": [
@ -550,14 +550,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_pwr.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr.lst",
"-MFbuild/stm32l4xx_hal_dma_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma_ex.lst",
"-o",
"build/stm32l4xx_hal_pwr.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c"
"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_pwr.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c"
},
{
"arguments": [
@ -585,14 +585,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_i2c_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c_ex.lst",
"-MFbuild/stm32l4xx_hal_tim_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim_ex.lst",
"-o",
"build/stm32l4xx_hal_i2c_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c"
"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_i2c_ex.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c"
},
{
"arguments": [
@ -620,14 +620,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/p_serial_mgr.d",
"-Wa,-a,-ad,-alms=build/p_serial_mgr.lst",
"-MFbuild/stm32l4xx_hal_pwr.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr.lst",
"-o",
"build/p_serial_mgr.o",
"shared/drivers/p_serial_mgr.c"
"build/stm32l4xx_hal_pwr.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "shared/drivers/p_serial_mgr.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c"
},
{
"arguments": [
@ -655,14 +655,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_uart_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart_ex.lst",
"-MFbuild/motor_controller.d",
"-Wa,-a,-ad,-alms=build/motor_controller.lst",
"-o",
"build/stm32l4xx_hal_uart_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
"build/motor_controller.o",
"shared/devices/motor_controller.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
"file": "shared/devices/motor_controller.c"
},
{
"arguments": [
@ -725,14 +725,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/putil.d",
"-Wa,-a,-ad,-alms=build/putil.lst",
"-MFbuild/system_stm32l4xx.d",
"-Wa,-a,-ad,-alms=build/system_stm32l4xx.lst",
"-o",
"build/putil.o",
"shared/util/putil.c"
"build/system_stm32l4xx.o",
"Core/Src/system_stm32l4xx.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "shared/util/putil.c"
"file": "Core/Src/system_stm32l4xx.c"
},
{
"arguments": [
@ -760,14 +760,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/motor_controller.d",
"-Wa,-a,-ad,-alms=build/motor_controller.lst",
"-MFbuild/stm32l4xx_hal_flash_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ex.lst",
"-o",
"build/motor_controller.o",
"shared/devices/motor_controller.c"
"build/stm32l4xx_hal_flash_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "shared/devices/motor_controller.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c"
},
{
"arguments": [
@ -795,21 +795,19 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_it.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_it.lst",
"-MFbuild/stm32l4xx_hal_uart_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart_ex.lst",
"-o",
"build/stm32l4xx_it.o",
"Core/Src/stm32l4xx_it.c"
"build/stm32l4xx_hal_uart_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Core/Src/stm32l4xx_it.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-x",
"assembler-with-cpp",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
@ -832,18 +830,21 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/startup_stm32l432xx.d",
"-MFbuild/stm32l4xx_hal_uart.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart.lst",
"-o",
"build/startup_stm32l432xx.o",
"startup_stm32l432xx.s"
"build/stm32l4xx_hal_uart.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "startup_stm32l432xx.s"
"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",
@ -866,14 +867,13 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_rcc_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc_ex.lst",
"-MFbuild/startup_stm32l432xx.d",
"-o",
"build/stm32l4xx_hal_rcc_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c"
"build/startup_stm32l432xx.o",
"startup_stm32l432xx.s"
],
"directory": "/storage/Shared/Projects/Penguinator/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c"
"file": "startup_stm32l432xx.s"
},
{
"arguments": [
@ -936,14 +936,14 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_pwr_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr_ex.lst",
"-MFbuild/stm32l4xx_hal_rcc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc.lst",
"-o",
"build/stm32l4xx_hal_pwr_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c"
"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_pwr_ex.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c"
},
{
"arguments": [
@ -971,13 +971,13 @@
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/stm32l4xx_hal_dma_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma_ex.lst",
"-MFbuild/stm32l4xx_hal_i2c_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c_ex.lst",
"-o",
"build/stm32l4xx_hal_dma_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c"
"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_dma_ex.c"
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c"
}
]

@ -66,3 +66,286 @@ A debugging session is active.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
0x080015ea in HAL_TIM_PWM_MspInit (htim_pwm=0x0) at Core/Src/stm32l4xx_hal_msp.c:95
95 __HAL_RCC_TIM2_CLK_ENABLE();
### Assembly ##########################################################################################################
0x080015de HAL_TIM_PWM_MspInit+6 ldr r1, [pc, #88] ; (0x8001638 <HAL_TIM_Base_MspInit+56>)
0x080015e0 HAL_TIM_PWM_MspInit+8 mov r0, r6
0x080015e2 HAL_TIM_PWM_MspInit+10 bl 0x8004048 <HAL_RS485Ex_Init+136>
0x080015e6 HAL_TIM_PWM_MspInit+14 movs r4, #0
0x080015e8 HAL_TIM_PWM_MspInit+16 ldr r3, [pc, #80] ; (0x800163c <HAL_TIM_Base_MspInit+60>)
0x080015ea HAL_TIM_PWM_MspInit+18 ldrb r3, [r3, #0]
0x080015ec HAL_TIM_PWM_MspInit+20 cmp r3, #0
0x080015ee HAL_TIM_PWM_MspInit+22 beq.n 0x80015e8 <HAL_TIM_PWM_MspInit+16>
0x080015f0 HAL_TIM_PWM_MspInit+24 ldr r3, [pc, #72] ; (0x800163c <HAL_TIM_Base_MspInit+60>)
0x080015f2 HAL_TIM_PWM_MspInit+26 movs r2, #0
### Breakpoints #######################################################################################################
### Expressions #######################################################################################################
### History ###########################################################################################################
### Memory ############################################################################################################
### Registers #########################################################################################################
r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080015ea primask 0x00
r1 0x00000000 r6 0x20000a60 r11 0x00000000 xPSR 0x61000000 basepri 0x00
r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x20000010 faultmask 0x00
r3 0x200009c4 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04
r4 0x00000154 r9 0x00000000 lr 0x08002041 psp 0x00000000
### Source ############################################################################################################
85 * @retval None
86 */
87 void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
88 {
89 if(htim_pwm->Instance==TIM2)
90 {
91 /* USER CODE BEGIN TIM2_MspInit 0 */
92
93 /* USER CODE END TIM2_MspInit 0 */
94 /* Peripheral clock enable */
95 __HAL_RCC_TIM2_CLK_ENABLE();
96 /* USER CODE BEGIN TIM2_MspInit 1 */
97
98 /* USER CODE END TIM2_MspInit 1 */
99 }
100
101 }
102
103 /**
104 * @brief TIM_Base MSP Initialization
### Stack #############################################################################################################
[0] from 0x080015ea in HAL_TIM_PWM_MspInit+18 at Core/Src/stm32l4xx_hal_msp.c:95
[1] from 0x08002040 in HAL_TIM_PWM_Stop+72 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c:1533
[2] from 0x00000000
### Threads ###########################################################################################################
[1] id 0 from 0x080015ea in HAL_TIM_PWM_MspInit+18 at Core/Src/stm32l4xx_hal_msp.c:95
### Variables #########################################################################################################
arg htim_pwm = 0x0: {Instance = 0x20010000,Init = {Prescaler = 134234761,CounterMode = 134223429,Period = …
loc tmpreg = 0
#######################################################################################################################
Loading section .isr_vector, size 0x190 lma 0x8000000
Loading section .text, size 0x9678 lma 0x80001c0
Loading section .rodata, size 0x4d8 lma 0x8009838
Loading section .ARM, size 0x8 lma 0x8009d10
Loading section .init_array, size 0x8 lma 0x8009d18
Loading section .fini_array, size 0x8 lma 0x8009d20
Loading section .data, size 0x9a8 lma 0x8009d28
Start address 0x080042d4, load size 42656
Transfer rate: 29 KB/sec, 4739 bytes/write.
Unable to match requested speed 500 kHz, using 480 kHz
Unable to match requested speed 500 kHz, using 480 kHz
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
0x0800151c in main () at Core/Src/main.c:144
144 if ((pkt = p_serial_mgr_service()) != NULL)
### Assembly ##################################################################
0x0800150e main+154 movs r1, #0
0x08001510 main+156 mov r0, r4
0x08001512 main+158 bl 0x8004370 <memset>
0x08001516 main+162 bl 0x8004298 <p_serial_mgr_service>
0x0800151a main+166 mov r4, r0
0x0800151c main+168 cmp r0, #0
0x0800151e main+170 beq.n 0x8001516 <main+162>
0x08001520 main+172 ldrb r2, [r0, #1]
0x08001522 main+174 ldrb r1, [r0, #0]
0x08001524 main+176 ldr r0, [pc, #48] ; (0x8001558 <main+228>)
### Breakpoints ###############################################################
### Expressions ###############################################################
### History ###################################################################
### Memory ####################################################################
### Registers #################################################################
r0 0x00000000 r8 0x00000000 xPSR 0x61000000
r1 0x00000000 r9 0x00000000 fpscr 0x00000010
r2 0x00000000 r10 0x00000000 msp 0x2000fff0
r3 0x00000000 r11 0x00000000 psp 0x00000000
r4 0x00000000 r12 0x00001000 primask 0x00
r5 0x200009c8 sp 0x2000fff0 basepri 0x00
r6 0x00000000 lr 0x0800151b faultmask 0x00
r7 0x00000000 pc 0x0800151c control 0x04
### Source ####################################################################
134 while (1)
135 {
136 // if (b_timer_struck)
137 // {
138 // // PDEBUG("%d\n", sys_time);
139 // b_timer_struck = false;
140 // motor_degrees = (motor_degrees + 1) % 360;
141 // mc_service(motor_degrees, 50);
142 // }
143 serial_pkt_t *pkt = NULL;
144 if ((pkt = p_serial_mgr_service()) != NULL)
145 {
146 PDEBUG("Source: %02x\n"
147 "Destination: %02x\n",
148 pkt->src_addr, pkt->dest_addr);
149 PDEBUG("Frame Data: \n");
150 for (int ind = 0; ind < pkt->len; pkt++)
151 {
152 if (ind % 8 == 0)
153 {
### Stack #####################################################################
[0] from 0x0800151c in main+168 at Core/Src/main.c:144
### Threads ###################################################################
[1] id 0 from 0x0800151c in main+168 at Core/Src/main.c:144
### Variables #################################################################
loc pkt = 0x0: {src_addr = 0 '\000',dest_addr = 0 '\000',len = 134234837,frame_data = "a\025\000\bc\0…
###############################################################################
Unable to match requested speed 500 kHz, using 480 kHz
Unable to match requested speed 500 kHz, using 480 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080042d4 msp: 0x20010000
Loading section .isr_vector, size 0x190 lma 0x8000000
Loading section .text, size 0x9678 lma 0x80001c0
Loading section .rodata, size 0x4d8 lma 0x8009838
Loading section .ARM, size 0x8 lma 0x8009d10
Loading section .init_array, size 0x8 lma 0x8009d18
Loading section .fini_array, size 0x8 lma 0x8009d20
Loading section .data, size 0x9a8 lma 0x8009d28
Start address 0x080042d4, load size 42656
Transfer rate: 29 KB/sec, 4739 bytes/write.
Breakpoint 1 at 0x8001168: file Core/Src/main.c, line 412.
Note: automatically using hardware breakpoints for read-only addresses.
Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf
### Output/messages ###########################################################
Breakpoint 1, UART2_RxCpltCallback (huart=0x20000b14 <huart2>) at Core/Src/main.c:412
412 {
### Assembly ##################################################################
~
~
~
~
~
!0x08001168 UART2_RxCpltCallback+0 push {r4, lr}
0x0800116a UART2_RxCpltCallback+2 ldr r4, [pc, #24] ; (0x8001184 <UART2_RxCpltCallback+28>)
0x0800116c UART2_RxCpltCallback+4 movs r3, #100 ; 0x64
0x0800116e UART2_RxCpltCallback+6 movs r2, #1
0x08001170 UART2_RxCpltCallback+8 mov r1, r4
### Breakpoints ###############################################################
[1] break at 0x08001168 in Core/Src/main.c:412 for /storage/Shared/Projects/Penguinator/motor_controller/Core/Src/main.c:411 hit 1 time
### Expressions ###############################################################
### History ###################################################################
### Memory ####################################################################
### Registers #################################################################
r0 0x20000b14 r8 0x00000000 xPSR 0x81000036
r1 0x00000000 r9 0x00000000 fpscr 0x00000010
r2 0x40004408 r10 0x00000000 msp 0x2000ff68
r3 0x08001169 r11 0x00000000 psp 0x00000000
r4 0x20000b14 r12 0x00001000 primask 0x00
r5 0x00000001 sp 0x2000ff68 basepri 0x00
r6 0x00000000 lr 0x0800348b faultmask 0x00
r7 0x00000000 pc 0x08001168 control 0x00
### Source ####################################################################
402 GPIO_InitStruct.Pin = m1_dir_Pin | m2_dir_Pin;
403 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
404 GPIO_InitStruct.Pull = GPIO_NOPULL;
405 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
406 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
407 }
408
409 /* USER CODE BEGIN 4 */
410
411 void UART2_RxCpltCallback(UART_HandleTypeDef *huart)
!412 {
413 HAL_UART_Transmit(&huart1, &huart2_rxc, 1, 100);
414 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1);
415 }
416 // void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
417 // {
418 // else if (huart == &huart2)
419 // {
420 // }
421 // }
### Stack #####################################################################
[0] from 0x08001168 in UART2_RxCpltCallback+0 at Core/Src/main.c:412
[1] from 0x0800348a in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430
[2] from 0x080035dc in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347
[3] from 0x08001590 in USART2_IRQHandler+8 at Core/Src/stm32l4xx_it.c:225
[4] from 0xffffffe9
[5] from 0x080042a2 in p_serial_mgr_service+10 at shared/drivers/p_serial_mgr.c:143
[6] from 0x0800151a in main+166 at Core/Src/main.c:144
### Threads ###################################################################
[1] id 0 from 0x08001168 in UART2_RxCpltCallback+0 at Core/Src/main.c:412
### Variables #################################################################
arg huart = 0x20000b14 <huart2>: {Instance = 0x40004400,Init = {BaudRate = 115200,WordLength = 0,StopBi…
###############################################################################
Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target
[Inferior 1 (Remote target) detached]
UART2_RxCpltCallback (huart=0x20000b14 <huart2>) at Core/Src/main.c:412
412 {
### Assembly ##################################################################
~
~
~
~
~
0x08001168 UART2_RxCpltCallback+0 push {r4, lr}
0x0800116a UART2_RxCpltCallback+2 ldr r4, [pc, #24] ; (0x8001184 <UART2_RxCpltCallback+28>)
0x0800116c UART2_RxCpltCallback+4 movs r3, #100 ; 0x64
0x0800116e UART2_RxCpltCallback+6 movs r2, #1
0x08001170 UART2_RxCpltCallback+8 mov r1, r4
### Breakpoints ###############################################################
### Expressions ###############################################################
### History ###################################################################
### Memory ####################################################################
### Registers #################################################################
r0 0x20000b14 r8 0x00000000 xPSR 0x81000036
r1 0x00000000 r9 0x00000000 fpscr 0x00000010
r2 0x40004408 r10 0x00000000 msp 0x2000ff68
r3 0x08001169 r11 0x00000000 psp 0x00000000
r4 0x20000b14 r12 0x00001000 primask 0x00
r5 0x00000001 sp 0x2000ff68 basepri 0x00
r6 0x00000000 lr 0x0800348b faultmask 0x00
r7 0x00000000 pc 0x08001168 control 0x00
### Source ####################################################################
402 GPIO_InitStruct.Pin = m1_dir_Pin | m2_dir_Pin;
403 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
404 GPIO_InitStruct.Pull = GPIO_NOPULL;
405 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
406 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
407 }
408
409 /* USER CODE BEGIN 4 */
410
411 void UART2_RxCpltCallback(UART_HandleTypeDef *huart)
412 {
413 HAL_UART_Transmit(&huart1, &huart2_rxc, 1, 100);
414 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1);
415 }
416 // void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
417 // {
418 // else if (huart == &huart2)
419 // {
420 // }
421 // }
### Stack #####################################################################
[0] from 0x08001168 in UART2_RxCpltCallback+0 at Core/Src/main.c:412
[1] from 0x0800348a in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430
[2] from 0x080035dc in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347
[3] from 0x08001590 in USART2_IRQHandler+8 at Core/Src/stm32l4xx_it.c:225
[4] from 0xffffffe9
[5] from 0x080042a2 in p_serial_mgr_service+10 at shared/drivers/p_serial_mgr.c:143
[6] from 0x0800151a in main+166 at Core/Src/main.c:144
### Threads ###################################################################
[1] id 0 from 0x08001168 in UART2_RxCpltCallback+0 at Core/Src/main.c:412
### Variables #################################################################
arg huart = 0x20000b14 <huart2>: {Instance = 0x40004400,Init = {BaudRate = 115200,WordLength = 0,StopBi…
###############################################################################
Loading section .isr_vector, size 0x190 lma 0x8000000
Loading section .text, size 0x9678 lma 0x80001c0
Loading section .rodata, size 0x4d8 lma 0x8009838
Loading section .ARM, size 0x8 lma 0x8009d10
Loading section .init_array, size 0x8 lma 0x8009d18
Loading section .fini_array, size 0x8 lma 0x8009d20
Loading section .data, size 0x9a8 lma 0x8009d28
Start address 0x080042d4, load size 42656
Transfer rate: 29 KB/sec, 4739 bytes/write.
Unable to match requested speed 500 kHz, using 480 kHz
Unable to match requested speed 500 kHz, using 480 kHz
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]

@ -1,5 +1,6 @@
#include "p_serial_mgr.h"
#include "PCircularBuffer.h"
#include "putil.h"
#include "stm32l4xx_hal_uart.h"
#define MAX_SERIAL_BUFFER_SIZE (262) // Actually 261, add 1 for padding
@ -31,7 +32,10 @@ static uint8_t rxc = '\0';
static serial_pkt_t pkt_bank[10];
static p_cb_serial_pkt_t serial_pkt_cb;
static volatile uint8_t index_tracker = 0;
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")
void UART1_RxCpltCallback(UART_HandleTypeDef *huart)
{
@ -47,7 +51,7 @@ void UART1_RxCpltCallback(UART_HandleTypeDef *huart)
break;
case SS_START:
{
switch (index_tracker)
switch (start_index_tracker)
{
case 0: // source addr
{
@ -62,23 +66,53 @@ void UART1_RxCpltCallback(UART_HandleTypeDef *huart)
case 2:
{
serial_pkt_cb.buffer[serial_pkt_cb.head].len = rxc;
frame_index_tracker = 0;
sstate = SS_FRAME;
}
break;
default:
{
// shouldnt get here
for (;;)
{}
for (;;) {}
}
};
}
break;
case SS_FRAME:
{
if (rxc == 0x7E)
{
// error occured. bail
#pragma message(Reminder "add a safe escape routine for this")
}
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 + 1 == 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 + 1 == serial_pkt_cb.buffer[serial_pkt_cb.head].len)
{
sstate = SS_CHECKSUM;
}
}
break;
case SS_CHECKSUM:
{
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;
}
break;
default:
@ -103,8 +137,18 @@ void p_serial_mgr_init(UART_HandleTypeDef *huart)
p_cb_serial_pkt_init(&serial_pkt_cb, pkt_bank, 10);
}
void p_serial_mgr_service(void)
{}
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++)
{
if (serial_pkt_cb.buffer[ind].b_ready)
{
return &serial_pkt_cb.buffer;
}
}
return NULL;
}
void p_serial_mgr_start()
{

@ -11,10 +11,11 @@ typedef struct serial_pkt_t
int len;
uint8_t frame_data[256];
uint8_t checksum;
bool b_ready;
} serial_pkt_t;
void p_serial_mgr_init(UART_HandleTypeDef *huart);
void p_serial_mgr_service(void);
serial_pkt_t *p_serial_mgr_service(void);
#endif

@ -6,6 +6,11 @@
int p_printf(const char *fmt, ...);
void p_uart_init(UART_HandleTypeDef *huart);
#define Stringize(L) #L
#define MakeString(M, L) M(L)
#define $Line MakeString(Stringize, __LINE__)
#define Reminder __FILE__ "(" $Line ") : Reminder: "
#ifdef _DEBUG
#define PDEBUG(f_, ...) p_printf((f_), ##__VA_ARGS__)
#else

Loading…
Cancel
Save