cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_Receive_IT() returns BUSY and no longer receiving any interrupts

JJoy.1
Associate III

I am continuously calling HAL_UART_Receive_IT(), until i get some specified value in receiver buffer. But after some time HAL_UART_Receive_IT() return BUSY and after that it is not receiving any further interrupts and seems like the code is dead.

How can i get out of from BUSY state and receive further interrupts.

Please help me..

Thanks,

Jestina

11 REPLIES 11

Awesome! I'm glad I was able to help out.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
kris2399
Associate II

For those who encountered a similar issues where HAL_UART_Receive_IT returns HAL_BUSY (without spending too much time in interrupt), I have following findings. My code uses the HAL_UART_Receive_IT() and in a main loop (not under interrupt) I write some data to the same UART using HAL_UART_Transmit() each time I receive something on the UART. Increasing the data throughput on transmit side, increases the probability to run into a HAL_BUSY state on HAL_UART_Receive_IT(). Reason for this is that HAL_UART_Transmit() uses a LOCK mechanism to setup some parameters. When an incoming byte is received when this LOCK is set, HAL_UART_Receive_IT will return HAL_BUSY, hence reception will stop. To avoid this you can write "myHAL_UART_Transmit()", which is a copy from HAL_UART_Transmit(), and remove the LOCK mechanisme.