8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b01b9e commit 12ca9e8Copy full SHA for 12ca9e8
cores/esp32/esp32-hal-uart.c
@@ -315,11 +315,14 @@ void uartFlush(uart_t* uart)
315
UART_MUTEX_LOCK();
316
while(uart->dev->status.txfifo_cnt);
317
318
- uart->dev->conf0.txfifo_rst = 1;
319
- uart->dev->conf0.txfifo_rst = 0;
+ //Due to hardware issue, we can not use fifo_rst to reset uart fifo.
+ //See description about UART_TXFIFO_RST and UART_RXFIFO_RST in <<esp32_technical_reference_manual>> v2.6 or later.
320
+
321
+ // we read the data out and make `fifo_len == 0 && rd_addr == wr_addr`.
322
+ while(uart->dev->status.rxfifo_cnt != 0 || (uart->dev->mem_rx_status.wr_addr != uart->dev->mem_rx_status.rd_addr)) {
323
+ READ_PERI_REG(UART_FIFO_REG(uart->num));
324
+ }
325
- uart->dev->conf0.rxfifo_rst = 1;
- uart->dev->conf0.rxfifo_rst = 0;
326
UART_MUTEX_UNLOCK();
327
}
328
0 commit comments