uart_driver_delete does not empty TXFIFO

mikkeldamsgaard
Posts: 5
Joined: Mon May 16, 2022 8:07 am

uart_driver_delete does not empty TXFIFO

Postby mikkeldamsgaard » Sat Feb 04, 2023 3:19 pm

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

Who is online

Users browsing this forum: Google [Bot] and 68 guests