From 25d46974e3a92c9d88bdb053b557a7d074ac5909 Mon Sep 17 00:00:00 2001 From: Penguin Date: Mon, 2 May 2022 18:31:14 -0500 Subject: [PATCH] partially fixed issue where motor controller was seeing a chirp on the RX line, causing some start bytes to be seen as a combination of the start byte and the src addr byte. Only partially fixed because the buffer stream is still skipped occasionally. Its just not due to that issue. The issue was fixed by driving the max485 chips with 5v at vcc instead of 3.3 --- .gdb_history | 186 +- Core/Inc/stm32l4xx_it.h | 1 + Core/Src/main.c | 45 +- Core/Src/stm32l4xx_hal_msp.c | 22 + Core/Src/stm32l4xx_it.c | 15 + Makefile | 5 +- compile_commands.json | 11 +- gdb.txt | 5025 +++++++++++++++++++++++++++++++++ motor_controller.ioc | 4 +- shared/drivers/p_serial_mgr.c | 28 +- shared/drivers/p_serial_mgr.h | 4 +- 11 files changed, 5215 insertions(+), 131 deletions(-) diff --git a/.gdb_history b/.gdb_history index c27a307..aa08cb5 100644 --- a/.gdb_history +++ b/.gdb_history @@ -1,96 +1,3 @@ -b p_serial_mgr.c:113 -r -q -q -b p_serial_mgr.c:119 -r -q -b p_serial_mgr.c:87 -r -p serial_pkt_cb.buffer[serial_pkt_cb.head] -q -b p_serial_mgr.c:87 -r -b p_serial_mgr.c:122 -r -q -q -b p_serial_mgr.c:100 if frame_index_tracker > 5 -r -b p_serial_mgr.c:100 if frame_index_tracker > 0 -r -q -b p_serial_mgr.c:79 -r -b p_serial_mgr.c:100 if frame_index_tracker > 5 -r -r -b p_serial_mgr.c:110 if frame_index_tracker > 5 -r -del -b p_serial_mgr.c:79 -r -del -b p_serial_mgr.c:86 -r -p rxc -p serial_pkt_cb.buffer[serial_pkt_cb.head] -p serial_pkt_cb.buffer[serial_pkt_cb.head].frame_data -p/x serial_pkt_cb.buffer[serial_pkt_cb.head].frame_data -q -b p_serial_mgr.c:86 -r -p rxc -p serial_pkt_cb.buffer[serial_pkt_cb.head] -p/x serial_pkt_cb.buffer[serial_pkt_cb.head].frame_data -q -b p_serial_mgr.c:86 -r -p/x serial_pkt_cb.buffer[serial_pkt_cb.head].frame_data -p/x serial_pkt_cb.buffer -p\ serial_pkt_cb.buffer -p\ serial_pkt_cb.buffer -p\serial_pkt_cb.buffer -pserial_pkt_cb.buffer -p serial_pkt_cb.buffer -p serial_pkt_cb.buffer[0] -p/x serial_pkt_cb.buffer[0] -q -b p_serial_mgr.c:44 -r -p serial_pkt_cb.head -p serial_pkt_cb.buffer[serial_pkt_cb.head] -p/x serial_pkt_cb.buffer[serial_pkt_cb.head] -p sizeof(serial_pkt_t) -q -b p_serial_mgr.c:44 -r -p sizeof(serial_pkt_t) -c -c -r -make -r -c -r -p sizeof(serial_pkt_t) -p/x serial_pkt_cb.buffer[serial_pkt_cb.head] -make -r -p/x serial_pkt_cb.buffer[serial_pkt_cb.head] -c -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 @@ -254,3 +161,96 @@ n p ret make clean q +b main.c:138 +r +s +n +s +s +b p_serial_mgr.c:45 +del 0 +del +b p_serial_mgr.c:45 +r +s +s +s +p sstate +make +load +r +s +s +s +p sstate +b p_serial_mgr.c:45 if (sstate == SS_START) +del 3 +r +b p_serial_mgr.c:30 +r +c +p rxc +make +load +r +q +b p_serial_mgr.c:47 if sstate == SS_START +r +b p_serial_mgr.c:30 +r +p rxb[0] +c +p rxb[0] +p huart +p *huart +make +load +r +del +b p_serial_mgr.c:30 +r +p rxb +p/x *rxb@10 +p/x *rxb@10 +c +q +b p_serial_mgr.c:35 +r +q +b p_serial_mgr.c:35 +r +s +q +b p_serial_mgr.c:35 +r +p/x *q +q +b p_serial_mgr.c:35 +r +p/x *sbuffer[active_buffer]@24 +r +b p_serial_mgr.c:35 +r +q +b p_serial_mgr.c:35 +r +p/x *sbuffer[active_buffer]@24 +c +q +b p_serial_mgr.c:35 +r +qq +q +b p_serial_mgr.c:35 +r +p sstate +c +b p_serial_mgr.c:35 +c +make +load +r +p sbuffer[active_buffer][0] +c +p sbuffer[active_buffer][0] +q diff --git a/Core/Inc/stm32l4xx_it.h b/Core/Inc/stm32l4xx_it.h index 76a5a07..57910ae 100644 --- a/Core/Inc/stm32l4xx_it.h +++ b/Core/Inc/stm32l4xx_it.h @@ -55,6 +55,7 @@ void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); +void DMA1_Channel5_IRQHandler(void); void USART1_IRQHandler(void); void USART2_IRQHandler(void); void TIM6_DAC_IRQHandler(void); diff --git a/Core/Src/main.c b/Core/Src/main.c index e75827f..b2dc4d8 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -50,6 +50,7 @@ TIM_HandleTypeDef htim6; UART_HandleTypeDef huart1; UART_HandleTypeDef huart2; +DMA_HandleTypeDef hdma_usart1_rx; /* USER CODE BEGIN PV */ volatile uint8_t huart2_rxc; @@ -64,8 +65,9 @@ void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_TIM2_Init(void); static void MX_USART2_UART_Init(void); -static void MX_TIM6_Init(void); +static void MX_DMA_Init(void); static void MX_USART1_UART_Init(void); +static void MX_TIM6_Init(void); /* USER CODE BEGIN PFP */ static void UART2_RxCpltCallback(UART_HandleTypeDef *huart); @@ -106,8 +108,9 @@ int main(void) MX_GPIO_Init(); MX_TIM2_Init(); MX_USART2_UART_Init(); - MX_TIM6_Init(); + MX_DMA_Init(); MX_USART1_UART_Init(); + MX_TIM6_Init(); /* USER CODE BEGIN 2 */ huart2.RxCpltCallback = UART2_RxCpltCallback; @@ -116,15 +119,15 @@ int main(void) // HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2); // HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4); - setPWM(&htim2, TIM_CHANNEL_2, 50); - setPWM(&htim2, TIM_CHANNEL_4, 25); + // setPWM(&htim2, TIM_CHANNEL_2, 50); + // setPWM(&htim2, TIM_CHANNEL_4, 25); HAL_GPIO_WritePin(m1_dir_GPIO_Port, m1_dir_Pin, 1); HAL_GPIO_WritePin(m2_dir_GPIO_Port, m2_dir_Pin, 1); - mc_init(&htim2); + // mc_init(&htim2); HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); - HAL_TIM_Base_Start_IT(&htim6); + // HAL_TIM_Base_Start_IT(&htim6); p_serial_mgr_start(); @@ -133,22 +136,9 @@ 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(); - } + p_serial_mgr_service(); // if (b_timer_struck) // { // // PDEBUG("%d\n", sys_time); @@ -398,6 +388,21 @@ static void MX_USART2_UART_Init(void) /* USER CODE END USART2_Init 2 */ } +/** + * Enable DMA controller clock + */ +static void MX_DMA_Init(void) +{ + + /* DMA controller clock enable */ + __HAL_RCC_DMA1_CLK_ENABLE(); + + /* DMA interrupt init */ + /* DMA1_Channel5_IRQn interrupt configuration */ + HAL_NVIC_SetPriority(DMA1_Channel5_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(DMA1_Channel5_IRQn); +} + /** * @brief GPIO Initialization Function * @param None diff --git a/Core/Src/stm32l4xx_hal_msp.c b/Core/Src/stm32l4xx_hal_msp.c index 1b930b5..4271d34 100644 --- a/Core/Src/stm32l4xx_hal_msp.c +++ b/Core/Src/stm32l4xx_hal_msp.c @@ -23,6 +23,7 @@ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ +extern DMA_HandleTypeDef hdma_usart1_rx; /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN TD */ @@ -240,6 +241,24 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart) GPIO_InitStruct.Alternate = GPIO_AF7_USART1; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + /* USART1 DMA Init */ + /* USART1_RX Init */ + hdma_usart1_rx.Instance = DMA1_Channel5; + hdma_usart1_rx.Init.Request = DMA_REQUEST_2; + hdma_usart1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY; + hdma_usart1_rx.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_usart1_rx.Init.MemInc = DMA_MINC_ENABLE; + hdma_usart1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; + hdma_usart1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; + hdma_usart1_rx.Init.Mode = DMA_NORMAL; + hdma_usart1_rx.Init.Priority = DMA_PRIORITY_LOW; + if (HAL_DMA_Init(&hdma_usart1_rx) != HAL_OK) + { + Error_Handler(); + } + + __HAL_LINKDMA(huart,hdmarx,hdma_usart1_rx); + /* USART1 interrupt Init */ HAL_NVIC_SetPriority(USART1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(USART1_IRQn); @@ -317,6 +336,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) */ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10|USART1_DE_Pin); + /* USART1 DMA DeInit */ + HAL_DMA_DeInit(huart->hdmarx); + /* USART1 interrupt DeInit */ HAL_NVIC_DisableIRQ(USART1_IRQn); /* USER CODE BEGIN USART1_MspDeInit 1 */ diff --git a/Core/Src/stm32l4xx_it.c b/Core/Src/stm32l4xx_it.c index 346389b..a1b3fc2 100644 --- a/Core/Src/stm32l4xx_it.c +++ b/Core/Src/stm32l4xx_it.c @@ -56,6 +56,7 @@ /* External variables --------------------------------------------------------*/ extern TIM_HandleTypeDef htim6; +extern DMA_HandleTypeDef hdma_usart1_rx; extern UART_HandleTypeDef huart1; extern UART_HandleTypeDef huart2; /* USER CODE BEGIN EV */ @@ -200,6 +201,20 @@ void SysTick_Handler(void) /* please refer to the startup file (startup_stm32l4xx.s). */ /******************************************************************************/ +/** + * @brief This function handles DMA1 channel5 global interrupt. + */ +void DMA1_Channel5_IRQHandler(void) +{ + /* USER CODE BEGIN DMA1_Channel5_IRQn 0 */ + + /* USER CODE END DMA1_Channel5_IRQn 0 */ + HAL_DMA_IRQHandler(&hdma_usart1_rx); + /* USER CODE BEGIN DMA1_Channel5_IRQn 1 */ + + /* USER CODE END DMA1_Channel5_IRQn 1 */ +} + /** * @brief This function handles USART1 global interrupt. */ diff --git a/Makefile b/Makefile index 5e94df0..dc74a27 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Fri Apr 08 17:14:47 CDT 2022] +# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Mon May 02 17:19:20 CDT 2022] ########################################################################################################################## # ------------------------------------------------ @@ -126,7 +126,8 @@ C_INCLUDES = \ -Ishared \ -Ishared/devices \ -Ishared/drivers \ --Ishared/util +-Ishared/util \ +-IPenguinBuffer # compile gcc flags diff --git a/compile_commands.json b/compile_commands.json index 118ff25..80eaff5 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -18,6 +18,7 @@ "-Ishared/devices", "-Ishared/drivers", "-Ishared/util", + "-IPenguinBuffer", "-Og", "-Wall", "-fdata-sections", @@ -25,13 +26,13 @@ "-g3", "-gdwarf-2", "-D_DEBUG", - "-MFbuild/main.d", - "-Wa,-a,-ad,-alms=build/main.lst", + "-MFbuild/p_serial_mgr.d", + "-Wa,-a,-ad,-alms=build/p_serial_mgr.lst", "-o", - "build/main.o", - "Core/Src/main.c" + "build/p_serial_mgr.o", + "shared/drivers/p_serial_mgr.c" ], "directory": "/storage/Shared/Projects/Penguinator/motor_controller", - "file": "Core/Src/main.c" + "file": "shared/drivers/p_serial_mgr.c" } ] \ No newline at end of file diff --git a/gdb.txt b/gdb.txt index 9826d37..8d31134 100644 --- a/gdb.txt +++ b/gdb.txt @@ -14521,3 +14521,5028 @@ A debugging session is active. Quit anyway? (y or n) [answered Y; input not from terminal] [Inferior 1 (Remote target) detached] +0x0800423c in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:42 +42 { +### Assembly ######################################################################################################## + 0x08004232 p_serial_mgr_service+2 movs r0, #0 + 0x08004234 p_serial_mgr_service+4 tst r1, r2 + 0x08004236 p_serial_mgr_service+6 lsrs r0, r0, #32 + 0x08004238 p_serial_mgr_service+8 lsrs r0, r5, #15 + 0x0800423a p_serial_mgr_service+10 movs r0, #0 + 0x0800423c p_serial_mgr_service+12 ldr r3, [pc, #4] ; (0x8004244 ) + 0x0800423e p_serial_mgr_service+14 ldrb r0, [r3, #0] + 0x08004240 p_serial_mgr_service+16 bx lr + 0x08004242 p_serial_mgr_service+18 nop + 0x08004244 p_serial_mgr_service+20 lsrs r0, r5, #15 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x0800423c primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00000000 fpscr 0x00000010 faultmask 0x00 + r3 0x20000be8 r8 0x00000000 sp 0x2000fee8 msp 0x2000fee8 control 0x04 + r4 0x00000014 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 32 sstate = SS_START; + 33 } + 34 } + 35 + 36 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 37 { + 38 _serial_huart_inst = huart; + 39 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 40 } + 41 void p_serial_mgr_service(void) + 42 { + 43 if (sstate == SS_START) + 44 { + 45 volatile HAL_StatusTypeDef ret; + 46 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 47 + 48 for (int ind = 0; ind < 20; ind++) + 49 { + 50 p_uart_async_write_byte(rxb[ind]); + 51 } +### Stack ########################################################################################################### +[0] from 0x0800423c in p_serial_mgr_service+12 at shared/drivers/p_serial_mgr.c:42 +[1] from 0x03438c00 +### Threads ######################################################################################################### +[1] id 0 from 0x0800423c in p_serial_mgr_service+12 at shared/drivers/p_serial_mgr.c:42 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9688 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009848 +Loading section .ARM, size 0x8 lma 0x8009cc8 +Loading section .init_array, size 0x8 lma 0x8009cd0 +Loading section .fini_array, size 0x8 lma 0x8009cd8 +Loading section .data, size 0x9a8 lma 0x8009ce0 +Start address 0x0800429c, load size 42584 +Transfer rate: 29 KB/sec, 4731 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] +0x08004236 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:43 +43 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ + 0x08004230 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004280 ) + 0x08004232 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004234 p_serial_mgr_service+4 cmp r3, #1 + 0x08004236 p_serial_mgr_service+6 beq.n 0x800423a + 0x08004238 p_serial_mgr_service+8 bx lr + 0x0800423a p_serial_mgr_service+10 push {r4, lr} + 0x0800423c p_serial_mgr_service+12 sub sp, #8 + 0x0800423e p_serial_mgr_service+14 movs r3, #10 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004236 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 33 } + 34 } + 35 + 36 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 37 { + 38 _serial_huart_inst = huart; + 39 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 40 } + 41 void p_serial_mgr_service(void) + 42 { + 43 if (sstate == SS_START) + 44 { + 45 volatile HAL_StatusTypeDef ret; + 46 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 47 + 48 for (int ind = 0; ind < 20; ind++) + 49 { + 50 p_uart_async_write_byte(rxb[ind]); + 51 } + 52 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004236 in p_serial_mgr_service+6 at shared/drivers/p_serial_mgr.c:43 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004236 in p_serial_mgr_service+6 at shared/drivers/p_serial_mgr.c:43 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9688 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009848 +Loading section .ARM, size 0x8 lma 0x8009cc8 +Loading section .init_array, size 0x8 lma 0x8009cd0 +Loading section .fini_array, size 0x8 lma 0x8009cd8 +Loading section .data, size 0x9a8 lma 0x8009ce0 +Start address 0x0800429c, load size 42584 +Transfer rate: 29 KB/sec, 4731 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] +0x08004234 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:43 +43 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ + 0x08004230 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004280 ) + 0x08004232 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004234 p_serial_mgr_service+4 cmp r3, #1 + 0x08004236 p_serial_mgr_service+6 beq.n 0x800423a + 0x08004238 p_serial_mgr_service+8 bx lr + 0x0800423a p_serial_mgr_service+10 push {r4, lr} + 0x0800423c p_serial_mgr_service+12 sub sp, #8 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004234 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 33 } + 34 } + 35 + 36 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 37 { + 38 _serial_huart_inst = huart; + 39 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 40 } + 41 void p_serial_mgr_service(void) + 42 { + 43 if (sstate == SS_START) + 44 { + 45 volatile HAL_StatusTypeDef ret; + 46 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 47 + 48 for (int ind = 1; ind < 21; ind++) + 49 { + 50 p_uart_async_write_byte(rxb[ind]); + 51 } + 52 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004234 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:43 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004234 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:43 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x0800429c msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9688 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009848 +Loading section .ARM, size 0x8 lma 0x8009cc8 +Loading section .init_array, size 0x8 lma 0x8009cd0 +Loading section .fini_array, size 0x8 lma 0x8009cd8 +Loading section .data, size 0x9a8 lma 0x8009ce0 +Start address 0x0800429c, load size 42584 +Transfer rate: 29 KB/sec, 4731 bytes/write. +Breakpoint 1 at 0x80014ee: file Core/Src/main.c, line 138. +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, main () at Core/Src/main.c:138 +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x800420c +!0x080014ee main+122 bl 0x8004230 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +[1] break at 0x080014ee in Core/Src/main.c:138 for main.c:138 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x08004079 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { +!138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x08004230 +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:43 +43 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ + 0x08004230 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004280 ) + 0x08004232 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004234 p_serial_mgr_service+4 cmp r3, #1 + 0x08004236 p_serial_mgr_service+6 beq.n 0x800423a + 0x08004238 p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +[1] break at 0x080014ee in Core/Src/main.c:138 for main.c:138 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004230 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 33 } + 34 } + 35 + 36 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 37 { + 38 _serial_huart_inst = huart; + 39 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 40 } + 41 void p_serial_mgr_service(void) + 42 { + 43 if (sstate == SS_START) + 44 { + 45 volatile HAL_StatusTypeDef ret; + 46 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 47 + 48 for (int ind = 1; ind < 21; ind++) + 49 { + 50 p_uart_async_write_byte(rxb[ind]); + 51 } + 52 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004230 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:43 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004230 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:43 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x08004232 +halted: PC: 0x08004234 +halted: PC: 0x08004236 +halted: PC: 0x08004238 +halted: PC: 0x080014f2 +main () at Core/Src/main.c:136 +136 while (1) +### Assembly ######################################################################################################## + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x800420c +!0x080014ee main+122 bl 0x8004230 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 + 0x080014fa main+134 lsrs r0, r0, #32 +### Breakpoints ##################################################################################################### +[1] break at 0x080014ee in Core/Src/main.c:138 for main.c:138 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014f2 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 126 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 127 HAL_TIM_Base_Start_IT(&htim6); + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { +!138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } +### Stack ########################################################################################################### +[0] from 0x080014f2 in main+126 at Core/Src/main.c:136 +### Threads ######################################################################################################### +[1] id 0 from 0x080014f2 in main+126 at Core/Src/main.c:136 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x080014ee + +Breakpoint 1, main () at Core/Src/main.c:138 +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x800420c +!0x080014ee main+122 bl 0x8004230 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +[1] break at 0x080014ee in Core/Src/main.c:138 for main.c:138 hit 2 times +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { +!138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +Quit +### Output/messages ################################################################################################# +halted: PC: 0x08004230 +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:43 +43 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ + 0x08004230 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004280 ) + 0x08004232 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004234 p_serial_mgr_service+4 cmp r3, #1 + 0x08004236 p_serial_mgr_service+6 beq.n 0x800423a + 0x08004238 p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +[1] break at 0x080014ee in Core/Src/main.c:138 for main.c:138 hit 2 times +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004230 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 33 } + 34 } + 35 + 36 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 37 { + 38 _serial_huart_inst = huart; + 39 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 40 } + 41 void p_serial_mgr_service(void) + 42 { + 43 if (sstate == SS_START) + 44 { + 45 volatile HAL_StatusTypeDef ret; + 46 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 47 + 48 for (int ind = 1; ind < 21; ind++) + 49 { + 50 p_uart_async_write_byte(rxb[ind]); + 51 } + 52 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004230 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:43 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004230 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:43 +### Variables ####################################################################################################### +##################################################################################################################### +Breakpoint 2 at 0x800423e: file shared/drivers/p_serial_mgr.c, line 45. +warning: bad breakpoint number at or near '0' +Breakpoint 3 at 0x800423e: file shared/drivers/p_serial_mgr.c, line 45. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Program received signal SIGINT, Interrupt. +0x08004232 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:43 +43 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004230 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004280 ) + 0x08004232 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004234 p_serial_mgr_service+4 cmp r3, #1 + 0x08004236 p_serial_mgr_service+6 beq.n 0x800423a + 0x08004238 p_serial_mgr_service+8 bx lr + 0x0800423a p_serial_mgr_service+10 push {r4, lr} +### Breakpoints ##################################################################################################### +[3] break at 0x0800423e in shared/drivers/p_serial_mgr.c:46 for p_serial_mgr.c:45 +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004232 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x20000dec r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 33 } + 34 } + 35 + 36 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 37 { + 38 _serial_huart_inst = huart; + 39 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 40 } + 41 void p_serial_mgr_service(void) + 42 { + 43 if (sstate == SS_START) + 44 { + 45 volatile HAL_StatusTypeDef ret; +!46 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 47 + 48 for (int ind = 1; ind < 21; ind++) + 49 { + 50 p_uart_async_write_byte(rxb[ind]); + 51 } + 52 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004232 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:43 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004232 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:43 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x08004234 +halted: PC: 0x08004236 +halted: PC: 0x08004238 +halted: PC: 0x080014f2 +main () at Core/Src/main.c:136 +136 while (1) +### Assembly ######################################################################################################## + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x800420c + 0x080014ee main+122 bl 0x8004230 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 + 0x080014fa main+134 lsrs r0, r0, #32 +### Breakpoints ##################################################################################################### +[3] break at 0x0800423e in shared/drivers/p_serial_mgr.c:46 for p_serial_mgr.c:45 +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014f2 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 126 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 127 HAL_TIM_Base_Start_IT(&htim6); + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } +### Stack ########################################################################################################### +[0] from 0x080014f2 in main+126 at Core/Src/main.c:136 +### Threads ######################################################################################################### +[1] id 0 from 0x080014f2 in main+126 at Core/Src/main.c:136 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x080014ee +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x800420c + 0x080014ee main+122 bl 0x8004230 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +[3] break at 0x0800423e in shared/drivers/p_serial_mgr.c:46 for p_serial_mgr.c:45 +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x08004230 +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:43 +43 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ + 0x08004230 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004280 ) + 0x08004232 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004234 p_serial_mgr_service+4 cmp r3, #1 + 0x08004236 p_serial_mgr_service+6 beq.n 0x800423a + 0x08004238 p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +[3] break at 0x0800423e in shared/drivers/p_serial_mgr.c:46 for p_serial_mgr.c:45 +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004230 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 33 } + 34 } + 35 + 36 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 37 { + 38 _serial_huart_inst = huart; + 39 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 40 } + 41 void p_serial_mgr_service(void) + 42 { + 43 if (sstate == SS_START) + 44 { + 45 volatile HAL_StatusTypeDef ret; +!46 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 47 + 48 for (int ind = 1; ind < 21; ind++) + 49 { + 50 p_uart_async_write_byte(rxb[ind]); + 51 } + 52 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004230 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:43 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004230 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:43 +### Variables ####################################################################################################### +##################################################################################################################### +$1 = SS_IDLE +`/storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf' has changed; re-reading symbols. +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9698 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009858 +Loading section .ARM, size 0x8 lma 0x8009cd8 +Loading section .init_array, size 0x8 lma 0x8009ce0 +Loading section .fini_array, size 0x8 lma 0x8009ce8 +Loading section .data, size 0x9a8 lma 0x8009cf0 +Start address 0x080042b0, load size 42600 +Transfer rate: 29 KB/sec, 4733 bytes/write. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Breakpoint 3, p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:47 +47 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ +!0x08004244 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004294 ) + 0x08004246 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004248 p_serial_mgr_service+4 cmp r3, #1 + 0x0800424a p_serial_mgr_service+6 beq.n 0x800424e + 0x0800424c p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +[3] break at 0x08004244 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004244 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) + 46 { +!47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 1; ind < 21; ind++) + 53 { + 54 p_uart_async_write_byte(rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004244 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:47 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004244 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:47 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x08004246 +halted: PC: 0x08004248 +halted: PC: 0x0800424a +halted: PC: 0x0800424c +halted: PC: 0x080014f2 +main () at Core/Src/main.c:136 +136 while (1) +### Assembly ######################################################################################################## + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x8004220 + 0x080014ee main+122 bl 0x8004244 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 + 0x080014fa main+134 lsrs r0, r0, #32 +### Breakpoints ##################################################################################################### +[3] break at 0x08004244 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014f2 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 126 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 127 HAL_TIM_Base_Start_IT(&htim6); + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } +### Stack ########################################################################################################### +[0] from 0x080014f2 in main+126 at Core/Src/main.c:136 +### Threads ######################################################################################################### +[1] id 0 from 0x080014f2 in main+126 at Core/Src/main.c:136 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x080014ee +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x8004220 + 0x080014ee main+122 bl 0x8004244 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +[3] break at 0x08004244 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x08004244 + +Breakpoint 3, p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:47 +47 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ +!0x08004244 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004294 ) + 0x08004246 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004248 p_serial_mgr_service+4 cmp r3, #1 + 0x0800424a p_serial_mgr_service+6 beq.n 0x800424e + 0x0800424c p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +[3] break at 0x08004244 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 hit 2 times +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004244 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) + 46 { +!47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 1; ind < 21; ind++) + 53 { + 54 p_uart_async_write_byte(rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004244 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:47 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004244 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:47 +### Variables ####################################################################################################### +##################################################################################################################### +$2 = SS_IDLE +Note: breakpoint 3 also set at pc 0x8004244. +Breakpoint 4 at 0x8004244: file shared/drivers/p_serial_mgr.c, line 46. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 + +Program received signal SIGINT, Interrupt. +0x08004246 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:47 +47 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +!0x08004244 p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x8004294 ) + 0x08004246 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004248 p_serial_mgr_service+4 cmp r3, #1 + 0x0800424a p_serial_mgr_service+6 beq.n 0x800424e + 0x0800424c p_serial_mgr_service+8 bx lr + 0x0800424e p_serial_mgr_service+10 push {r4, lr} +### Breakpoints ##################################################################################################### +[4] break at 0x08004244 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 if (sstate == SS_START) +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$1 = SS_IDLE +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004246 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x20000dec r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) + 46 { +!47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 1; ind < 21; ind++) + 53 { + 54 p_uart_async_write_byte(rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004246 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004246 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +### Variables ####################################################################################################### +##################################################################################################################### +Breakpoint 5 at 0x80041f6: file shared/drivers/p_serial_mgr.c, line 30. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Breakpoint 5, UART1_RxCpltCallback (huart=0x20000a60 ) at shared/drivers/p_serial_mgr.c:36 +36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080041f4 UART1_RxCpltCallback+0 push {r3, lr} +!0x080041f6 UART1_RxCpltCallback+2 movs r2, #1 + 0x080041f8 UART1_RxCpltCallback+4 ldr r1, [pc, #8] ; (0x8004204 ) + 0x080041fa UART1_RxCpltCallback+6 ldr r3, [pc, #12] ; (0x8004208 ) + 0x080041fc UART1_RxCpltCallback+8 ldr r0, [r3, #0] + 0x080041fe UART1_RxCpltCallback+10 bl 0x8004034 +### Breakpoints ##################################################################################################### +[4] break at 0x08004244 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 if (sstate == SS_START) +[5] break at 0x080041f6 in shared/drivers/p_serial_mgr.c:36 for p_serial_mgr.c:30 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$1 = SS_IDLE +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000a60 r5 0x00004001 r10 0x00000000 pc 0x080041f6 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x080041f5 r8 0x00000000 sp 0x2000ff48 msp 0x2000ff48 control 0x00 + r4 0x20000a60 r9 0x00000000 lr 0x08003437 psp 0x00000000 +### Source ########################################################################################################## + 26 static serial_state_t sstate = SS_IDLE; + 27 + 28 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 29 { + 30 if (rxc == 0x7E && sstate == SS_IDLE) + 31 { + 32 sstate = SS_START; + 33 } + 34 else + 35 { +!36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) +### Stack ########################################################################################################### +[0] from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:36 +[1] from 0x08003436 in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003588 in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x0800152c in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08003ff4 in UART_Start_Receive_IT+152 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3685 +[6] from 0x08004078 in HAL_UART_Receive_IT+68 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1440 +[7] from 0x08004234 in p_serial_mgr_start+20 at shared/drivers/p_serial_mgr.c:65 +[8] from 0x080014ee in main+122 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:36 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +Continuing. +### Output/messages ################################################################################################# +halted: PC: 0x080041f8 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 +halted: PC: 0x08004246 + +Breakpoint 5, UART1_RxCpltCallback (huart=0x20000a60 ) at shared/drivers/p_serial_mgr.c:36 +36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080041f4 UART1_RxCpltCallback+0 push {r3, lr} +!0x080041f6 UART1_RxCpltCallback+2 movs r2, #1 + 0x080041f8 UART1_RxCpltCallback+4 ldr r1, [pc, #8] ; (0x8004204 ) + 0x080041fa UART1_RxCpltCallback+6 ldr r3, [pc, #12] ; (0x8004208 ) + 0x080041fc UART1_RxCpltCallback+8 ldr r0, [r3, #0] + 0x080041fe UART1_RxCpltCallback+10 bl 0x8004034 +### Breakpoints ##################################################################################################### +[4] break at 0x08004244 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 if (sstate == SS_START) +[5] break at 0x080041f6 in shared/drivers/p_serial_mgr.c:36 for p_serial_mgr.c:30 hit 2 times +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$1 = SS_IDLE +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000a60 r5 0x00004001 r10 0x00000000 pc 0x080041f6 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x080041f5 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x20000a60 r9 0x00000000 lr 0x08003437 psp 0x00000000 +### Source ########################################################################################################## + 26 static serial_state_t sstate = SS_IDLE; + 27 + 28 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 29 { + 30 if (rxc == 0x7E && sstate == SS_IDLE) + 31 { + 32 sstate = SS_START; + 33 } + 34 else + 35 { +!36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) +### Stack ########################################################################################################### +[0] from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:36 +[1] from 0x08003436 in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003632 in HAL_UART_IRQHandler+278 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2427 +[3] from 0x0800152c in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08004246 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +[6] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:36 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$3 = +`/storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf' has changed; re-reading symbols. +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x96b8 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009878 +Loading section .ARM, size 0x8 lma 0x8009cf8 +Loading section .init_array, size 0x8 lma 0x8009d00 +Loading section .fini_array, size 0x8 lma 0x8009d08 +Loading section .data, size 0x9a8 lma 0x8009d10 +Start address 0x080042cc, load size 42632 +Transfer rate: 29 KB/sec, 4736 bytes/write. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Breakpoint 5, UART1_RxCpltCallback (huart=0x20000a60 ) at shared/drivers/p_serial_mgr.c:30 +30 if (rxb[0] == 0x7E && sstate == SS_IDLE) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080041f4 UART1_RxCpltCallback+0 push {r3, lr} +!0x080041f6 UART1_RxCpltCallback+2 ldr r3, [pc, #36] ; (0x800421c ) + 0x080041f8 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x080041fa UART1_RxCpltCallback+6 cmp r3, #126 ; 0x7e + 0x080041fc UART1_RxCpltCallback+8 bne.n 0x800420c + 0x080041fe UART1_RxCpltCallback+10 ldr r3, [pc, #32] ; (0x8004220 ) +### Breakpoints ##################################################################################################### +[4] break at 0x08004260 in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:45 if (sstate == SS_START) +[5] break at 0x080041f6 in shared/drivers/p_serial_mgr.c:30 for p_serial_mgr.c:30 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$2 = SS_IDLE +$$1 = SS_IDLE +$$0 = +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000a60 r5 0x00004001 r10 0x00000000 pc 0x080041f6 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x080041f5 r8 0x00000000 sp 0x2000ff48 msp 0x2000ff48 control 0x00 + r4 0x20000a60 r9 0x00000000 lr 0x08003437 psp 0x00000000 +### Source ########################################################################################################## + 20 SS_START = 1, // get start byte, interrupt after 4 more bytes + 21 } serial_state_t; + 22 + 23 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 24 + 25 static uint8_t rxc = '\0'; + 26 static serial_state_t sstate = SS_IDLE; + 27 + 28 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 29 { +!30 if (rxb[0] == 0x7E && sstate == SS_IDLE) + 31 { + 32 sstate = SS_START; + 33 } + 34 else + 35 { + 36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); + 37 } + 38 } + 39 +### Stack ########################################################################################################### +[0] from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +[1] from 0x08003436 in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003588 in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x0800152c in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08003ff4 in UART_Start_Receive_IT+152 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3685 +[6] from 0x08004078 in HAL_UART_Receive_IT+68 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1440 +[7] from 0x08004250 in p_serial_mgr_start+20 at shared/drivers/p_serial_mgr.c:65 +[8] from 0x080014ee in main+122 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40013800,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] +UART1_RxCpltCallback (huart=0x20000a60 ) at shared/drivers/p_serial_mgr.c:30 +30 if (rxb[0] == 0x7E && sstate == SS_IDLE) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080041f4 UART1_RxCpltCallback+0 push {r3, lr} + 0x080041f6 UART1_RxCpltCallback+2 ldr r3, [pc, #36] ; (0x800421c ) + 0x080041f8 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x080041fa UART1_RxCpltCallback+6 cmp r3, #126 ; 0x7e + 0x080041fc UART1_RxCpltCallback+8 bne.n 0x800420c + 0x080041fe UART1_RxCpltCallback+10 ldr r3, [pc, #32] ; (0x8004220 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000a60 r5 0x00004001 r10 0x00000000 pc 0x080041f6 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x080041f5 r8 0x00000000 sp 0x2000ff48 msp 0x2000ff48 control 0x00 + r4 0x20000a60 r9 0x00000000 lr 0x08003437 psp 0x00000000 +### Source ########################################################################################################## + 20 SS_START = 1, // get start byte, interrupt after 4 more bytes + 21 } serial_state_t; + 22 + 23 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 24 + 25 static uint8_t rxc = '\0'; + 26 static serial_state_t sstate = SS_IDLE; + 27 + 28 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 29 { + 30 if (rxb[0] == 0x7E && sstate == SS_IDLE) + 31 { + 32 sstate = SS_START; + 33 } + 34 else + 35 { + 36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); + 37 } + 38 } + 39 +### Stack ########################################################################################################### +[0] from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +[1] from 0x08003436 in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003588 in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x0800152c in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08003ff4 in UART_Start_Receive_IT+152 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3685 +[6] from 0x08004078 in HAL_UART_Receive_IT+68 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1440 +[7] from 0x08004250 in p_serial_mgr_start+20 at shared/drivers/p_serial_mgr.c:65 +[8] from 0x080014ee in main+122 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x080041f6 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x96b8 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009878 +Loading section .ARM, size 0x8 lma 0x8009cf8 +Loading section .init_array, size 0x8 lma 0x8009d00 +Loading section .fini_array, size 0x8 lma 0x8009d08 +Loading section .data, size 0x9a8 lma 0x8009d10 +Start address 0x080042cc, load size 42632 +Transfer rate: 29 KB/sec, 4736 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] +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:57 +57 memset(rxb, 0, (unsigned int)MAX_MESSAGE_LEN); +### Assembly ######################################################################################################## + 0x0800425e p_serial_mgr_service+50 movs r0, #0 + 0x08004260 p_serial_mgr_service+52 ldr r3, [pc, #76] ; (0x80042b0 ) + 0x08004262 p_serial_mgr_service+54 ldrb r3, [r3, #0] + 0x08004264 p_serial_mgr_service+56 cmp r3, #1 + 0x08004266 p_serial_mgr_service+58 beq.n 0x800426a + 0x08004268 p_serial_mgr_service+60 bx lr + 0x0800426a p_serial_mgr_service+62 push {r4, lr} + 0x0800426c p_serial_mgr_service+64 sub sp, #8 + 0x0800426e p_serial_mgr_service+66 movs r3, #10 + 0x08004270 p_serial_mgr_service+68 mov.w r2, #516 ; 0x204 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004268 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00000004 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 0; ind < 24; ind++) + 53 { + 54 PDEBUG("[%d]: %02x\n", rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); + 57 memset(rxb, 0, (unsigned int)MAX_MESSAGE_LEN); + 58 p_serial_mgr_start(); + 59 } + 60 } + 61 + 62 void p_serial_mgr_start() + 63 { + 64 sstate = SS_IDLE; + 65 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); + 66 } +### Stack ########################################################################################################### +[0] from 0x08004268 in p_serial_mgr_service+60 at shared/drivers/p_serial_mgr.c:57 +[1] from 0x08004302 in __libc_init_array +### Threads ######################################################################################################### +[1] id 0 from 0x08004268 in p_serial_mgr_service+60 at shared/drivers/p_serial_mgr.c:57 +### Variables ####################################################################################################### +loc ret = 32 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9648 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009808 +Loading section .ARM, size 0x8 lma 0x8009c90 +Loading section .init_array, size 0x8 lma 0x8009c98 +Loading section .fini_array, size 0x8 lma 0x8009ca0 +Loading section .data, size 0x9a8 lma 0x8009ca8 +Start address 0x0800429c, load size 42528 +Transfer rate: 29 KB/sec, 4725 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] +0x08004232 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:47 +47 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ + 0x0800422c p_serial_mgr_service+0 ldr r3, [pc, #76] ; (0x800427c ) + 0x0800422e p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004230 p_serial_mgr_service+4 cmp r3, #1 + 0x08004232 p_serial_mgr_service+6 beq.n 0x8004236 + 0x08004234 p_serial_mgr_service+8 bx lr + 0x08004236 p_serial_mgr_service+10 push {r4, lr} + 0x08004238 p_serial_mgr_service+12 sub sp, #8 + 0x0800423a p_serial_mgr_service+14 movs r3, #10 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004232 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00000004 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) + 46 { + 47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, rxb, MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 0; ind < 24; ind++) + 53 { + 54 PDEBUG("[%d]: %02x\n", ind, rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004232 in p_serial_mgr_service+6 at shared/drivers/p_serial_mgr.c:47 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004232 in p_serial_mgr_service+6 at shared/drivers/p_serial_mgr.c:47 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9648 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009808 +Loading section .ARM, size 0x8 lma 0x8009c90 +Loading section .init_array, size 0x8 lma 0x8009c98 +Loading section .fini_array, size 0x8 lma 0x8009ca0 +Loading section .data, size 0x9a8 lma 0x8009ca8 +Start address 0x080042a0, load size 42528 +Transfer rate: 29 KB/sec, 4725 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] +main () at Core/Src/main.c:138 +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x8004208 + 0x080014ee main+122 bl 0x800422c + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00000004 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9650 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009810 +Loading section .ARM, size 0x8 lma 0x8009c98 +Loading section .init_array, size 0x8 lma 0x8009ca0 +Loading section .fini_array, size 0x8 lma 0x8009ca8 +Loading section .data, size 0x9a8 lma 0x8009cb0 +Start address 0x080042a4, load size 42536 +Transfer rate: 29 KB/sec, 4726 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] +0x08004230 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:47 +47 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ + 0x0800422c p_serial_mgr_service+0 ldr r3, [pc, #80] ; (0x8004280 ) + 0x0800422e p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004230 p_serial_mgr_service+4 cmp r3, #1 + 0x08004232 p_serial_mgr_service+6 beq.n 0x8004236 + 0x08004234 p_serial_mgr_service+8 bx lr + 0x08004236 p_serial_mgr_service+10 push {r4, lr} + 0x08004238 p_serial_mgr_service+12 sub sp, #8 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08004230 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00000004 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) + 46 { + 47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, &rxb[1], MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 0; ind < 24; ind++) + 53 { + 54 PDEBUG("[%d]: %02x\n", ind, rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x08004230 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:47 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x08004230 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:47 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x080042a4 msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9650 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009810 +Loading section .ARM, size 0x8 lma 0x8009c98 +Loading section .init_array, size 0x8 lma 0x8009ca0 +Loading section .fini_array, size 0x8 lma 0x8009ca8 +Loading section .data, size 0x9a8 lma 0x8009cb0 +Start address 0x080042a4, load size 42536 +Transfer rate: 29 KB/sec, 4726 bytes/write. +Breakpoint 1 at 0x800422c: file shared/drivers/p_serial_mgr.c, line 47. +Note: automatically using hardware breakpoints for read-only addresses. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e + +Program received signal SIGINT, Interrupt. +0x0800422e in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:47 +47 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +!0x0800422c p_serial_mgr_service+0 ldr r3, [pc, #80] ; (0x8004280 ) + 0x0800422e p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004230 p_serial_mgr_service+4 cmp r3, #1 + 0x08004232 p_serial_mgr_service+6 beq.n 0x8004236 + 0x08004234 p_serial_mgr_service+8 bx lr + 0x08004236 p_serial_mgr_service+10 push {r4, lr} +### Breakpoints ##################################################################################################### +[1] break at 0x0800422c in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:47 if sstate == SS_START +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x0800422e primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x20000de0 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) + 46 { +!47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, &rxb[1], MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 0; ind < 24; ind++) + 53 { + 54 PDEBUG("[%d]: %02x\n", ind, rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x0800422e in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x0800422e in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +### Variables ####################################################################################################### +##################################################################################################################### +Breakpoint 2 at 0x80041c2: file shared/drivers/p_serial_mgr.c, line 30. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Breakpoint 2, UART1_RxCpltCallback (huart=0x20000a60 ) at shared/drivers/p_serial_mgr.c:30 +30 if (rxb[0] == 0x7E && sstate == SS_IDLE) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080041c0 UART1_RxCpltCallback+0 push {r3, lr} +!0x080041c2 UART1_RxCpltCallback+2 ldr r3, [pc, #36] ; (0x80041e8 ) + 0x080041c4 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x080041c6 UART1_RxCpltCallback+6 cmp r3, #126 ; 0x7e + 0x080041c8 UART1_RxCpltCallback+8 bne.n 0x80041d8 + 0x080041ca UART1_RxCpltCallback+10 ldr r3, [pc, #32] ; (0x80041ec ) +### Breakpoints ##################################################################################################### +[1] break at 0x0800422c in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:47 if sstate == SS_START +[2] break at 0x080041c2 in shared/drivers/p_serial_mgr.c:30 for p_serial_mgr.c:30 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000a60 r5 0x00004001 r10 0x00000000 pc 0x080041c2 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x080041c1 r8 0x00000000 sp 0x2000ff48 msp 0x2000ff48 control 0x00 + r4 0x20000a60 r9 0x00000000 lr 0x08003437 psp 0x00000000 +### Source ########################################################################################################## + 20 SS_START = 1, // get start byte, interrupt after 4 more bytes + 21 } serial_state_t; + 22 + 23 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 24 + 25 static uint8_t rxc = '\0'; + 26 static serial_state_t sstate = SS_IDLE; + 27 + 28 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 29 { +!30 if (rxb[0] == 0x7E && sstate == SS_IDLE) + 31 { + 32 sstate = SS_START; + 33 } + 34 else + 35 { + 36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); + 37 } + 38 } + 39 +### Stack ########################################################################################################### +[0] from 0x080041c2 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +[1] from 0x08003436 in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003588 in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x0800152c in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08003ff4 in UART_Start_Receive_IT+152 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3685 +[6] from 0x08004078 in HAL_UART_Receive_IT+68 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1440 +[7] from 0x0800421c in p_serial_mgr_start+20 at shared/drivers/p_serial_mgr.c:65 +[8] from 0x080014ee in main+122 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x080041c2 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$1 = 0 '\000' +Continuing. +### Output/messages ################################################################################################# +halted: PC: 0x080041c4 +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e + +Breakpoint 2, UART1_RxCpltCallback (huart=0x20000a60 ) at shared/drivers/p_serial_mgr.c:30 +30 if (rxb[0] == 0x7E && sstate == SS_IDLE) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080041c0 UART1_RxCpltCallback+0 push {r3, lr} +!0x080041c2 UART1_RxCpltCallback+2 ldr r3, [pc, #36] ; (0x80041e8 ) + 0x080041c4 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x080041c6 UART1_RxCpltCallback+6 cmp r3, #126 ; 0x7e + 0x080041c8 UART1_RxCpltCallback+8 bne.n 0x80041d8 + 0x080041ca UART1_RxCpltCallback+10 ldr r3, [pc, #32] ; (0x80041ec ) +### Breakpoints ##################################################################################################### +[1] break at 0x0800422c in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:47 if sstate == SS_START +[2] break at 0x080041c2 in shared/drivers/p_serial_mgr.c:30 for p_serial_mgr.c:30 hit 2 times +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = 0 '\000' +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000a60 r5 0x00000002 r10 0x00000000 pc 0x080041c2 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x080041c1 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x20000a60 r9 0x00000000 lr 0x08003437 psp 0x00000000 +### Source ########################################################################################################## + 20 SS_START = 1, // get start byte, interrupt after 4 more bytes + 21 } serial_state_t; + 22 + 23 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 24 + 25 static uint8_t rxc = '\0'; + 26 static serial_state_t sstate = SS_IDLE; + 27 + 28 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 29 { +!30 if (rxb[0] == 0x7E && sstate == SS_IDLE) + 31 { + 32 sstate = SS_START; + 33 } + 34 else + 35 { + 36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 1); + 37 } + 38 } + 39 +### Stack ########################################################################################################### +[0] from 0x080041c2 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +[1] from 0x08003436 in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003632 in HAL_UART_IRQHandler+278 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2427 +[3] from 0x0800152c in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x0800422e in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +[6] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080041c2 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$2 = 5 '\005' +$3 = (UART_HandleTypeDef *) 0x20000a60 +$4 = { + Instance = 0x40013800, + Init = { + BaudRate = 115200, + WordLength = 0, + StopBits = 0, + Parity = 0, + Mode = 12, + HwFlowCtl = 0, + OverSampling = 0, + OneBitSampling = 0 + }, + AdvancedInit = { + AdvFeatureInit = 0, + TxPinLevelInvert = 0, + RxPinLevelInvert = 0, + DataInvert = 0, + Swap = 0, + OverrunDisable = 0, + DMADisableonRxError = 0, + AutoBaudRateEnable = 0, + AutoBaudRateMode = 0, + MSBFirst = 0 + }, + pTxBuffPtr = 0x0, + TxXferSize = 0, + TxXferCount = 0, + pRxBuffPtr = 0x20000bdd "", + RxXferSize = 1, + RxXferCount = 0, + Mask = 255, + ReceptionType = 0, + RxISR = 0x0, + TxISR = 0x0, + hdmatx = 0x0, + hdmarx = 0x0, + Lock = HAL_UNLOCKED, + gState = 32, + RxState = 32, + ErrorCode = 12, + TxHalfCpltCallback = 0x800331b , + TxCpltCallback = 0x8003319 , + RxHalfCpltCallback = 0x800331f , + RxCpltCallback = 0x80041c1 , + ErrorCallback = 0x8003321 , + AbortCpltCallback = 0x8003323 , + AbortTransmitCpltCallback = 0x8003325 , + AbortReceiveCpltCallback = 0x8003327 , + WakeupCallback = 0x800412d , + RxEventCallback = 0x8003329 , + MspInitCallback = 0x8001639 , + MspDeInitCallback = 0x0 +} +`/storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf' has changed; re-reading symbols. +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9650 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009810 +Loading section .ARM, size 0x8 lma 0x8009c98 +Loading section .init_array, size 0x8 lma 0x8009ca0 +Loading section .fini_array, size 0x8 lma 0x8009ca8 +Loading section .data, size 0x9a8 lma 0x8009cb0 +Start address 0x080042a4, load size 42536 +Transfer rate: 29 KB/sec, 4726 bytes/write. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e +halted: PC: 0x0800422e + +Program received signal SIGINT, Interrupt. +0x0800422e in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:47 +47 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +!0x0800422c p_serial_mgr_service+0 ldr r3, [pc, #80] ; (0x8004280 ) + 0x0800422e p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004230 p_serial_mgr_service+4 cmp r3, #1 + 0x08004232 p_serial_mgr_service+6 beq.n 0x8004236 + 0x08004234 p_serial_mgr_service+8 bx lr + 0x08004236 p_serial_mgr_service+10 push {r4, lr} +### Breakpoints ##################################################################################################### +[1] break at 0x0800422c in shared/drivers/p_serial_mgr.c:47 for p_serial_mgr.c:47 if sstate == SS_START +[2] break at 0x080041c2 in shared/drivers/p_serial_mgr.c:30 for p_serial_mgr.c:30 +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$2 = 5 '\005' +$$1 = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +$$0 = {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBits = 0,Parity = 0,Mode = 12,Hw… +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x0800422e primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x20000de0 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 37 } + 38 } + 39 + 40 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 41 { + 42 _serial_huart_inst = huart; + 43 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 44 } + 45 void p_serial_mgr_service(void) + 46 { +!47 if (sstate == SS_START) + 48 { + 49 volatile HAL_StatusTypeDef ret; + 50 ret = HAL_UART_Receive(_serial_huart_inst, &rxb[1], MAX_MESSAGE_LEN, 10); + 51 + 52 for (int ind = 0; ind < 24; ind++) + 53 { + 54 PDEBUG("[%d]: %02x\n", ind, rxb[ind]); + 55 } + 56 PDEBUG("\n\n\n\n"); +### Stack ########################################################################################################### +[0] from 0x0800422e in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x0800422e in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:47 +### Variables ####################################################################################################### +##################################################################################################################### +Breakpoint 3 at 0x80041c2: file shared/drivers/p_serial_mgr.c, line 30. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Breakpoint 3, UART1_RxCpltCallback (huart=0x20000a60 ) at shared/drivers/p_serial_mgr.c:30 +30 if (rxb[0] == 0x7E && sstate == SS_IDLE) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080041c0 UART1_RxCpltCallback+0 push {r3, lr} +!0x080041c2 UART1_RxCpltCallback+2 ldr r3, [pc, #36] ; (0x80041e8 ) + 0x080041c4 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x080041c6 UART1_RxCpltCallback+6 cmp r3, #126 ; 0x7e + 0x080041c8 UART1_RxCpltCallback+8 bne.n 0x80041d8 + 0x080041ca UART1_RxCpltCallback+10 ldr r3, [pc, #32] ; (0x80041ec ) +### Breakpoints ##################################################################################################### +[3] break at 0x080041c2 in shared/drivers/p_serial_mgr.c:30 for p_serial_mgr.c:30 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$2 = 5 '\005' +$$1 = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +$$0 = {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBits = 0,Parity = 0,Mode = 12,Hw… +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000a60 r5 0x00004001 r10 0x00000000 pc 0x080041c2 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x080041c1 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x20000a60 r9 0x00000000 lr 0x08003437 psp 0x00000000 +### Source ########################################################################################################## + 20 SS_START = 1, // get start byte, interrupt after 4 more bytes + 21 } serial_state_t; + 22 + 23 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 24 + 25 static uint8_t rxc = '\0'; + 26 static serial_state_t sstate = SS_IDLE; + 27 + 28 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 29 { +!30 if (rxb[0] == 0x7E && sstate == SS_IDLE) + 31 { + 32 sstate = SS_START; + 33 } + 34 else + 35 { + 36 HAL_UART_Receive_IT(_serial_huart_inst, rxb, 3); + 37 } + 38 } + 39 +### Stack ########################################################################################################### +[0] from 0x080041c2 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +[1] from 0x08003436 in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003588 in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x0800152c in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08004232 in p_serial_mgr_service+6 at shared/drivers/p_serial_mgr.c:47 +[6] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080041c2 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:30 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$5 = "\000\005\002", '\000' +$6 = {[0x0] = 0x0, [0x1] = 0x5, [0x2] = 0x2, [0x3] = 0x0, [0x4] = 0x0, [0x5] = 0x0, [0x6] = 0x0, [0x7] = 0x0, [0x8] = 0x0, [0x9] = 0x0} +$7 = {[0x0] = 0x0, [0x1] = 0x5, [0x2] = 0x2, [0x3] = 0x0, [0x4] = 0x0, [0x5] = 0x0, [0x6] = 0x0, [0x7] = 0x0, [0x8] = 0x0, [0x9] = 0x0} +Continuing. +### Output/messages ################################################################################################# +halted: PC: 0x080041c4 + +Program received signal SIGINT, Interrupt. +main () at Core/Src/main.c:138 +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x8004208 + 0x080014ee main+122 bl 0x800422c + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +[3] break at 0x080041c2 in shared/drivers/p_serial_mgr.c:30 for p_serial_mgr.c:30 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$2 = "\000\005\002", '\000' +$$1 = "\000\005\002\000\000\000\000\000\000" +$$0 = "\000\005\002\000\000\000\000\000\000" +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +main () at Core/Src/main.c:138 +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x8004034 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x8004208 + 0x080014ee main+122 bl 0x800422c + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xac70 lma 0x80001c0 +Loading section .rodata, size 0x4a0 lma 0x800ae30 +Loading section .ARM, size 0x8 lma 0x800b2d0 +Loading section .init_array, size 0x8 lma 0x800b2d8 +Loading section .fini_array, size 0x8 lma 0x800b2e0 +Loading section .data, size 0x9a8 lma 0x800b2e8 +Start address 0x080043fc, load size 48224 +Transfer rate: 30 KB/sec, 5358 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] +main () at Core/Src/main.c:138 +138 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x080014de main+106 mov r0, r4 + 0x080014e0 main+108 bl 0x80040d4 + 0x080014e4 main+112 ldr r0, [pc, #32] ; (0x8001508 ) + 0x080014e6 main+114 bl 0x800195c + 0x080014ea main+118 bl 0x80043cc + 0x080014ee main+122 bl 0x80043c8 + 0x080014f2 main+126 b.n 0x80014ee + 0x080014f4 main+128 lsrs r4, r2, #12 + 0x080014f6 main+130 movs r0, #0 + 0x080014f8 main+132 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014ee primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 128 + 129 p_serial_mgr_start(); + 130 + 131 uint16_t motor_degrees = 0; + 132 /* USER CODE END 2 */ + 133 + 134 /* Infinite loop */ + 135 /* USER CODE BEGIN WHILE */ + 136 while (1) + 137 { + 138 p_serial_mgr_service(); + 139 // if (b_timer_struck) + 140 // { + 141 // // PDEBUG("%d\n", sys_time); + 142 // b_timer_struck = false; + 143 // motor_degrees = (motor_degrees + 1) % 360; + 144 // mc_service(motor_degrees, 50); + 145 // } + 146 // serial_pkt_t *pkt = NULL; + 147 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014ee in main+122 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ee in main+122 at Core/Src/main.c:138 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x080043fc msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xac70 lma 0x80001c0 +Loading section .rodata, size 0x4a0 lma 0x800ae30 +Loading section .ARM, size 0x8 lma 0x800b2d0 +Loading section .init_array, size 0x8 lma 0x800b2d8 +Loading section .fini_array, size 0x8 lma 0x800b2e0 +Loading section .data, size 0x9a8 lma 0x800b2e8 +Start address 0x080043fc, load size 48224 +Transfer rate: 30 KB/sec, 5358 bytes/write. +Breakpoint 1 at 0x800436e: file shared/drivers/p_serial_mgr.c, line 35. +Note: automatically using hardware breakpoints for read-only addresses. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Program received signal SIGINT, Interrupt. +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +warning: Source file is more recent than executable. +48 {} +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ + 0x080043c8 p_serial_mgr_service+0 bx lr +~ +~ +~ +~ +### Breakpoints ##################################################################################################### +[1] break at 0x0800436e in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080043c8 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 HAL_UART_Receive_DMA(_serial_huart_inst, rxb, MAX_MESSAGE_LEN); + 40 } + 41 + 42 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 43 { + 44 _serial_huart_inst = huart; + 45 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 46 } + 47 void p_serial_mgr_service(void) + 48 {} + 49 + 50 void p_serial_mgr_start() + 51 { + 52 sstate = SS_IDLE; + 53 HAL_UART_Receive_DMA(_serial_huart_inst, rxb, MAX_MESSAGE_LEN); + 54 } +~ +~ +~ +### Stack ########################################################################################################### +[0] from 0x080043c8 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x080014f2 in main+126 at Core/Src/main.c:138 +### Threads ######################################################################################################### +[1] id 0 from 0x080043c8 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +0x080043c8 in UART_Start_Receive_DMA (huart=0x20000b14 , pData=, Size=) at Drivers/CMSIS/Include/cmsis_gcc.h:1207 +1207 return(result); +### Assembly ######################################################################################################## + 0x080043be UART_Start_Receive_DMA+102 bx lr + 0x080043c0 UART_Start_Receive_DMA+104 lsrs r0, r3, #15 + 0x080043c2 UART_Start_Receive_DMA+106 movs r0, #0 + 0x080043c4 UART_Start_Receive_DMA+108 muls r5, r5 + 0x080043c6 UART_Start_Receive_DMA+110 lsrs r0, r0, #32 + 0x080043c8 UART_Start_Receive_DMA+112 bx lr + 0x080043ca UART_Start_Receive_DMA+114 movs r0, r0 + 0x080043cc UART_Start_Receive_DMA+116 push {r3, lr} + 0x080043ce UART_Start_Receive_DMA+118 ldr r3, [pc, #20] ; (0x80043e4 ) + 0x080043d0 UART_Start_Receive_DMA+120 movs r2, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080043c8 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b14 r9 0x00000000 lr 0x080014f3 psp 0x00000000 +### Source ########################################################################################################## + 1197 \param [in] value Value to store + 1198 \param [in] ptr Pointer to location + 1199 \return 0 Function succeeded + 1200 \return 1 Function failed + 1201 */ + 1202 __STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) + 1203 { + 1204 uint32_t result; + 1205 + 1206 __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + 1207 return(result); + 1208 } + 1209 + 1210 + 1211 /** + 1212 \brief Remove the exclusive lock + 1213 \details Removes the exclusive lock which is created by LDREX. + 1214 */ + 1215 __STATIC_FORCEINLINE void __CLREX(void) + 1216 { +### Stack ########################################################################################################### +[0] from 0x080043c8 in UART_Start_Receive_DMA+112 at Drivers/CMSIS/Include/cmsis_gcc.h:1207 +[1] from 0x20002250 in sbuffer +### Threads ######################################################################################################### +[1] id 0 from 0x080043c8 in UART_Start_Receive_DMA+112 at Drivers/CMSIS/Include/cmsis_gcc.h:1207 +### Variables ####################################################################################################### +arg huart = 0x20000b14 : {Instance = 0x40004400,Init = {BaudRate = 115200,WordLength = 0,St…, pData = , Size = +loc val = 1073745920 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xae98 lma 0x80001c0 +Loading section .rodata, size 0x4a0 lma 0x800b058 +Loading section .ARM, size 0x8 lma 0x800b4f8 +Loading section .init_array, size 0x8 lma 0x800b500 +Loading section .fini_array, size 0x8 lma 0x800b508 +Loading section .data, size 0x9a8 lma 0x800b510 +Start address 0x08004624, load size 48776 +Transfer rate: 31 KB/sec, 5419 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] +main () at Core/Src/main.c:139 +139 while (1) +### Assembly ######################################################################################################## + 0x08001518 main+112 bl 0x80042fc + 0x0800151c main+116 ldr r0, [pc, #32] ; (0x8001540 ) + 0x0800151e main+118 bl 0x80019b8 + 0x08001522 main+122 bl 0x80045f4 + 0x08001526 main+126 bl 0x80045f0 + 0x0800152a main+130 b.n 0x8001526 + 0x0800152c main+132 lsrs r4, r3, #13 + 0x0800152e main+134 movs r0, #0 + 0x08001530 main+136 asrs r1, r5, #5 + 0x08001532 main+138 lsrs r0, r0, #32 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x0800152a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 129 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 130 HAL_TIM_Base_Start_IT(&htim6); + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } +### Stack ########################################################################################################### +[0] from 0x0800152a in main+130 at Core/Src/main.c:139 +### Threads ######################################################################################################### +[1] id 0 from 0x0800152a in main+130 at Core/Src/main.c:139 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x08004624 msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xae98 lma 0x80001c0 +Loading section .rodata, size 0x4a0 lma 0x800b058 +Loading section .ARM, size 0x8 lma 0x800b4f8 +Loading section .init_array, size 0x8 lma 0x800b500 +Loading section .fini_array, size 0x8 lma 0x800b508 +Loading section .data, size 0x9a8 lma 0x800b510 +Start address 0x08004624, load size 48776 +Transfer rate: 30 KB/sec, 5419 bytes/write. +Breakpoint 1 at 0x8004596: file shared/drivers/p_serial_mgr.c, line 35. +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, UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 for (int ind = 0; ind < 24; ind++) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004594 UART1_RxCpltCallback+0 push {r4, lr} +!0x08004596 UART1_RxCpltCallback+2 movs r4, #0 + 0x08004598 UART1_RxCpltCallback+4 b.n 0x80045b2 + 0x0800459a UART1_RxCpltCallback+6 ldr r3, [pc, #44] ; (0x80045c8 ) + 0x0800459c UART1_RxCpltCallback+8 ldrb r3, [r3, #0] + 0x0800459e UART1_RxCpltCallback+10 add.w r3, r3, r3, lsl #7 +### Breakpoints ##################################################################################################### +[1] break at 0x08004596 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x0000008b r10 0x00000000 pc 0x08004596 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x8100001f basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x08004595 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x40020058 r9 0x00000000 lr 0x080036d1 psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 for (int ind = 0; ind < 24; ind++) + 36 { + 37 printf("[%d]: 0x%02x\n", sbuffer[active_buffer][ind]); + 38 } + 39 HAL_UART_Receive_DMA(_serial_huart_inst, rxb, MAX_MESSAGE_LEN); + 40 } + 41 + 42 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 43 { + 44 _serial_huart_inst = huart; +### Stack ########################################################################################################### +[0] from 0x08004596 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x080036d0 in UART_DMAReceiveCplt+110 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3907 +[2] from 0x08003420 in HAL_DMA_IRQHandler+132 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c:855 +[3] from 0x08001564 in DMA1_Channel5_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004596 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +loc ind = 0 +##################################################################################################################### +### Output/messages ################################################################################################# +halted: PC: 0x08004598 +halted: PC: 0x080045b2 +halted: PC: 0x080045b4 +halted: PC: 0x0800459a +37 printf("[%d]: 0x%02x\n", sbuffer[active_buffer][ind]); +### Assembly ######################################################################################################## +~ +~ + 0x08004594 UART1_RxCpltCallback+0 push {r4, lr} +!0x08004596 UART1_RxCpltCallback+2 movs r4, #0 + 0x08004598 UART1_RxCpltCallback+4 b.n 0x80045b2 + 0x0800459a UART1_RxCpltCallback+6 ldr r3, [pc, #44] ; (0x80045c8 ) + 0x0800459c UART1_RxCpltCallback+8 ldrb r3, [r3, #0] + 0x0800459e UART1_RxCpltCallback+10 add.w r3, r3, r3, lsl #7 + 0x080045a2 UART1_RxCpltCallback+14 lsls r2, r3, #2 + 0x080045a4 UART1_RxCpltCallback+16 ldr r3, [pc, #36] ; (0x80045cc ) +### Breakpoints ##################################################################################################### +[1] break at 0x08004596 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x0000008b r10 0x00000000 pc 0x0800459a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x8100001f basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x08004595 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x00000000 r9 0x00000000 lr 0x080036d1 psp 0x00000000 +### Source ########################################################################################################## + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 for (int ind = 0; ind < 24; ind++) + 36 { + 37 printf("[%d]: 0x%02x\n", sbuffer[active_buffer][ind]); + 38 } + 39 HAL_UART_Receive_DMA(_serial_huart_inst, rxb, MAX_MESSAGE_LEN); + 40 } + 41 + 42 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 43 { + 44 _serial_huart_inst = huart; + 45 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 46 } +### Stack ########################################################################################################### +[0] from 0x0800459a in UART1_RxCpltCallback+6 at shared/drivers/p_serial_mgr.c:37 +[1] from 0x080036d0 in UART_DMAReceiveCplt+110 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3907 +[2] from 0x08003420 in HAL_DMA_IRQHandler+132 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c:855 +[3] from 0x08001564 in DMA1_Channel5_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x0800459a in UART1_RxCpltCallback+6 at shared/drivers/p_serial_mgr.c:37 +### Variables ####################################################################################################### +arg huart = +loc ind = 0 +##################################################################################################################### +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +UART1_RxCpltCallback (huart=) at shared/drivers/p_serial_mgr.c:37 +37 PDEBUG("[%d]: 0x%02x\n", sbuffer[active_buffer][ind]); +### Assembly ######################################################################################################## +~ +~ + 0x08004594 UART1_RxCpltCallback+0 push {r4, lr} + 0x08004596 UART1_RxCpltCallback+2 movs r4, #0 + 0x08004598 UART1_RxCpltCallback+4 b.n 0x80045b2 + 0x0800459a UART1_RxCpltCallback+6 ldr r3, [pc, #44] ; (0x80045c8 ) + 0x0800459c UART1_RxCpltCallback+8 ldrb r3, [r3, #0] + 0x0800459e UART1_RxCpltCallback+10 add.w r3, r3, r3, lsl #7 + 0x080045a2 UART1_RxCpltCallback+14 lsls r2, r3, #2 + 0x080045a4 UART1_RxCpltCallback+16 ldr r3, [pc, #36] ; (0x80045cc ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x0000008b r10 0x00000000 pc 0x0800459a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x8100001f basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x08004595 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x00000000 r9 0x00000000 lr 0x080036d1 psp 0x00000000 +### Source ########################################################################################################## + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { + 35 for (int ind = 0; ind < 24; ind++) + 36 { + 37 PDEBUG("[%d]: 0x%02x\n", sbuffer[active_buffer][ind]); + 38 } + 39 HAL_UART_Receive_DMA(_serial_huart_inst, rxb, MAX_MESSAGE_LEN); + 40 } + 41 + 42 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 43 { + 44 _serial_huart_inst = huart; + 45 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 46 } +### Stack ########################################################################################################### +[0] from 0x0800459a in UART1_RxCpltCallback+6 at shared/drivers/p_serial_mgr.c:37 +[1] from 0x080036d0 in UART_DMAReceiveCplt+110 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3907 +[2] from 0x08003420 in HAL_DMA_IRQHandler+132 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c:855 +[3] from 0x08001564 in DMA1_Channel5_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x0800459a in UART1_RxCpltCallback+6 at shared/drivers/p_serial_mgr.c:37 +### Variables ####################################################################################################### +arg huart = +loc ind = 0 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x99d0 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009b90 +Loading section .ARM, size 0x8 lma 0x800a010 +Loading section .init_array, size 0x8 lma 0x800a018 +Loading section .fini_array, size 0x8 lma 0x800a020 +Loading section .data, size 0x9a8 lma 0x800a028 +Start address 0x08004624, load size 43424 +Transfer rate: 29 KB/sec, 4824 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] +main () at Core/Src/main.c:141 +141 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x08001516 main+110 mov r0, r4 + 0x08001518 main+112 bl 0x80042fc + 0x0800151c main+116 ldr r0, [pc, #32] ; (0x8001540 ) + 0x0800151e main+118 bl 0x80019b8 + 0x08001522 main+122 bl 0x80045f4 + 0x08001526 main+126 bl 0x80045f0 + 0x0800152a main+130 b.n 0x8001526 + 0x0800152c main+132 lsrs r4, r3, #13 + 0x0800152e main+134 movs r0, #0 + 0x08001530 main+136 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08001526 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } + 149 // serial_pkt_t *pkt = NULL; + 150 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08001526 in main+126 at Core/Src/main.c:141 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x08004624 msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x99d0 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009b90 +Loading section .ARM, size 0x8 lma 0x800a010 +Loading section .init_array, size 0x8 lma 0x800a018 +Loading section .fini_array, size 0x8 lma 0x800a020 +Loading section .data, size 0x9a8 lma 0x800a028 +Start address 0x08004624, load size 43424 +Transfer rate: 29 KB/sec, 4824 bytes/write. +Breakpoint 1 at 0x8004596: file shared/drivers/p_serial_mgr.c, line 35. +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, UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 for (int ind = 0; ind < 24; ind++) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004594 UART1_RxCpltCallback+0 push {r4, lr} +!0x08004596 UART1_RxCpltCallback+2 movs r4, #0 + 0x08004598 UART1_RxCpltCallback+4 b.n 0x80045b2 + 0x0800459a UART1_RxCpltCallback+6 ldr r3, [pc, #44] ; (0x80045c8 ) + 0x0800459c UART1_RxCpltCallback+8 ldrb r3, [r3, #0] + 0x0800459e UART1_RxCpltCallback+10 add.w r3, r3, r3, lsl #7 +### Breakpoints ##################################################################################################### +[1] break at 0x08004596 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x0000008b r10 0x00000000 pc 0x08004596 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x8100001f basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x08004595 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x40020058 r9 0x00000000 lr 0x080036d1 psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 for (int ind = 0; ind < 24; ind++) + 36 { + 37 PDEBUG("[%d]: 0x%02x\n", sbuffer[active_buffer][ind]); + 38 } + 39 HAL_UART_Receive_DMA(_serial_huart_inst, rxb, MAX_MESSAGE_LEN); + 40 } + 41 + 42 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 43 { + 44 _serial_huart_inst = huart; +### Stack ########################################################################################################### +[0] from 0x08004596 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x080036d0 in UART_DMAReceiveCplt+110 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3907 +[2] from 0x08003420 in HAL_DMA_IRQHandler+132 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c:855 +[3] from 0x08001564 in DMA1_Channel5_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x0800152a in main+130 at Core/Src/main.c:139 +### Threads ######################################################################################################### +[1] id 0 from 0x08004596 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +loc ind = 0 +##################################################################################################################### +No symbol "q" in current context. +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 for (int ind = 0; ind < 24; ind++) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004594 UART1_RxCpltCallback+0 push {r4, lr} + 0x08004596 UART1_RxCpltCallback+2 movs r4, #0 + 0x08004598 UART1_RxCpltCallback+4 b.n 0x80045b2 + 0x0800459a UART1_RxCpltCallback+6 ldr r3, [pc, #44] ; (0x80045c8 ) + 0x0800459c UART1_RxCpltCallback+8 ldrb r3, [r3, #0] + 0x0800459e UART1_RxCpltCallback+10 add.w r3, r3, r3, lsl #7 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x0000008b r10 0x00000000 pc 0x08004596 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x8100001f basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x08004595 r8 0x00000000 sp 0x2000ff60 msp 0x2000ff60 control 0x00 + r4 0x40020058 r9 0x00000000 lr 0x080036d1 psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { + 35 for (int ind = 0; ind < 24; ind++) + 36 { + 37 PDEBUG("[%d]: 0x%02x\n", sbuffer[active_buffer][ind]); + 38 } + 39 active_buffer = (active_buffer + 1) % active_buffer; + 40 HAL_UART_Receive_DMA(_serial_huart_inst, sbuffer[active_buffer], MAX_MESSAGE_LEN); + 41 } + 42 + 43 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 44 { +### Stack ########################################################################################################### +[0] from 0x08004596 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x080036d0 in UART_DMAReceiveCplt+110 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3907 +[2] from 0x08003420 in HAL_DMA_IRQHandler+132 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c:855 +[3] from 0x08001564 in DMA1_Channel5_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x0800152a in main+130 at Core/Src/main.c:139 +### Threads ######################################################################################################### +[1] id 0 from 0x08004596 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +loc ind = 0 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x99f0 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009bb0 +Loading section .ARM, size 0x8 lma 0x800a030 +Loading section .init_array, size 0x8 lma 0x800a038 +Loading section .fini_array, size 0x8 lma 0x800a040 +Loading section .data, size 0x9a8 lma 0x800a048 +Start address 0x08004648, load size 43456 +Transfer rate: 29 KB/sec, 4828 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] +main () at Core/Src/main.c:141 +141 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x08001516 main+110 mov r0, r4 + 0x08001518 main+112 bl 0x80042fc + 0x0800151c main+116 ldr r0, [pc, #32] ; (0x8001540 ) + 0x0800151e main+118 bl 0x80019b8 + 0x08001522 main+122 bl 0x8004608 + 0x08001526 main+126 bl 0x8004604 + 0x0800152a main+130 b.n 0x8001526 + 0x0800152c main+132 lsrs r4, r3, #13 + 0x0800152e main+134 movs r0, #0 + 0x08001530 main+136 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08001526 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } + 149 // serial_pkt_t *pkt = NULL; + 150 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08001526 in main+126 at Core/Src/main.c:141 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x99f8 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009bb8 +Loading section .ARM, size 0x8 lma 0x800a038 +Loading section .init_array, size 0x8 lma 0x800a040 +Loading section .fini_array, size 0x8 lma 0x800a048 +Loading section .data, size 0x9a8 lma 0x800a050 +Start address 0x0800464c, load size 43464 +Transfer rate: 29 KB/sec, 4829 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] +main () at Core/Src/main.c:141 +141 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x08001516 main+110 mov r0, r4 + 0x08001518 main+112 bl 0x80042fc + 0x0800151c main+116 ldr r0, [pc, #32] ; (0x8001540 ) + 0x0800151e main+118 bl 0x80019b8 + 0x08001522 main+122 bl 0x800460c + 0x08001526 main+126 bl 0x8004608 + 0x0800152a main+130 b.n 0x8001526 + 0x0800152c main+132 lsrs r4, r3, #13 + 0x0800152e main+134 movs r0, #0 + 0x08001530 main+136 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08001526 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x40001000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } + 149 // serial_pkt_t *pkt = NULL; + 150 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08001526 in main+126 at Core/Src/main.c:141 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9a10 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009bd0 +Loading section .ARM, size 0x8 lma 0x800a050 +Loading section .init_array, size 0x8 lma 0x800a058 +Loading section .fini_array, size 0x8 lma 0x800a060 +Loading section .data, size 0x9a8 lma 0x800a068 +Start address 0x08004668, load size 43488 +Transfer rate: 29 KB/sec, 4832 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] +main () at Core/Src/main.c:139 +139 while (1) +### Assembly ######################################################################################################## + 0x08001518 main+112 bl 0x80042fc + 0x0800151c main+116 ldr r0, [pc, #32] ; (0x8001540 ) + 0x0800151e main+118 bl 0x80019b8 + 0x08001522 main+122 bl 0x8004628 + 0x08001526 main+126 bl 0x80045b4 + 0x0800152a main+130 b.n 0x8001526 + 0x0800152c main+132 lsrs r4, r3, #13 + 0x0800152e main+134 movs r0, #0 + 0x08001530 main+136 asrs r1, r5, #5 + 0x08001532 main+138 lsrs r0, r0, #32 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x0800152a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 129 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 130 HAL_TIM_Base_Start_IT(&htim6); + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } +### Stack ########################################################################################################### +[0] from 0x0800152a in main+130 at Core/Src/main.c:139 +### Threads ######################################################################################################### +[1] id 0 from 0x0800152a in main+130 at Core/Src/main.c:139 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9a18 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009bd8 +Loading section .ARM, size 0x8 lma 0x800a058 +Loading section .init_array, size 0x8 lma 0x800a060 +Loading section .fini_array, size 0x8 lma 0x800a068 +Loading section .data, size 0x9a8 lma 0x800a070 +Start address 0x08004670, load size 43496 +Transfer rate: 29 KB/sec, 4832 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] +main () at Core/Src/main.c:141 +141 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x08001516 main+110 mov r0, r4 + 0x08001518 main+112 bl 0x80042fc + 0x0800151c main+116 ldr r0, [pc, #32] ; (0x8001540 ) + 0x0800151e main+118 bl 0x80019b8 + 0x08001522 main+122 bl 0x8004630 + 0x08001526 main+126 bl 0x80045bc + 0x0800152a main+130 b.n 0x8001526 + 0x0800152c main+132 lsrs r4, r3, #13 + 0x0800152e main+134 movs r0, #0 + 0x08001530 main+136 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08001526 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } + 149 // serial_pkt_t *pkt = NULL; + 150 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08001526 in main+126 at Core/Src/main.c:141 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x08004670 msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9a18 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009bd8 +Loading section .ARM, size 0x8 lma 0x800a058 +Loading section .init_array, size 0x8 lma 0x800a060 +Loading section .fini_array, size 0x8 lma 0x800a068 +Loading section .data, size 0x9a8 lma 0x800a070 +Start address 0x08004670, load size 43496 +Transfer rate: 29 KB/sec, 4832 bytes/write. +Breakpoint 1 at 0x8004594: file shared/drivers/p_serial_mgr.c, line 35. +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, UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 if (sstate == SS_IDLE) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ +!0x08004594 UART1_RxCpltCallback+0 ldr r3, [pc, #12] ; (0x80045a4 ) + 0x08004596 UART1_RxCpltCallback+2 ldrb r3, [r3, #0] + 0x08004598 UART1_RxCpltCallback+4 cbnz r3, 0x80045a0 + 0x0800459a UART1_RxCpltCallback+6 ldr r3, [pc, #8] ; (0x80045a4 ) + 0x0800459c UART1_RxCpltCallback+8 movs r2, #1 +### Breakpoints ##################################################################################################### +[1] break at 0x08004594 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x0000008b r10 0x00000000 pc 0x08004594 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x8100001f basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x08004595 r8 0x00000000 sp 0x2000ff68 msp 0x2000ff68 control 0x00 + r4 0x40020058 r9 0x00000000 lr 0x080036d1 psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 if (sstate == SS_IDLE) + 36 { + 37 sstate = SS_START; + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; +### Stack ########################################################################################################### +[0] from 0x08004594 in UART1_RxCpltCallback+0 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x080036d0 in UART_DMAReceiveCplt+110 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3907 +[2] from 0x08003420 in HAL_DMA_IRQHandler+132 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c:855 +[3] from 0x08001564 in DMA1_Channel5_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x080045c2 in p_serial_mgr_service+6 at shared/drivers/p_serial_mgr.c:48 +[6] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004594 in UART1_RxCpltCallback+0 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$1 = {[0x0] = 0x0, [0x1] = 0x2, [0x2] = 0x9, [0x3] = 0x1, [0x4] = 0x47, [0x5] = 0x5, [0x6] = 0x0, [0x7] = 0x0, [0x8] = 0x0, [0x9] = 0x0, [0xa] = 0x0, [0xb] = 0x0, [0xc] = 0xb2, [0xd] = 0x2, [0xe] = 0x9, [0xf] = 0x1, [0x10] = 0xe0, [0x11] = 0xb, [0x12] = 0x0, [0x13] = 0x0, [0x14] = 0x0, [0x15] = 0x0, [0x16] = 0x0, [0x17] = 0x0} +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Program received signal SIGINT, Interrupt. +0x080045c0 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +48 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ + 0x080045bc p_serial_mgr_service+0 ldr r3, [pc, #92] ; (0x800461c ) + 0x080045be p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x080045c0 p_serial_mgr_service+4 cmp r3, #1 + 0x080045c2 p_serial_mgr_service+6 beq.n 0x8004614 + 0x080045c4 p_serial_mgr_service+8 bx lr + 0x080045c6 p_serial_mgr_service+10 ldr r3, [pc, #88] ; (0x8004620 ) + 0x080045c8 p_serial_mgr_service+12 ldrb r3, [r3, #0] +### Breakpoints ##################################################################################################### +[1] break at 0x08004594 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = "\000\002\t\001G\005\000\000\000\000\000\000\262\002\t\001\340\v\000\000\000\000\000" +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x080045c0 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 for (int ind = 0; ind < 24; ind++) + 51 { + 52 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 53 } + 54 active_buffer = (active_buffer + 1) % active_buffer; + 55 sstate = SS_IDLE; + 56 HAL_UART_Receive_DMA(_serial_huart_inst, sbuffer[active_buffer], MAX_MESSAGE_LEN); + 57 } +### Stack ########################################################################################################### +[0] from 0x080045c0 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x080045c0 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Note: breakpoint 1 also set at pc 0x8004594. +Breakpoint 2 at 0x8004594: file shared/drivers/p_serial_mgr.c, line 35. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Program received signal SIGINT, Interrupt. +0x080045be in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +48 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080045bc p_serial_mgr_service+0 ldr r3, [pc, #92] ; (0x800461c ) + 0x080045be p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x080045c0 p_serial_mgr_service+4 cmp r3, #1 + 0x080045c2 p_serial_mgr_service+6 beq.n 0x8004614 + 0x080045c4 p_serial_mgr_service+8 bx lr + 0x080045c6 p_serial_mgr_service+10 ldr r3, [pc, #88] ; (0x8004620 ) +### Breakpoints ##################################################################################################### +[1] break at 0x08004594 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +[2] break at 0x08004594 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = "\000\002\t\001G\005\000\000\000\000\000\000\262\002\t\001\340\v\000\000\000\000\000" +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x080045be primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 for (int ind = 0; ind < 24; ind++) + 51 { + 52 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 53 } + 54 active_buffer = (active_buffer + 1) % active_buffer; + 55 sstate = SS_IDLE; + 56 HAL_UART_Receive_DMA(_serial_huart_inst, sbuffer[active_buffer], MAX_MESSAGE_LEN); + 57 } +### Stack ########################################################################################################### +[0] from 0x080045be in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x080045be in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +0x080045be in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +48 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x080045bc p_serial_mgr_service+0 ldr r3, [pc, #92] ; (0x800461c ) + 0x080045be p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x080045c0 p_serial_mgr_service+4 cmp r3, #1 + 0x080045c2 p_serial_mgr_service+6 beq.n 0x8004614 + 0x080045c4 p_serial_mgr_service+8 bx lr + 0x080045c6 p_serial_mgr_service+10 ldr r3, [pc, #88] ; (0x8004620 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x080045be primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 for (int ind = 0; ind < 24; ind++) + 51 { + 52 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 53 } + 54 active_buffer = (active_buffer + 1) % active_buffer; + 55 sstate = SS_IDLE; + 56 HAL_UART_Receive_DMA(_serial_huart_inst, sbuffer[active_buffer], MAX_MESSAGE_LEN); + 57 } +### Stack ########################################################################################################### +[0] from 0x080045be in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x080045be in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9a18 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009bd8 +Loading section .ARM, size 0x8 lma 0x800a058 +Loading section .init_array, size 0x8 lma 0x800a060 +Loading section .fini_array, size 0x8 lma 0x800a068 +Loading section .data, size 0x9a8 lma 0x800a070 +Start address 0x08004670, load size 43496 +Transfer rate: 29 KB/sec, 4832 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] +main () at Core/Src/main.c:141 +141 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x08001516 main+110 mov r0, r4 + 0x08001518 main+112 bl 0x80042fc + 0x0800151c main+116 ldr r0, [pc, #32] ; (0x8001540 ) + 0x0800151e main+118 bl 0x80019b8 + 0x08001522 main+122 bl 0x8004630 + 0x08001526 main+126 bl 0x80045bc + 0x0800152a main+130 b.n 0x8001526 + 0x0800152c main+132 lsrs r4, r3, #13 + 0x0800152e main+134 movs r0, #0 + 0x08001530 main+136 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08001526 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } + 149 // serial_pkt_t *pkt = NULL; + 150 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x08001526 in main+126 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08001526 in main+126 at Core/Src/main.c:141 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x08004670 msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x9a18 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009bd8 +Loading section .ARM, size 0x8 lma 0x800a058 +Loading section .init_array, size 0x8 lma 0x800a060 +Loading section .fini_array, size 0x8 lma 0x800a068 +Loading section .data, size 0x9a8 lma 0x800a070 +Start address 0x08004670, load size 43496 +Transfer rate: 29 KB/sec, 4832 bytes/write. +Breakpoint 1 at 0x8004594: file shared/drivers/p_serial_mgr.c, line 35. +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, UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 if (sstate == SS_IDLE) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ +!0x08004594 UART1_RxCpltCallback+0 ldr r3, [pc, #12] ; (0x80045a4 ) + 0x08004596 UART1_RxCpltCallback+2 ldrb r3, [r3, #0] + 0x08004598 UART1_RxCpltCallback+4 cbnz r3, 0x80045a0 + 0x0800459a UART1_RxCpltCallback+6 ldr r3, [pc, #8] ; (0x80045a4 ) + 0x0800459c UART1_RxCpltCallback+8 movs r2, #1 +### Breakpoints ##################################################################################################### +[1] break at 0x08004594 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x0000008b r10 0x00000000 pc 0x08004594 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x8100001f basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x08004595 r8 0x00000000 sp 0x2000ff68 msp 0x2000ff68 control 0x00 + r4 0x40020058 r9 0x00000000 lr 0x080036d1 psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 if (sstate == SS_IDLE) + 36 { + 37 sstate = SS_START; + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; +### Stack ########################################################################################################### +[0] from 0x08004594 in UART1_RxCpltCallback+0 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x080036d0 in UART_DMAReceiveCplt+110 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3907 +[2] from 0x08003420 in HAL_DMA_IRQHandler+132 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c:855 +[3] from 0x08001564 in DMA1_Channel5_IRQHandler+8 at Core/Src/stm32l4xx_it.c:211 +[4] from 0xffffffe9 +[5] from 0x080045be in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +[6] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004594 in UART1_RxCpltCallback+0 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$1 = {[0x0] = 0x0, [0x1] = 0x2, [0x2] = 0x9, [0x3] = 0x1, [0x4] = 0x83, [0x5] = 0xe, [0x6] = 0x0, [0x7] = 0x0, [0x8] = 0x61, [0x9] = 0x3b, [0xa] = 0x0, [0xb] = 0x0, [0xc] = 0xd1, [0xd] = 0x2, [0xe] = 0x9, [0xf] = 0x1, [0x10] = 0xcb, [0x11] = 0x13, [0x12] = 0x0, [0x13] = 0x0, [0x14] = 0x61, [0x15] = 0x3b, [0x16] = 0x0, [0x17] = 0x0} +Continuing. +### Output/messages ################################################################################################# +halted: PC: 0x08004596 + +Program received signal SIGINT, Interrupt. +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +48 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ + 0x080045bc p_serial_mgr_service+0 ldr r3, [pc, #92] ; (0x800461c ) + 0x080045be p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x080045c0 p_serial_mgr_service+4 cmp r3, #1 + 0x080045c2 p_serial_mgr_service+6 beq.n 0x8004614 + 0x080045c4 p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +[1] break at 0x08004594 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = "\000\002\t\001\203\016\000\000a;\000\000\321\002\t\001\313\023\000\000a;\000" +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x080045bc primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 for (int ind = 0; ind < 24; ind++) + 51 { + 52 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 53 } + 54 active_buffer = (active_buffer + 1) % active_buffer; + 55 sstate = SS_IDLE; + 56 HAL_UART_Receive_DMA(_serial_huart_inst, sbuffer[active_buffer], MAX_MESSAGE_LEN); + 57 } +### Stack ########################################################################################################### +[0] from 0x080045bc in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x080045bc in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +0x080045bc in memset () +### Assembly ######################################################################################################## + 0x080045bc ? ldr r3, [pc, #92] ; (0x800461c ) + 0x080045be ? ldrb r3, [r3, #0] + 0x080045c0 ? cmp r3, #1 + 0x080045c2 ? beq.n 0x8004614 + 0x080045c4 ? bx lr + 0x080045c6 ? ldr r3, [pc, #88] ; (0x8004620 ) + 0x080045c8 ? ldrb r3, [r3, #0] + 0x080045ca ? add.w r3, r3, r3, lsl #7 + 0x080045ce ? lsls r2, r3, #2 + 0x080045d0 ? ldr r3, [pc, #80] ; (0x8004624 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x080045bc primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0x00000010 fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## +### Stack ########################################################################################################### +[0] from 0x080045bc in memset +[1] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x080045bc in memset +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x98a8 lma 0x80001c0 +Loading section .rodata, size 0x480 lma 0x8009a68 +Loading section .ARM, size 0x8 lma 0x8009ee8 +Loading section .init_array, size 0x8 lma 0x8009ef0 +Loading section .fini_array, size 0x8 lma 0x8009ef8 +Loading section .data, size 0x9a8 lma 0x8009f00 +Start address 0x08004500, load size 43128 +Transfer rate: 29 KB/sec, 4792 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] +0x08004436 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +48 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004434 p_serial_mgr_service+0 ldr r3, [pc, #116] ; (0x80044ac ) + 0x08004436 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004438 p_serial_mgr_service+4 cmp r3, #1 + 0x0800443a p_serial_mgr_service+6 beq.n 0x800443e + 0x0800443c p_serial_mgr_service+8 bx lr + 0x0800443e p_serial_mgr_service+10 push {r4, lr} +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08004436 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 51 for (int ind = 0; ind < 24; ind++) + 52 { + 53 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 54 } + 55 PDEBUG("\n\n"); + 56 sstate = SS_IDLE; + 57 active_buffer = (active_buffer + 1) % active_buffer; +### Stack ########################################################################################################### +[0] from 0x08004436 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004436 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x98b8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009a78 +Loading section .ARM, size 0x8 lma 0x8009f00 +Loading section .init_array, size 0x8 lma 0x8009f08 +Loading section .fini_array, size 0x8 lma 0x8009f10 +Loading section .data, size 0x9a8 lma 0x8009f18 +Start address 0x0800450c, load size 43152 +Transfer rate: 29 KB/sec, 4794 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] +0x08004438 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +48 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ + 0x08004434 p_serial_mgr_service+0 ldr r3, [pc, #124] ; (0x80044b4 ) + 0x08004436 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004438 p_serial_mgr_service+4 cmp r3, #1 + 0x0800443a p_serial_mgr_service+6 beq.n 0x800443e + 0x0800443c p_serial_mgr_service+8 bx lr + 0x0800443e p_serial_mgr_service+10 push {r4, lr} + 0x08004440 p_serial_mgr_service+12 ldr r3, [pc, #116] ; (0x80044b8 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08004438 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 51 for (int ind = 0; ind < 24; ind++) + 52 { + 53 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 54 } + 55 PDEBUG("\n\n"); + 56 sstate = SS_IDLE; + 57 active_buffer = (active_buffer + 1) % active_buffer; +### Stack ########################################################################################################### +[0] from 0x08004438 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x0800152a in main+130 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004438 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x98b8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009a78 +Loading section .ARM, size 0x8 lma 0x8009f00 +Loading section .init_array, size 0x8 lma 0x8009f08 +Loading section .fini_array, size 0x8 lma 0x8009f10 +Loading section .data, size 0x9a8 lma 0x8009f18 +Start address 0x0800450c, load size 43152 +Transfer rate: 29 KB/sec, 4794 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] +0x08004436 in __chk_fail () +### Assembly ######################################################################################################## + 0x08004436 ? ldrb r3, [r3, #0] + 0x08004438 ? cmp r3, #1 + 0x0800443a ? beq.n 0x800443e <__chk_fail+38> + 0x0800443c ? bx lr + 0x0800443e ? push {r4, lr} + 0x08004440 ? ldr r3, [pc, #116] ; (0x80044b8 <_kill_r+4>) + 0x08004442 ? ldrb r3, [r3, #0] + 0x08004444 ? add.w r3, r3, r3, lsl #7 + 0x08004448 ? lsls r1, r3, #2 + 0x0800444a ? adds r1, #1 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a10 r10 0x00000000 pc 0x08004436 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x0800152b psp 0x00000000 +### Source ########################################################################################################## +### Stack ########################################################################################################### +[0] from 0x08004436 in __chk_fail +[1] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[2] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[3] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[4] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[5] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[6] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[7] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[8] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[9] from 0x0800152a in HAL_MspInit+22 at Core/Src/stm32l4xx_hal_msp.c:72 +[+] +### Threads ######################################################################################################### +[1] id 0 from 0x08004436 in __chk_fail +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95b0 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009770 +Loading section .ARM, size 0x8 lma 0x8009bf8 +Loading section .init_array, size 0x8 lma 0x8009c00 +Loading section .fini_array, size 0x8 lma 0x8009c08 +Loading section .data, size 0x9a8 lma 0x8009c10 +Start address 0x08004204, load size 42376 +Transfer rate: 29 KB/sec, 4708 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] +0x0800413a in p_serial_mgr_init (huart=0x0) at shared/drivers/p_serial_mgr.c:45 +45 } +### Assembly ######################################################################################################## + 0x08004130 p_serial_mgr_init+8 lsrs r0, r4, #16 + 0x08004132 p_serial_mgr_init+10 movs r0, #0 + 0x08004134 p_serial_mgr_init+12 asrs r1, r2 + 0x08004136 p_serial_mgr_init+14 lsrs r0, r0, #32 + 0x08004138 p_serial_mgr_init+16 ldr r3, [pc, #124] ; (0x80041b8 ) + 0x0800413a p_serial_mgr_init+18 ldrb r3, [r3, #0] +~ +~ +~ +~ +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x0800413a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014a9 psp 0x00000000 +### Source ########################################################################################################## + 35 if (sstate == SS_IDLE) + 36 { + 37 sstate = SS_START; + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 51 for (int ind = 0; ind < 24; ind++) + 52 { + 53 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 54 } +### Stack ########################################################################################################### +[0] from 0x0800413a in p_serial_mgr_init+18 at shared/drivers/p_serial_mgr.c:45 +[1] from 0x080014a8 in main+92 at Core/Src/main.c:132 +### Threads ######################################################################################################### +[1] id 0 from 0x0800413a in p_serial_mgr_init+18 at shared/drivers/p_serial_mgr.c:45 +### Variables ####################################################################################################### +arg huart = 0x0: {Instance = 0x20010000,Init = {BaudRate = 134234629,WordLength = 134223037,StopBits = … +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95b0 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009770 +Loading section .ARM, size 0x8 lma 0x8009bf8 +Loading section .init_array, size 0x8 lma 0x8009c00 +Loading section .fini_array, size 0x8 lma 0x8009c08 +Loading section .data, size 0x9a8 lma 0x8009c10 +Start address 0x08004208, load size 42376 +Transfer rate: 29 KB/sec, 4708 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] +0x0800413e in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:48 +48 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x0800413c p_serial_mgr_service+0 ldr r3, [pc, #124] ; (0x80041bc ) + 0x0800413e p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004140 p_serial_mgr_service+4 cmp r3, #1 + 0x08004142 p_serial_mgr_service+6 beq.n 0x8004146 + 0x08004144 p_serial_mgr_service+8 bx lr + 0x08004146 p_serial_mgr_service+10 push {r4, lr} +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x0800413e primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 38 } + 39 } + 40 + 41 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 42 { + 43 _serial_huart_inst = huart; + 44 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 45 } + 46 void p_serial_mgr_service(void) + 47 { + 48 if (sstate == SS_START) + 49 { + 50 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 51 for (int ind = 0; ind < 24; ind++) + 52 { + 53 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 54 } + 55 PDEBUG("\n\n"); + 56 sstate = SS_IDLE; + 57 active_buffer = (active_buffer + 1) % active_buffer; +### Stack ########################################################################################################### +[0] from 0x0800413e in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +[1] from 0x080014ac in main+96 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x0800413e in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:48 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95b0 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009770 +Loading section .ARM, size 0x8 lma 0x8009bf8 +Loading section .init_array, size 0x8 lma 0x8009c00 +Loading section .fini_array, size 0x8 lma 0x8009c08 +Loading section .data, size 0x9a8 lma 0x8009c10 +Start address 0x08004208, load size 42376 +Transfer rate: 29 KB/sec, 4708 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] +main () at Core/Src/main.c:139 +139 while (1) +### Assembly ######################################################################################################## + 0x0800149c main+80 ldr r1, [pc, #28] ; (0x80014bc ) + 0x0800149e main+82 mov r0, r4 + 0x080014a0 main+84 bl 0x8003f88 + 0x080014a4 main+88 bl 0x80041d4 + 0x080014a8 main+92 bl 0x800413c + 0x080014ac main+96 b.n 0x80014a8 + 0x080014ae main+98 nop + 0x080014b0 main+100 lsrs r4, r3, #13 + 0x080014b2 main+102 movs r0, #0 + 0x080014b4 main+104 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x080014ac primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 129 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 130 // HAL_TIM_Base_Start_IT(&htim6); + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } +### Stack ########################################################################################################### +[0] from 0x080014ac in main+96 at Core/Src/main.c:139 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ac in main+96 at Core/Src/main.c:139 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95b0 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009770 +Loading section .ARM, size 0x8 lma 0x8009bf8 +Loading section .init_array, size 0x8 lma 0x8009c00 +Loading section .fini_array, size 0x8 lma 0x8009c08 +Loading section .data, size 0x9a8 lma 0x8009c10 +Start address 0x08004208, load size 42376 +Transfer rate: 29 KB/sec, 4708 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] +main () at Core/Src/main.c:141 +141 p_serial_mgr_service(); +### Assembly ######################################################################################################## + 0x0800149a main+78 movs r2, #1 + 0x0800149c main+80 ldr r1, [pc, #28] ; (0x80014bc ) + 0x0800149e main+82 mov r0, r4 + 0x080014a0 main+84 bl 0x8003f88 + 0x080014a4 main+88 bl 0x80041d4 + 0x080014a8 main+92 bl 0x800413c + 0x080014ac main+96 b.n 0x80014a8 + 0x080014ae main+98 nop + 0x080014b0 main+100 lsrs r4, r3, #13 + 0x080014b2 main+102 movs r0, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x080014a8 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } + 149 // serial_pkt_t *pkt = NULL; + 150 // if ((pkt = p_serial_mgr_service()) != NULL) +### Stack ########################################################################################################### +[0] from 0x080014a8 in main+92 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x080014a8 in main+92 at Core/Src/main.c:141 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95b0 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x8009770 +Loading section .ARM, size 0x8 lma 0x8009bf8 +Loading section .init_array, size 0x8 lma 0x8009c00 +Loading section .fini_array, size 0x8 lma 0x8009c08 +Loading section .data, size 0x9a8 lma 0x8009c10 +Start address 0x08004208, load size 42376 +Transfer rate: 29 KB/sec, 4708 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] +0x0800413e in UART1_RxCpltCallback (huart=0x0) at shared/drivers/p_serial_mgr.c:41 +41 HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); +### Assembly ######################################################################################################## + 0x08004134 UART1_RxCpltCallback+32 lsrs r0, r4, #16 + 0x08004136 UART1_RxCpltCallback+34 movs r0, #0 + 0x08004138 UART1_RxCpltCallback+36 asrs r5, r2 + 0x0800413a UART1_RxCpltCallback+38 lsrs r0, r0, #32 + 0x0800413c UART1_RxCpltCallback+40 ldr r3, [pc, #124] ; (0x80041bc ) + 0x0800413e UART1_RxCpltCallback+42 ldrb r3, [r3, #0] + 0x08004140 UART1_RxCpltCallback+44 cmp r3, #1 + 0x08004142 UART1_RxCpltCallback+46 beq.n 0x8004146 + 0x08004144 UART1_RxCpltCallback+48 bx lr + 0x08004146 UART1_RxCpltCallback+50 push {r4, lr} +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x0800413e primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { + 35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) + 36 { + 37 sstate = SS_START; + 38 } + 39 else + 40 { + 41 HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); + 42 } + 43 } + 44 + 45 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 46 { + 47 _serial_huart_inst = huart; + 48 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 49 } + 50 void p_serial_mgr_service(void) +### Stack ########################################################################################################### +[0] from 0x0800413e in UART1_RxCpltCallback+42 at shared/drivers/p_serial_mgr.c:41 +[1] from 0x0800423e in p_serial_mgr_start+50 at shared/drivers/p_serial_mgr.c:70 +[2] from 0x00000000 +### Threads ######################################################################################################### +[1] id 0 from 0x0800413e in UART1_RxCpltCallback+42 at shared/drivers/p_serial_mgr.c:41 +### Variables ####################################################################################################### +arg huart = 0x0: {Instance = 0x20010000,Init = {BaudRate = 134234633,WordLength = 134223041,StopBits = … +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95e8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097a8 +Loading section .ARM, size 0x8 lma 0x8009c30 +Loading section .init_array, size 0x8 lma 0x8009c38 +Loading section .fini_array, size 0x8 lma 0x8009c40 +Loading section .data, size 0x9a8 lma 0x8009c48 +Start address 0x08004240, load size 42432 +Transfer rate: 29 KB/sec, 4714 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] +main () at Core/Src/main.c:139 +139 while (1) +### Assembly ######################################################################################################## + 0x0800149c main+80 ldr r1, [pc, #28] ; (0x80014bc ) + 0x0800149e main+82 mov r0, r4 + 0x080014a0 main+84 bl 0x8003f88 + 0x080014a4 main+88 bl 0x800420c + 0x080014a8 main+92 bl 0x8004174 + 0x080014ac main+96 b.n 0x80014a8 + 0x080014ae main+98 nop + 0x080014b0 main+100 lsrs r4, r3, #13 + 0x080014b2 main+102 movs r0, #0 + 0x080014b4 main+104 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x080014ac primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 129 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 130 // HAL_TIM_Base_Start_IT(&htim6); + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } +### Stack ########################################################################################################### +[0] from 0x080014ac in main+96 at Core/Src/main.c:139 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ac in main+96 at Core/Src/main.c:139 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95f8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097b8 +Loading section .ARM, size 0x8 lma 0x8009c40 +Loading section .init_array, size 0x8 lma 0x8009c48 +Loading section .fini_array, size 0x8 lma 0x8009c50 +Loading section .data, size 0x9a8 lma 0x8009c58 +Start address 0x08004250, load size 42448 +Transfer rate: 29 KB/sec, 4716 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] +0x08004178 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:52 +52 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ + 0x08004174 p_serial_mgr_service+0 ldr r3, [pc, #136] ; (0x8004200 ) + 0x08004176 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004178 p_serial_mgr_service+4 cmp r3, #1 + 0x0800417a p_serial_mgr_service+6 beq.n 0x800417e + 0x0800417c p_serial_mgr_service+8 bx lr + 0x0800417e p_serial_mgr_service+10 push {r4, lr} + 0x08004180 p_serial_mgr_service+12 ldr r3, [pc, #128] ; (0x8004204 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x08004178 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 42 } + 43 } + 44 + 45 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 46 { + 47 _serial_huart_inst = huart; + 48 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 49 } + 50 void p_serial_mgr_service(void) + 51 { + 52 if (sstate == SS_START) + 53 { + 54 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 55 for (int ind = 0; ind < 24; ind++) + 56 { + 57 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 58 } + 59 PDEBUG("\n\n"); + 60 sstate = SS_IDLE; + 61 active_buffer = (active_buffer + 1) % NUM_BUFFERS; +### Stack ########################################################################################################### +[0] from 0x08004178 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:52 +[1] from 0x080014ac in main+96 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004178 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:52 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x08004250 msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95f8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097b8 +Loading section .ARM, size 0x8 lma 0x8009c40 +Loading section .init_array, size 0x8 lma 0x8009c48 +Loading section .fini_array, size 0x8 lma 0x8009c50 +Loading section .data, size 0x9a8 lma 0x8009c58 +Start address 0x08004250, load size 42448 +Transfer rate: 29 KB/sec, 4716 bytes/write. +Breakpoint 1 at 0x8004116: file shared/drivers/p_serial_mgr.c, line 35. +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, UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004114 UART1_RxCpltCallback+0 push {r3, lr} +!0x08004116 UART1_RxCpltCallback+2 ldr r3, [pc, #56] ; (0x8004150 ) + 0x08004118 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x0800411a UART1_RxCpltCallback+6 cbnz r3, 0x800412e + 0x0800411c UART1_RxCpltCallback+8 ldr r3, [pc, #52] ; (0x8004154 ) + 0x0800411e UART1_RxCpltCallback+10 ldrb r3, [r3, #0] +### Breakpoints ##################################################################################################### +[1] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x00004001 r10 0x00000000 pc 0x08004116 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x08004115 r8 0x00000000 sp 0x2000ff50 msp 0x2000ff50 control 0x00 + r4 0x20000aa8 r9 0x00000000 lr 0x0800338b psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) + 36 { + 37 sstate = SS_START; + 38 } + 39 else + 40 { + 41 HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); + 42 } + 43 } + 44 +### Stack ########################################################################################################### +[0] from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x0800338a in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x080034dc in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x080014f0 in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:226 +[4] from 0xffffffe9 +[5] from 0x08003f4a in UART_Start_Receive_IT+154 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3685 +[6] from 0x08003fcc in HAL_UART_Receive_IT+68 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1440 +[7] from 0x0800423c in p_serial_mgr_start+32 at shared/drivers/p_serial_mgr.c:69 +[8] from 0x080014a8 in main+92 at Core/Src/main.c:132 +### Threads ######################################################################################################### +[1] id 0 from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +Quit +Quit +Undefined command: "qq". Try "help". +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004114 UART1_RxCpltCallback+0 push {r3, lr} + 0x08004116 UART1_RxCpltCallback+2 ldr r3, [pc, #56] ; (0x8004150 ) + 0x08004118 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x0800411a UART1_RxCpltCallback+6 cbnz r3, 0x800412e + 0x0800411c UART1_RxCpltCallback+8 ldr r3, [pc, #52] ; (0x8004154 ) + 0x0800411e UART1_RxCpltCallback+10 ldrb r3, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x00004001 r10 0x00000000 pc 0x08004116 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x08004115 r8 0x00000000 sp 0x2000ff50 msp 0x2000ff50 control 0x00 + r4 0x20000aa8 r9 0x00000000 lr 0x0800338b psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { + 35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) + 36 { + 37 sstate = SS_START; + 38 } + 39 else + 40 { + 41 HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); + 42 } + 43 } + 44 +### Stack ########################################################################################################### +[0] from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x0800338a in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x080034dc in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x080014f0 in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:226 +[4] from 0xffffffe9 +[5] from 0x08003f4a in UART_Start_Receive_IT+154 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3685 +[6] from 0x08003fcc in HAL_UART_Receive_IT+68 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1440 +[7] from 0x0800423c in p_serial_mgr_start+32 at shared/drivers/p_serial_mgr.c:69 +[8] from 0x080014a8 in main+92 at Core/Src/main.c:132 +### Threads ######################################################################################################### +[1] id 0 from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95f8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097b8 +Loading section .ARM, size 0x8 lma 0x8009c40 +Loading section .init_array, size 0x8 lma 0x8009c48 +Loading section .fini_array, size 0x8 lma 0x8009c50 +Loading section .data, size 0x9a8 lma 0x8009c58 +Start address 0x08004250, load size 42448 +Transfer rate: 29 KB/sec, 4716 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] +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:52 +52 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ + 0x08004174 p_serial_mgr_service+0 ldr r3, [pc, #136] ; (0x8004200 ) + 0x08004176 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004178 p_serial_mgr_service+4 cmp r3, #1 + 0x0800417a p_serial_mgr_service+6 beq.n 0x800417e + 0x0800417c p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x08004174 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 42 } + 43 } + 44 + 45 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 46 { + 47 _serial_huart_inst = huart; + 48 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 49 } + 50 void p_serial_mgr_service(void) + 51 { + 52 if (sstate == SS_START) + 53 { + 54 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 55 for (int ind = 0; ind < 24; ind++) + 56 { + 57 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 58 } + 59 PDEBUG("\n\n"); + 60 sstate = SS_IDLE; + 61 active_buffer = (active_buffer + 1) % NUM_BUFFERS; +### Stack ########################################################################################################### +[0] from 0x08004174 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:52 +[1] from 0x080014ac in main+96 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004174 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:52 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95f8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097b8 +Loading section .ARM, size 0x8 lma 0x8009c40 +Loading section .init_array, size 0x8 lma 0x8009c48 +Loading section .fini_array, size 0x8 lma 0x8009c50 +Loading section .data, size 0x9a8 lma 0x8009c58 +Start address 0x08004250, load size 42448 +Transfer rate: 29 KB/sec, 4716 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] +0x08004176 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:52 +52 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004174 p_serial_mgr_service+0 ldr r3, [pc, #136] ; (0x8004200 ) + 0x08004176 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004178 p_serial_mgr_service+4 cmp r3, #1 + 0x0800417a p_serial_mgr_service+6 beq.n 0x800417e + 0x0800417c p_serial_mgr_service+8 bx lr + 0x0800417e p_serial_mgr_service+10 push {r4, lr} +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x08004176 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x20002050 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 42 } + 43 } + 44 + 45 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 46 { + 47 _serial_huart_inst = huart; + 48 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 49 } + 50 void p_serial_mgr_service(void) + 51 { + 52 if (sstate == SS_START) + 53 { + 54 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 55 for (int ind = 0; ind < 24; ind++) + 56 { + 57 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 58 } + 59 PDEBUG("\n\n"); + 60 sstate = SS_IDLE; + 61 active_buffer = (active_buffer + 1) % NUM_BUFFERS; +### Stack ########################################################################################################### +[0] from 0x08004176 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:52 +[1] from 0x080014ac in main+96 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004176 in p_serial_mgr_service+2 at shared/drivers/p_serial_mgr.c:52 +### Variables ####################################################################################################### +##################################################################################################################### +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: 0x08004250 msp: 0x20010000 +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95f8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097b8 +Loading section .ARM, size 0x8 lma 0x8009c40 +Loading section .init_array, size 0x8 lma 0x8009c48 +Loading section .fini_array, size 0x8 lma 0x8009c50 +Loading section .data, size 0x9a8 lma 0x8009c58 +Start address 0x08004250, load size 42448 +Transfer rate: 29 KB/sec, 4716 bytes/write. +Breakpoint 1 at 0x8004116: file shared/drivers/p_serial_mgr.c, line 35. +Note: automatically using hardware breakpoints for read-only addresses. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Program received signal SIGINT, Interrupt. +0x08004178 in p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:52 +52 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ + 0x08004174 p_serial_mgr_service+0 ldr r3, [pc, #136] ; (0x8004200 ) + 0x08004176 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004178 p_serial_mgr_service+4 cmp r3, #1 + 0x0800417a p_serial_mgr_service+6 beq.n 0x800417e + 0x0800417c p_serial_mgr_service+8 bx lr + 0x0800417e p_serial_mgr_service+10 push {r4, lr} + 0x08004180 p_serial_mgr_service+12 ldr r3, [pc, #128] ; (0x8004204 ) +### Breakpoints ##################################################################################################### +[1] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x08004178 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 42 } + 43 } + 44 + 45 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 46 { + 47 _serial_huart_inst = huart; + 48 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 49 } + 50 void p_serial_mgr_service(void) + 51 { + 52 if (sstate == SS_START) + 53 { + 54 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 55 for (int ind = 0; ind < 24; ind++) + 56 { + 57 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 58 } + 59 PDEBUG("\n\n"); + 60 sstate = SS_IDLE; + 61 active_buffer = (active_buffer + 1) % NUM_BUFFERS; +### Stack ########################################################################################################### +[0] from 0x08004178 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:52 +[1] from 0x080014ac in main+96 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004178 in p_serial_mgr_service+4 at shared/drivers/p_serial_mgr.c:52 +### Variables ####################################################################################################### +##################################################################################################################### +$1 = SS_IDLE +Continuing. +### Output/messages ################################################################################################# + +Program received signal SIGINT, Interrupt. +main () at Core/Src/main.c:139 +139 while (1) +### Assembly ######################################################################################################## + 0x0800149c main+80 ldr r1, [pc, #28] ; (0x80014bc ) + 0x0800149e main+82 mov r0, r4 + 0x080014a0 main+84 bl 0x8003f88 + 0x080014a4 main+88 bl 0x800421c + 0x080014a8 main+92 bl 0x8004174 + 0x080014ac main+96 b.n 0x80014a8 + 0x080014ae main+98 nop + 0x080014b0 main+100 lsrs r4, r3, #13 + 0x080014b2 main+102 movs r0, #0 + 0x080014b4 main+104 asrs r1, r5, #5 +### Breakpoints ##################################################################################################### +[1] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x080014ac primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 129 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 130 // HAL_TIM_Base_Start_IT(&htim6); + 131 + 132 p_serial_mgr_start(); + 133 + 134 uint16_t motor_degrees = 0; + 135 /* USER CODE END 2 */ + 136 + 137 /* Infinite loop */ + 138 /* USER CODE BEGIN WHILE */ + 139 while (1) + 140 { + 141 p_serial_mgr_service(); + 142 // if (b_timer_struck) + 143 // { + 144 // // PDEBUG("%d\n", sys_time); + 145 // b_timer_struck = false; + 146 // motor_degrees = (motor_degrees + 1) % 360; + 147 // mc_service(motor_degrees, 50); + 148 // } +### Stack ########################################################################################################### +[0] from 0x080014ac in main+96 at Core/Src/main.c:139 +### Threads ######################################################################################################### +[1] id 0 from 0x080014ac in main+96 at Core/Src/main.c:139 +### Variables ####################################################################################################### +##################################################################################################################### +Note: breakpoint 1 also set at pc 0x8004116. +Breakpoint 2 at 0x8004116: file shared/drivers/p_serial_mgr.c, line 35. +Continuing. +### Output/messages ################################################################################################# + +Program received signal SIGINT, Interrupt. +p_serial_mgr_service () at shared/drivers/p_serial_mgr.c:52 +52 if (sstate == SS_START) +### Assembly ######################################################################################################## +~ +~ +~ +~ +~ + 0x08004174 p_serial_mgr_service+0 ldr r3, [pc, #136] ; (0x8004200 ) + 0x08004176 p_serial_mgr_service+2 ldrb r3, [r3, #0] + 0x08004178 p_serial_mgr_service+4 cmp r3, #1 + 0x0800417a p_serial_mgr_service+6 beq.n 0x800417e + 0x0800417c p_serial_mgr_service+8 bx lr +### Breakpoints ##################################################################################################### +[1] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +[2] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x08004174 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000000 basepri 0x00 + r2 0x40013800 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000b5c r9 0x00000000 lr 0x080014ad psp 0x00000000 +### Source ########################################################################################################## + 42 } + 43 } + 44 + 45 void p_serial_mgr_init(UART_HandleTypeDef *huart) + 46 { + 47 _serial_huart_inst = huart; + 48 _serial_huart_inst->RxCpltCallback = UART1_RxCpltCallback; + 49 } + 50 void p_serial_mgr_service(void) + 51 { + 52 if (sstate == SS_START) + 53 { + 54 HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + 55 for (int ind = 0; ind < 24; ind++) + 56 { + 57 PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + 58 } + 59 PDEBUG("\n\n"); + 60 sstate = SS_IDLE; + 61 active_buffer = (active_buffer + 1) % NUM_BUFFERS; +### Stack ########################################################################################################### +[0] from 0x08004174 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:52 +[1] from 0x080014ac in main+96 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004174 in p_serial_mgr_service+0 at shared/drivers/p_serial_mgr.c:52 +### Variables ####################################################################################################### +##################################################################################################################### +`/storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf' has changed; re-reading symbols. +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95f8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097b8 +Loading section .ARM, size 0x8 lma 0x8009c40 +Loading section .init_array, size 0x8 lma 0x8009c48 +Loading section .fini_array, size 0x8 lma 0x8009c50 +Loading section .data, size 0x9a8 lma 0x8009c58 +Start address 0x08004250, load size 42448 +Transfer rate: 29 KB/sec, 4716 bytes/write. +Starting program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf +### Output/messages ################################################################################################# + +Breakpoint 1, UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004114 UART1_RxCpltCallback+0 push {r3, lr} +!0x08004116 UART1_RxCpltCallback+2 ldr r3, [pc, #56] ; (0x8004150 ) + 0x08004118 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x0800411a UART1_RxCpltCallback+6 cbnz r3, 0x800412e + 0x0800411c UART1_RxCpltCallback+8 ldr r3, [pc, #52] ; (0x8004154 ) + 0x0800411e UART1_RxCpltCallback+10 ldrb r3, [r3, #0] +### Breakpoints ##################################################################################################### +[1] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +[2] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 1 time +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$0 = SS_IDLE +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x00004001 r10 0x00000000 pc 0x08004116 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x08004115 r8 0x00000000 sp 0x2000ff50 msp 0x2000ff50 control 0x00 + r4 0x20000aa8 r9 0x00000000 lr 0x0800338b psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) + 36 { + 37 sstate = SS_START; + 38 } + 39 else + 40 { + 41 HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); + 42 } + 43 } + 44 +### Stack ########################################################################################################### +[0] from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x0800338a in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x080034dc in HAL_UART_IRQHandler+108 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2347 +[3] from 0x080014f0 in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:226 +[4] from 0xffffffe9 +[5] from 0x08003f4a in UART_Start_Receive_IT+154 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3685 +[6] from 0x08003fcc in HAL_UART_Receive_IT+68 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1440 +[7] from 0x0800423c in p_serial_mgr_start+32 at shared/drivers/p_serial_mgr.c:69 +[8] from 0x080014a8 in main+92 at Core/Src/main.c:132 +### Threads ######################################################################################################### +[1] id 0 from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$2 = 0 '\000' +Continuing. +### Output/messages ################################################################################################# +halted: PC: 0x08004118 + +Breakpoint 1, UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004114 UART1_RxCpltCallback+0 push {r3, lr} +!0x08004116 UART1_RxCpltCallback+2 ldr r3, [pc, #56] ; (0x8004150 ) + 0x08004118 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x0800411a UART1_RxCpltCallback+6 cbnz r3, 0x800412e + 0x0800411c UART1_RxCpltCallback+8 ldr r3, [pc, #52] ; (0x8004154 ) + 0x0800411e UART1_RxCpltCallback+10 ldrb r3, [r3, #0] +### Breakpoints ##################################################################################################### +[1] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 2 times +[2] break at 0x08004116 in shared/drivers/p_serial_mgr.c:35 for p_serial_mgr.c:35 hit 2 times +### Expressions ##################################################################################################### +### History ######################################################################################################### +$$1 = SS_IDLE +$$0 = 0 '\000' +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x00000002 r10 0x00000000 pc 0x08004116 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x08004115 r8 0x00000000 sp 0x2000ff68 msp 0x2000ff68 control 0x00 + r4 0x20000aa8 r9 0x00000000 lr 0x0800338b psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { +!35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) + 36 { + 37 sstate = SS_START; + 38 } + 39 else + 40 { + 41 HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); + 42 } + 43 } + 44 +### Stack ########################################################################################################### +[0] from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x0800338a in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003586 in HAL_UART_IRQHandler+278 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2427 +[3] from 0x080014f0 in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:226 +[4] from 0xffffffe9 +[5] from 0x080014a8 in main+92 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +$3 = 5 '\005' +Detaching from program: /storage/Shared/Projects/Penguinator/motor_controller/build/motor_controller.elf, Remote target +[Inferior 1 (Remote target) detached] +UART1_RxCpltCallback (huart=0x20000aa8 ) at shared/drivers/p_serial_mgr.c:35 +35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08004114 UART1_RxCpltCallback+0 push {r3, lr} + 0x08004116 UART1_RxCpltCallback+2 ldr r3, [pc, #56] ; (0x8004150 ) + 0x08004118 UART1_RxCpltCallback+4 ldrb r3, [r3, #0] + 0x0800411a UART1_RxCpltCallback+6 cbnz r3, 0x800412e + 0x0800411c UART1_RxCpltCallback+8 ldr r3, [pc, #52] ; (0x8004154 ) + 0x0800411e UART1_RxCpltCallback+10 ldrb r3, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x20000aa8 r5 0x00000002 r10 0x00000000 pc 0x08004116 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x81000035 basepri 0x00 + r2 0x40013808 r7 0x00000000 r12 0xffffffff fpscr 0x00000000 faultmask 0x00 + r3 0x08004115 r8 0x00000000 sp 0x2000ff68 msp 0x2000ff68 control 0x00 + r4 0x20000aa8 r9 0x00000000 lr 0x0800338b psp 0x00000000 +### Source ########################################################################################################## + 25 SS_START = 1, // get start byte, interrupt after 4 more bytes + 26 } serial_state_t; + 27 + 28 static UART_HandleTypeDef *_serial_huart_inst = NULL; + 29 + 30 static uint8_t rxc = '\0'; + 31 static serial_state_t sstate = SS_IDLE; + 32 + 33 void UART1_RxCpltCallback(UART_HandleTypeDef *huart) + 34 { + 35 if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) + 36 { + 37 sstate = SS_START; + 38 } + 39 else + 40 { + 41 HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); + 42 } + 43 } + 44 +### Stack ########################################################################################################### +[0] from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +[1] from 0x0800338a in UART_RxISR_8BIT+130 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:4430 +[2] from 0x08003586 in HAL_UART_IRQHandler+278 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:2427 +[3] from 0x080014f0 in USART1_IRQHandler+8 at Core/Src/stm32l4xx_it.c:226 +[4] from 0xffffffe9 +[5] from 0x080014a8 in main+92 at Core/Src/main.c:141 +### Threads ######################################################################################################### +[1] id 0 from 0x08004116 in UART1_RxCpltCallback+2 at shared/drivers/p_serial_mgr.c:35 +### Variables ####################################################################################################### +arg huart = 0x20000aa8 : {Instance = 0x40013800,Init = {BaudRate = 115200,WordLength = 0,StopBi… +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x95f8 lma 0x80001c0 +Loading section .rodata, size 0x488 lma 0x80097b8 +Loading section .ARM, size 0x8 lma 0x8009c40 +Loading section .init_array, size 0x8 lma 0x8009c48 +Loading section .fini_array, size 0x8 lma 0x8009c50 +Loading section .data, size 0x9a8 lma 0x8009c58 +Start address 0x08004250, load size 42448 +Transfer rate: 29 KB/sec, 4716 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] diff --git a/motor_controller.ioc b/motor_controller.ioc index 3f3c11b..5b784bc 100644 --- a/motor_controller.ioc +++ b/motor_controller.ioc @@ -129,7 +129,7 @@ ProjectManager.FreePins=false ProjectManager.HalAssertFull=false ProjectManager.HeapSize=0x200 ProjectManager.KeepUserCode=true -ProjectManager.LastFirmware=true +ProjectManager.LastFirmware=false ProjectManager.LibraryCopy=1 ProjectManager.MainLocation=Core/Src ProjectManager.NoMain=false @@ -142,7 +142,7 @@ ProjectManager.StackSize=0x400 ProjectManager.TargetToolchain=Makefile ProjectManager.ToolChainLocation= ProjectManager.UnderRoot=false -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,4-MX_TIM2_Init-TIM2-false-HAL-true,5-MX_USART2_UART_Init-USART2-false-HAL-true,6-MX_DMA_Init-DMA-false-HAL-true,7-MX_USART1_UART_Init-USART1-false-HAL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true,5-MX_DMA_Init-DMA-false-HAL-true,6-MX_USART1_UART_Init-USART1-false-HAL-true,7-MX_TIM6_Init-TIM6-false-HAL-true RCC.48CLKFreq_Value=24000000 RCC.AHBFreq_Value=32000000 RCC.APB1Freq_Value=32000000 diff --git a/shared/drivers/p_serial_mgr.c b/shared/drivers/p_serial_mgr.c index 1867394..735621d 100644 --- a/shared/drivers/p_serial_mgr.c +++ b/shared/drivers/p_serial_mgr.c @@ -2,8 +2,12 @@ #include "putil.h" #include "stm32l4xx_hal_uart.h" -#define MAX_SERIAL_BUFFER_SIZE (262) // Actually 261, add 1 for padding +#define NUM_BUFFERS (10) +uint8_t sbuffer[NUM_BUFFERS][MAX_MESSAGE_LEN]; +uint8_t active_buffer = 0; + +uint8_t rxb[MAX_MESSAGE_LEN]; // this protocol is very similar to the digi api v2 (inspired from) // [0]{1} Start delimiter 0x7E // [1]{1} Source Address @@ -28,10 +32,14 @@ static serial_state_t sstate = SS_IDLE; void UART1_RxCpltCallback(UART_HandleTypeDef *huart) { - if (rxc == 0x7E && sstate == SS_IDLE) + if (sstate == SS_IDLE && sbuffer[active_buffer][0] == 0x7E) { sstate = SS_START; } + else + { + HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); + } } void p_serial_mgr_init(UART_HandleTypeDef *huart) @@ -43,14 +51,20 @@ void p_serial_mgr_service(void) { if (sstate == SS_START) { - return; + HAL_UART_Receive(_serial_huart_inst, &sbuffer[active_buffer][1], MAX_MESSAGE_LEN, 10); + for (int ind = 0; ind < 24; ind++) + { + PDEBUG("[%d]: 0x%02x\n", ind, sbuffer[active_buffer][ind]); + } + PDEBUG("\n\n"); + sstate = SS_IDLE; + active_buffer = (active_buffer + 1) % NUM_BUFFERS; + HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); } - else if (sstate = SS_IDLE) {} - return b_go; } void p_serial_mgr_start() { - b_go = false; - HAL_UART_Receive_IT(_serial_huart_inst, &rxc, 1); + sstate = SS_IDLE; + HAL_UART_Receive_IT(_serial_huart_inst, sbuffer[active_buffer], 1); } diff --git a/shared/drivers/p_serial_mgr.h b/shared/drivers/p_serial_mgr.h index f046861..8275c24 100644 --- a/shared/drivers/p_serial_mgr.h +++ b/shared/drivers/p_serial_mgr.h @@ -1,9 +1,9 @@ #ifndef _P_SERIAL_MGR_H_ #define _P_SERIAL_MGR_H_ +#include "p_cbuffer.h" #include "stm32l4xx_hal.h" #include - // start byte // src_addr {1} + // dest_addr {1} + @@ -30,7 +30,7 @@ typedef struct serial_pkt_t void p_serial_mgr_init(UART_HandleTypeDef *huart); -bool p_serial_mgr_service(void); +void p_serial_mgr_service(void); void p_serial_mgr_start();