espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.37k stars 7.21k forks source link

Misleading description of uart_enable_tx_intr (IDFGH-12050) #13115

Open ScumCoder opened 7 months ago

ScumCoder commented 7 months ago

https://github.com/espressif/esp-idf/blob/5454d37d496a8c58542eb450467471404c606501/components/esp_driver_uart/include/driver/uart.h#L369

I couldn't find any mention of "TX_TIMEOUT" interrupt in ESP32 Technical Reference Manual. Also, there seems to be no mention of this interrupt in the function body. My guess is that someone copypasted the description of uart_enable_rx_intr and then replaced "Rx" with "Tx".

EDIT: I've just noticed that there is no "TX_FULL" interrupt either (of course there isn't - it would've made no sense). The only interrupt uart_disable_tx_intr operates on is UART_INTR_TXFIFO_EMPTY.

nopnop2002 commented 7 months ago

If you use the CTS signal, a transmission timeout occurs if CTS remains high.

ScumCoder commented 7 months ago

If you use the CTS signal, a transmission timeout occurs if CTS remains high.

Could you please provide the source of this statement? Official manual says nothing about this.

nopnop2002 commented 7 months ago

Pls search "uart_wait_tx_done" on this. https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html

ScumCoder commented 7 months ago

Pls search "uart_wait_tx_done" on this. https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html

You literally posted a link to the same document as I did. As I said, it does not mention Tx timeouts. Please either point to the concrete sentence in that document proving otherwise, or stop implying that I'm an idiot.

Moreover, I'm not talking about the documentation. I'm talking about the source code. Did you try reading the body of the uart_enable_tx_intr function, as I suggested in the first post?

nopnop2002 commented 7 months ago

As I said, it does not mention Tx timeouts.

There is a timeout description in uart_wait_tx_done.

ticks_to_wait -- Timeout, count in RTOS ticks

It seems that uart_enable_tx_intr() sets the wait time until UART_INTR_TXFIFO_EMPTY.

ScumCoder commented 7 months ago

It seems that uart_enable_tx_intr() sets the wait time until UART_INTR_TXFIFO_EMPTY.

I see. Have a nice day.