Configuring UART interrupt on ESP32-C3

maldyb
Posts: 1
Joined: Mon Mar 24, 2025 3:12 pm

Configuring UART interrupt on ESP32-C3

Postby maldyb » Tue Mar 25, 2025 4:51 pm

Hello!

I am working on a project on an ESP32-C3 board and I am using ESP-IDF v5.4.

I have successfully configured my board to send and receive data over UART using
- uart_param_config
- uart_set_pin
- uart_driver_install

I am successfully sending and receiving data with
- uart_write_bytes
- uart_read_bytes

I want to configure an interrupt that triggers each time a byte of data has been received. Inside of the interrupt function I want to use xQueueSendFromISR to send my received byte of data to another task. However, the function that I've found for doing this, uart_isr_register (https://docs.espressif.com/projects/esp ... r_handle_t), has been deprecated in newer versions of the ESP-IDF.

How do I configure my interrupt without uart_isr_register?
To my knowledge, the information presented in https://docs.espressif.com/projects/esp ... interrupts doesn't tell me how to configure a specific interrupt function when the interrupt is triggered. How do I control what code is run when the interrupt is triggered?

MicroController
Posts: 2705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Configuring UART interrupt on ESP32-C3

Postby MicroController » Wed Mar 26, 2025 9:42 pm

Inside of the interrupt function I want to use xQueueSendFromISR to send my received byte of data to another task.
Why not let the UART driver do this for you and just use uart_read_bytes()?

(The ability to replace the driver's ISR was apparently removed from the IDF. I assume because a custom ISR would not be able to safely integrate with the rest of the driver.)

Who is online

Users browsing this forum: ChatGPT-User and 2 guests