AnsweredAssumed Answered

STM32CubeMx with FreeRTOS, LED, UART stuck in infinite loop

Question asked by Phua.Eugene on Jul 31, 2014
Latest reply on Sep 18, 2014 by STM32Cube-T
Hi there, I am using the STM32CubeMx code generator with the STM32L053 discovery board. In CubeMx, I enabled USART2 and changed the baud rate to 9600. Also, I configured the pins PA0 for user push button, PA5 for red LED, PB4 for green LED.

Here is a snippet of code that i inserted in TrueStudio:
/* USER CODE BEGIN 2 */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET);
 
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_SET);
/* USER CODE END 2 */
This is before the code generated for FreeRTOS but the debug never reaches this line of code.

It gets stuck here line 124:
stuck.PNG

However, if i were to disable the USART2 in CubeMx, the LED works!

Is there some configuration procedure to note??? I have not called the function HAL_UART_MspInit yet...

Outcomes