Page 1 of 1

UART ISR handaling in ESP IDF 5.0 +

Posted: Fri Mar 14, 2025 9:04 am
by teja.godavarthi
I am working with an ESP32-C6 and need to handle UART RX interrupts byte-by-byte without creating a FreeRTOS task. I found that uart_isr_register() is deprecated in ESP-IDF 5.0+, so what is alternate approach or any example code

Requirements
Use interrupt-based UART RX handling (without polling or tasks).
Handle incoming bytes individually inside the ISR.
Manually clear interrupt flags to avoid re-triggering

Re: UART ISR handaling in ESP IDF 5.0 +

Posted: Mon Mar 17, 2025 8:22 am
by MicroController
without creating a FreeRTOS task.
Any specific reason for this?

Re: UART ISR handaling in ESP IDF 5.0 +

Posted: Tue Jul 08, 2025 6:19 am
by teja.godavarthi
Yes, when around 100 bytes of data are received from an external source, the task waits until all bytes are received. This delay is causing a timeout in my application. If I had an ISR (Interrupt Service Routine) that triggers on each byte received, it would help handle the data more efficiently and avoid the timeout.

Re: UART ISR handaling in ESP IDF 5.0 +

Posted: Thu Jul 10, 2025 10:27 pm
by MicroController
You can change this behavior by
1) setting a low "RX full threshold", e.g. via uart_set_rx_full_threshold(), and either
2a) using the "event-based" programming model of the UART driver (where the driver sends you "events" via a FreeRTOS queue), or
2b) reading any data via uart_read_bytes() as it becomes available, see viewtopic.php?p=147877#p147896