2019-10-01 11:26 PM
Hi,
I'm trying to transmit/receive data by uart. I have a state machine that is processing incoming bytes periodically, so I use a ringbuffer and write every received byte into this buffer.
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if (huart == &uart3)
{
fFifoIn( &RX_BUFFER, RX_UART4_Buffer[0]);
HAL_UART_Receive_IT( &huart4, RX_UART4_Buffer, RX_BUFFER_SIZE);
}
}
I had to call HAL_UART_Receive_IT afterwards otherwise receiving stopped after one byte (found here: https://riptutorial.com/de/stm32/example/29940/echoanwendung---hal-bibliothek)
Transmitting of data is done by HAL_UART_Transmit.
Normally I'm requesting data from the communication part that is send periodically after requesting them once. My problem is, that sometimes the communication does not start. With debugging I found, that it stucks in the UART_WaitOnFlagUntilTimeout, but I don't know why and how to handle this. Any ideas?
Thanks and best regards
Christoph