cancel
Showing results for 
Search instead for 
Did you mean: 

I am using the HAL receive_IT and transmit_IT successfully but occasionally as the transmit is being setup part way through the receive message the receive interrupt fails to get enabled and an overrun error occurs. Does anyone have a solution for this?

LAdam
Associate II

I receive the data byte by byte and I can see that the only time that it fails is at the beginning of the transmit. It looks like the HAL is busy starting the transmit so it cannot re-enable the receive interrupt after the previous byte has been received. The HAL receive function returns busy and therefore the interrupt is not enabled.

Can the HAL cope with transmitting and receiving at the same time? It only happens when the first byte is being prepared for transmit.

Any advice would be greatly appreciated.

4 REPLIES 4
berendi
Principal

I'm afraid you have to implement it without HAL. The UART controller has no difficulty handling transmit and receive at the same time, you just don't disable the receive interrupt at all. Enable/disable transmit interrupt (TXEIE) as needed.

Read the USART chapter in the reference manual for details.

LAdam
Associate II

Thanks, did you also have issues with HAL? I shall try to implement the receive and transmit using the examples given in the reference manual.

Stopped using HAL a long time ago. It was just getting in the way of doing stuff.

The U(S)ART HAL implementation is unhelpful and frequently gets in its own way. Not using the IT/DMA methods provided.

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