AnsweredAssumed Answered

Question about behaviour of HAL_UART_Transmit_IT

Question asked by Sebastian K. on Aug 9, 2017
Latest reply on Aug 10, 2017 by Sebastian K.

Hello everyone,

 

I am having some trouble understanding the behaviour of the HAL_UART_Transmit_IT and HAL_UART_Receive_IT routines. I am using two NUCLEO-F767ZI boards that communicate via UART1 in a request/reply fashion - the "client" sends a one-byte command and the "server" immediately replies with the associated message. Both boards use a state machine which is programmed to ensure that at all times only one Receive_IT or Transmit_IT can be running. All the communication is carried out in interrupt mode. I have working IRQ handlers and Tx/Rx Completed Callbacks on both.

 

As I am running through a series of requests and replies, repeated every 10 ms by the client, the client board always starts to hang after a couple of cycles. But what is weird is that it seems to work fine only if I omit receiving the last reply of the server in a cycle, and skip directly to the next request without calling a HAL_UART_Receive_IT on the client. But from what I can see, the TxCpltCallback on the server side is still executed, although the client never called a Receive!

 

So I guess my question is: What is the behaviour of HAL_UART_Transmit_IT if nobody is answering on the other side?

 

Is there any other way a TxCpltCallback can be triggered? Do I have to clear any flags manually if I want to do what I described?

Outcomes