Skip to main content
JArri.1
Visitor II
August 12, 2021
Question

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

  • August 12, 2021
  • 2 replies
  • 1062 views

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 

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
August 12, 2021

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
TDK
August 12, 2021
"If you feel a post has answered your question, please click ""Accept as Solution""."