UART_BUFFER_FULL and UART_FIFO_OVF difference

gd_code
Posts: 8
Joined: Tue Sep 07, 2021 2:56 pm

UART_BUFFER_FULL and UART_FIFO_OVF difference

Postby gd_code » Wed Apr 06, 2022 3:08 pm

Hi all,

I am confused about the two events UART_BUFFER_FULL and UART_FIFO_OVF. What is the exact difference between these two events: what do they represent, when do they occur and especially to which RX buffer do they apply?

The documentation on UART (https://docs.espressif.com/projects/esp ... /uart.html) isn't really helping, as the use of the terminology RX ring buffer and RX FIFO is very confusing to me in the docs. As far as I understand (when also reading the technical document), there is a RX FIFO hardware buffer (128 bytes size?) and there is the RX (FIFO) ring buffer (which you install using `uart_driver_install()`). It is unclear to me which RX buffer is referred to in different parts of the documentation. Some examples:
* In this part (https://docs.espressif.com/projects/esp ... munication), I guess it is about the RX HW FIFO buffer and not the ring buffer, because when I look at the UART structure in the technical document, the UART FSM feeds into the RX HW FIFO (https://www.espressif.com/sites/default ... ual_en.pdf)
* In the `uart_read_bytes()` part (https://docs.espressif.com/projects/esp ... TickType_t), it says RX FIFO buffer, but here I guess it is about the ring buffer because they also refer to `uart_flush()` which should clear the RX ring buffer as I can read further down in the documentation.

The confusion about these RX FIFO and RX ring buffer in the documentation adds to my confusion about the UART_BUFFER_FULL and UART_FIFO_OVF events.

Kind regards,
gd_code

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: UART_BUFFER_FULL and UART_FIFO_OVF difference

Postby WiFive » Wed Apr 06, 2022 4:25 pm

The hardware fifo receives the bytes and then they are copied into the ring buffer in ram when the threshold is reached or at end of frame. If the hardware fifo overflows before the bytes can be copied out you get UART_FIFO_OVF. If the bytes can't be copied into the ring buffer because it is full you get UART_BUFFER_FULL.

gd_code
Posts: 8
Joined: Tue Sep 07, 2021 2:56 pm

Re: UART_BUFFER_FULL and UART_FIFO_OVF difference

Postby gd_code » Thu Apr 21, 2022 4:07 pm

Thanks for the clear answer!

Who is online

Users browsing this forum: No registered users and 197 guests