ESP32 UART rx idle timeout not working in driver
Posted: Tue Jan 26, 2021 5:45 pm
I'm trying to use the UART receive idle timeout (uart_set_rx_timeout() etc.) with RS485. I see the timeout interrupt is enabled in UART registers (I'm using UART1 now) and I added some debug code in the UART interrupt routine so I can see that the TOUT interrupt is actually triggered - and it is. However, when I try to read the incoming data using uart_read_bytes(), the TOUT timeout doesn't return the data to the task - uart_read_bytes() only returns when the buffer becomes full.
Looking at the uart_read_bytes() source, it calls xRingbufferReceive() and I guess xRingbufferReceive() knows nothing about the TOUT interrupt, so it sleeps until the call timeouts or buffer becomes full. I believe the timeout functionality is completely missing from the UART driver. I just cloned the latest repository and this is still the case.
However, the ESP32 RS485 example uses uart_read_bytes() and uart_set_rx_timeout() and gives you the impression that the rx idle timeout has been implemented in the driver.
Am I missing something here or does the driver really lack support for the idle timeout?
Looking at the uart_read_bytes() source, it calls xRingbufferReceive() and I guess xRingbufferReceive() knows nothing about the TOUT interrupt, so it sleeps until the call timeouts or buffer becomes full. I believe the timeout functionality is completely missing from the UART driver. I just cloned the latest repository and this is still the case.
However, the ESP32 RS485 example uses uart_read_bytes() and uart_set_rx_timeout() and gives you the impression that the rx idle timeout has been implemented in the driver.
Am I missing something here or does the driver really lack support for the idle timeout?