Hi All,
I have a currently working uart messaging protocol that sends variable lenght messages between the esp32 and another microcontroller.
I am wanting to change from the current method, which keeps the uart task very busy with small vtask_delay's, to an interrupt based reception. This is to prevent the uart task from keeping the ESP32 awake when light sleep is enabled.
I have seen in the uart peripheral driver there is the UART_RXFIFO_TOUT_INT interrupt. It looks like exactly what i am looking for.
The protocol sends a message between 8 and 520 bytes with gaps between messages. The gap is 5ms maximum when running at 2Mbaud. The messages are guarunteed to be sent with no gaps between bytes.
This timeout seems to be ideal, as from what i can read in the doccumemntation the interrupt will fire if there is a period of time where no new bytes have been recieved.
I have had a look into the default uart driver with the ring buffer etc, but i couldn't find any real information on how to setup or use this feature.
I can see there is the function uart_set_rx_timeout to set the timeout in bytes. and that there is a uart_enable_rx_intr function which enables both the RX_FULL and RX_TIMEOUT interrupts, both of which seem to be enabled when using the default uart driver.
Is it as simple as setting up an additional interrupt handler to what is setup in uart_driver_install, and checking if this flag has been set?
Thanks in advance.
Lucas
UART reception variable length message (no pattern)
-
- Posts: 79
- Joined: Tue Apr 26, 2016 5:10 am
-
- Posts: 79
- Joined: Tue Apr 26, 2016 5:10 am
Re: UART reception variable length message (no pattern)
Bumping to see if anyone can help with my question.
Cheers.
Cheers.
-
- Posts: 118
- Joined: Tue Jun 26, 2018 3:09 am
Re: UART reception variable length message (no pattern)
Hi Lucas.Hutchinson
The UART driver is for general purpose, so, some situations are not considered. If you want to know if the idle interrupt is happened, you can send an event in the interrupt to notify the task.
thanks !!
The UART driver is for general purpose, so, some situations are not considered. If you want to know if the idle interrupt is happened, you can send an event in the interrupt to notify the task.
thanks !!
wookooho
Who is online
Users browsing this forum: No registered users and 268 guests