Page 1 of 1

Using timeout on UART receiver

Posted: Fri Oct 27, 2017 6:44 pm
by erikclaij
Hi,

I am using the ESP32 uart for a RS485 half duplex connection. I need a way to stop waiting for data on RX.

The loop I do:
- Send a RS485 command (500 kBaud)
- Wait for data or timeout in +/-25 us

It is completly IRQ based.

One way to do this is maybe a hardware timer with a irq.
Maybe it is also possible to use the UART_RXFIFO_TOUT_INT interrupt? But this part is not well documented.

Any ideas?

Best, Erik

Re: Using timeout on UART receiver

Posted: Mon Oct 30, 2017 7:21 pm
by chartle2
I haven't worked with UART yet, but it looks like the UART driver function uart_read_bytes( ... ) takes an arguement for timeout.

https://github.com/espressif/esp-idf/bl ... ver/uart.h