cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_RECEIVE_IT not working all the time in HAL

Mr. AK
Associate III

Hi,

I'm using the UART functionality in NUCLEO-H745ZI-Q board. I want to transmit with UART polling and receive with interrupt. Every time I am able to transmit the characters on to the putty but sometimes receive interrupt is not working. I'm using HAL coding and UART4 & UART5. We can observe that sometimes the receive interrupt is working and characters are coming to the buffer and sometimes no response. We never did any modifications. Can somebody tell me why it is behaving like this???

PLEASE HELP...

4 REPLIES 4
Bubbles
ST Employee

Hi @Mr. AK​ ,

I'd suggest to check all the I2C registers flags and also the handle state before calling the HAL function to set the reception. There may be some pending flags which prevent the correct reception. Observe the flags state before and after the HAL_UART_Receive_IT() call and also the return value.

You should find the problem cause easily, it's not hard to make it work reliably.

Rgds,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Check and clear any noise, framing or overrun type errors.​

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

@Mr. AK​ What version of the STM32H7 HAL library do you use?

The HAL library once was notoriously bad in handling UART data overrun, and the symptom is exactly this. No RX. The latest library version could have it fixed, I have not checked. Developed a habit to write my own UART handling code.

Mr. AK
Associate III

Thank you all for the reply. I still cannot get it to working all the time with HAL but I tried with Low Layer (LL) API for the UART and I'm having a stable result all the time. I used polling at UART_tx and IT at UART_rx and modified the BRR value of the UART peripheral and is working all the time.