8000 Port UART reset fix from ESP-IDF (#1408) · michameiu/arduino-esp32@12ca9e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 12ca9e8

Browse files
chemicstryme-no-dev
authored andcommitted
Port UART reset fix from ESP-IDF (espressif#1408)
1 parent 8b01b9e commit 12ca9e8
< 8000 div class="Box-sc-g0xbh4-0 prc-PageLayout-PaneWrapper-nGO0U Commit-module__Pane--r5DTJ Commit-module__TreeExpanded--asa0G" style="--offset-header:0px;--spacing-row:var(--spacing-none);--spacing-column:var(--spacing-none)" data-is-hidden="false" data-position="start" data-sticky="true">

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,14 @@ void uartFlush(uart_t* uart)
315315
UART_MUTEX_LOCK();
316316
while(uart->dev->status.txfifo_cnt);
317317

318-
uart->dev->conf0.txfifo_rst = 1;
319-
uart->dev->conf0.txfifo_rst = 0;
318+
//Due to hardware issue, we can not use fifo_rst to reset uart fifo.
319+
//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+
}
320325

321-
uart->dev->conf0.rxfifo_rst = 1;
322-
uart->dev->conf0.rxfifo_rst = 0;
323326
UART_MUTEX_UNLOCK();
324327
}
325328

0 commit comments

Comments
 (0)
0