drivers: serial: uart_stm32.c: RxDataFlush on async_rx_enable
When enabling async RX the first time after boot, there is an additional byte received with the first RX_DATA_RDY event, which seems to be caused by the RX data not being flushed before enabling the UART RX DMA. Adding a request to flush the RX data register before enabling the RX DMA, solves the issue. Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
This commit is contained in:
parent
26fd55e0a7
commit
f9b42bc911
1 changed files with 7 additions and 0 deletions
|
@ -1579,6 +1579,13 @@ static int uart_stm32_async_rx_enable(const struct device *dev,
|
|||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* Flush RX data buffer */
|
||||
#ifdef USART_SR_RXNE
|
||||
LL_USART_ClearFlag_RXNE(config->usart);
|
||||
#else
|
||||
LL_USART_RequestRxDataFlush(config->usart);
|
||||
#endif /* USART_SR_RXNE */
|
||||
|
||||
/* Enable RX DMA requests */
|
||||
uart_stm32_dma_rx_enable(dev);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue