Page 1 of 1

uart_driver_delete does not empty TXFIFO

Posted: Sat Feb 04, 2023 3:19 pm
by mikkeldamsgaard
Hey

I have been chasing an issue where when I deleted an UART and then re-installed it, the data that was send was wrong.

It all boiled down to the face that in uart_driver_delete, the TXFIFO of the uart is not emptied prior to disabling the module.

Adding this codel before the the call to uart_module_disable solved the issue completly:

Code: Select all

uint32_t len;
do {
  len = uart_hal_get_txfifo_len(&(uart_context[uart_num].hal));
 } while (len < SOC_UART_FIFO_LEN);
Maybe you want to add that?
I am using IDF 4.4

/Mikkel