HAL_UART_Receive_IT - how to clean before starting the function
Dear Mrs, Mr,
I'm working with a Riverdi discovery board with a STM32. I'm developing a serial protocol for which I'm using interrupt for reception.
- I enabled the IT in CubeMx
- Using HAL_UART_Receive_IT(), it is working fine for the first time and also if all characters received are read
- If I relaunch HAL_UART_Receive_IT() and characters were sent to the uart RX buffer without being read, it fails to work
- The only way I made it working was to add a HAL_UART_Init function before it and it is working fine.
But I guess this is not the best way to clean buffer, state and pending interrupts. Can you advise of the best way to do it ?
Thank you in advance,
Pascal