Page 1 of 1

Any methods to check data in uart tx fifo has already been sent

Posted: Tue Aug 20, 2024 12:41 pm
by wxd2024
Greetings,

Is there any methods to check the data that is written into uart tx fifo has been sent out by the hardware after calling uart_hal_tx_fifo_write(). It seems UART_TX_DONE interrupt just indicates tx fifo is empty instead of assuring the data has been actually sent out.

Regards

Re: Any methods to check data in uart tx fifo has already been sent

Posted: Tue Aug 20, 2024 1:45 pm
by aliarifat794
The ESP32 UART peripheral provides a UART_TX_DONE status bit, which is set when both the TX FIFO and the TX shift register are empty. This indicates that all the data has been transmitted.
https://docs.espressif.com/projects/esp ... /uart.html
https://esp32.com/viewtopic.php?t=10469

Re: Any methods to check data in uart tx fifo has already been sent

Posted: Tue Aug 20, 2024 4:30 pm
by wxd2024
Dear aliarifat794

Thanks a lot for the help. Both checking UART_TX_DONE status bit and adding a delay before sending the next byte are promising solutions. For checking the status bit, could you give some hints on how to get it, since I can't find any info in the idf document.

Best regards

Re: Any methods to check data in uart tx fifo has already been sent

Posted: Tue Aug 20, 2024 9:00 pm
by MicroController
wxd2024 wrote:
Tue Aug 20, 2024 12:41 pm
It seems UART_TX_DONE interrupt just indicates tx fifo is empty instead of assuring the data has been actually sent out.
To me it seems that there is a difference between the UART_TXFIFO_EMPTY and the UART_TX_DONE interrupts.

Re: Any methods to check data in uart tx fifo has already been sent

Posted: Wed Aug 21, 2024 5:12 am
by wxd2024
Yes, I think so. Maybe there is some other reasons causing my problem. I will check it again.