AnsweredAssumed Answered

How can I process incoming UART communications when the code cycle is lengthy?

Question asked by Trace on Nov 7, 2014
Latest reply on Nov 10, 2014 by Ivan Ivanov

I'm working with an STM32F4 Discovery board, and I've been experimenting with the CubeF4 UART examples (HAL).

Everything I've seen suggests that receiving takes a manual command.  


Example:

HAL_UART_Receive(&UartHandle, (uint8_t *)aRxBuffer, RXBUFFERSIZE, 50);


Even the interrupt based examples look similar.  Playing around with the polling version, I discovered that if each code cycle takes too long (can be simulated by adding a 100 ms delay), then the majority of incoming communications are lost.  Increasing the timeout on the receive command can help, but then it slows down the code execution.

How can I have incoming communications processed immediately, with good success, without slowing down the rest of the code execution, and have the receive buffer act as a true buffer - holding the last communication even if the code cycle is lengthy?

Outcomes