2017-04-12 10:23 AM
Hi
I am implementing a USART driver and would like to use DMA for reception. In order to detect a timeout on the RX line, I use the USART idle interrupt.
The DMA works and I receive the expected characters. However once the line is idle, the IDLE interrupt is fired again and again. I have only enabled the IDLE interrupt, RXNE interrupt is disabled.
Based on the reference manual, I expect the IDLE interrupt to be fired only once after a reception, however this is not the case.
What could be the issue?
2017-04-13 12:26 AM
I will attempt to answer my own question since I was able to resolve the issue. The reason why the interrupt was called repeatedly was that simply clearing the IDLE bit in the SR register was not possible.
Everything works as expected when the IDLE bit is cleared via the __HAL_UART_CLEAR_IDLEFLAG macro from the ST HAL library (i.e. reading out the SR register followed by a read to the DR register).