Skip to main content
LAdam
Associate
November 18, 2019
Question

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 th

  • November 18, 2019
  • 2 replies
  • 1076 views

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.

This topic has been closed for replies.

2 replies

berendi
Principal
November 18, 2019

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
LAdamAuthor
Associate
November 18, 2019

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.

berendi
Principal
November 18, 2019

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