uart: Fix unwanted processing of TX_DONE interrupt immediately after calling uart_wait_tx_done()

In previous transmission(s), the TX_DONE interrupt raw bit may be raised, but never been cleared.
TX_DONE interrrupt status bit should be cleared before enabling it to check the new transmission.

Introduced in d778f3f3fb77b5e734cfc0e651fa770350baed4f
This commit is contained in:
Song Ruo Jing 2022-09-22 14:21:01 +08:00 committed by BOT
parent 12dddeb160
commit 5d06480236

View File

@ -1031,6 +1031,9 @@ esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait)
xSemaphoreGive(p_uart_obj[uart_num]->tx_mux); xSemaphoreGive(p_uart_obj[uart_num]->tx_mux);
return ESP_OK; return ESP_OK;
} }
if (!UART_IS_MODE_SET(uart_num, UART_MODE_RS485_HALF_DUPLEX)) {
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), UART_INTR_TX_DONE);
}
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock)); UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
uart_hal_ena_intr_mask(&(uart_context[uart_num].hal), UART_INTR_TX_DONE); uart_hal_ena_intr_mask(&(uart_context[uart_num].hal), UART_INTR_TX_DONE);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock)); UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));