Page 1 of 1

UART RX FULL interrupt implementation

Posted: Sat Feb 19, 2022 3:25 am
by imdaad
hello All,
I need to implement an interrupt when the Rx FIFO buffer is filled with a specific number of characters. However, I find it difficult to program it. As you can see the API reference says how should we do it, but the conventional isr handers are missing in these APIs. can someone send me a code snippet, indicating how to achieve this? I am rather stuck without. thank you

Re: UART RX FULL interrupt implementation

Posted: Mon Feb 21, 2022 9:45 am
by john_bul
Same problem.
From docs/en/migration-guides/peripherals.rst :
- :cpp:member:`uart_isr_register` and :cpp:member:`uart_isr_free` have been removed as the UART interrupt handling is closely related to the driver implementation.

How to specify my own interrupt handler?

Re: UART RX FULL interrupt implementation

Posted: Mon Feb 21, 2022 10:32 am
by ESP_Sprite
@imdaad: You're not supposed to, the interrupt is handled in the driver. You'd set the threshold of the RX buffer in the UART configuration, then (possibly in a separate task) you do a (blocking) read from the uart.

@john: You can still use the generic ESP-IDF interrupt allocator to allocate your 'raw' UART interrupt.

Re: UART RX FULL interrupt implementation

Posted: Mon Feb 21, 2022 5:57 pm
by WardMas
Hi,
AS far as I know, first of all you need to set the threshold you want and activate that specific interrupt in https://www.espressif.com/sites/default ... f#page=347 UART_INT_RAW_REG resister, which is the first bit in your case.

Code: Select all

uart_intr_config_t UART_ISR_Config = 
{
	.intr_enable_mask = 0b00000001,
	.rxfifo_full_thresh = 50			//Change this threshold to suit your code 		 
}
then you will pass the ISR config pointer to

Code: Select all

uart_intr_config(uart_port_t uart_num, const uart_intr_config_t *intr_conf);
For ESP32 UART driver installation, I advice you to follow the following UART event example:
https://github.com/espressif/esp-idf/tr ... art_events