cancel
Showing results for 
Search instead for 
Did you mean: 

Blocking of the program flow with data reception with interruption through the USART port

JArri.1
Associate

I am having problems receiving data through the USART port. It enters the interrupt well but when it enters the HAL_UART_Receive function the program is blocked in the UART_WaitOnFlagUntilTimeout function.

As I understand it, this works, it waits until the RXNE bit is set to zero, but it is set to zero as soon as we enter the HAL_UART_Receive function.

I attach images so that you can see how my project code is, if someone can give me some advice whether I am doing it wrong or it is necessary to change something I would be very grateful.

0693W00000D2FJiQAN.png 

0693W00000D2FJsQAN.png 

2 REPLIES 2

Don't seem to understand how interrupts work.

Don't use the blocking function, use the HAL_UART_ReceiveIT() externally, and manage the fill content of the array in the callback.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

Look at examples in CubeMX to understand the correct way to call things.

https://github.com/STMicroelectronics/STM32CubeF4/tree/2f3b26f16559f7af495727a98253067a31182cfc/Projects/STM32F429I-Discovery/Examples/UART

If you feel a post has answered your question, please click "Accept as Solution".