Posts: 158
Joined: Fri May 22, 2015 6:22 pm


Postby eriksl » Tue Jun 09, 2015 1:47 am

Can someone please help me with the exact operation of the UART?

I am currently making something that needs the UART to be working interrupt/event driven. I am using the timeout ("RX_TOUT") interrupt to signal that the fifo can be read and fifo empty ("TXFIFO_EMPTY"). I set a threshold for the tout interrupt, I enable the tout interrupt, the fifo interrupt is enabled whenever there is data to be sent and then disabled.

All works, so I must be doing something right.

The problem is that if I send data to the uart quickly, only the first 126 bytes can be fetched. It doesn't matter what baudrate is used, so it's not a "too slow" issue. Apparently the fifo's are 128 bytes, so it probably has to do with that. But I don't understand. For the reception of data from uart I think it works like this:

1 receive fifo is empty
2 first byte of some data is received and put into the receive fifo
3 if fifo is not empty for "timeout threshold" time, generate timeout interrupt
4 goto 1


1 timeout interrupt triggered, callback is called
2 callback reads ALL data from the fifo until it's empty again
3 interrupt is cleared and interrupt is enabled again

I don't understand why the fifo apparently isn't completely emptied in time by my software. Apparently the fifo gets overrun. The callback should be called after just a few bytes in the fifo, that should be plenty of time to fetch all bytes from the fifo.

Maybe I don't understand the #defines correctly:

- UART_RX_TOUT_EN: enable receive fifo "timeout", if fifo is not empty for "threshold" uart byte times, raise an interrupt so the fifo can be emptied
- UART_RX_TOUT_THRHD: the threshold; I've used 2, 32, 64 and 120, it doesn't matter
- UART_RXFIFO_TOUT_INT_ENA: enable the interrupt

- UART_RXFIFO_FULL_THRHD: the threshold for the fifo being "full", there is no "ENABLE" function for this?
- UART_RXFIFO_FULL_INT_ENA: enable the interrupt (I am not using this)

What is exactly meant with the "threshold" values? For the "timeout", does it mean, smaller value is interrupt quicker (after lesser bytes) or the other way around? For the "full" threshold, is it actually used when the interrupt is not enabled? If so, what is it's meaning, is it used to the set the actual fifo size?

Last but not least, why is there no include file with the register definitions in the sdk?


Joanna Hoo
Posts: 2
Joined: Mon Nov 24, 2014 10:11 am


Postby Joanna Hoo » Wed Jun 10, 2015 6:37 pm


Please refer to viewtopic.php?f=21&t=414 and find the document named [8E-ESP8266__Interface_UART__EN_v0.2].
Hope this can help you.

Posts: 158
Joined: Fri May 22, 2015 6:22 pm


Postby eriksl » Wed Jun 10, 2015 9:19 pm

It helps a bit, but the wording isn't very informative. I googled about generic UART traits and already learned a lot, apparently the "uart receive fifo timeout" feature is common on buffered UART's. The thing I didn't realise earlier on, is that you need to enable and use both interrupts: uart timeout and uart full (with an appropriate threshold). If you leave out the second, an overflow will occur when data keeps on coming in beyond the 128 byte fifo, because there will be no "timeout". In that case you need to rely on the "fifo full" interrupt.

Posts: 128
Joined: Wed Dec 09, 2020 4:15 pm


Postby Nielson » Tue Apr 12, 2022 5:39 pm

Please I refer to download this YO WhatsApp and solve you issue if you are also having this issue with original WhatsApp...

Posts: 27
Joined: Mon Mar 21, 2022 12:58 pm


Postby tepalia02 » Wed Apr 13, 2022 8:22 pm

Hi, could you find any solution later?

Posts: 17
Joined: Mon Sep 05, 2022 2:19 pm


Postby Keonte45 » Tue Sep 13, 2022 2:18 pm

Hi, it's been long. Where you able to get a solution? What was it?

Posts: 158
Joined: Fri May 22, 2015 6:22 pm


Postby eriksl » Tue Sep 13, 2022 10:22 pm

I have most of it working. What is your specific issue?

Who is online

Users browsing this forum: No registered users and 3 guests