at_register_uart_rx_intr(user_uart_rx_intr);
at_register_uart_rx_intr(user_uart_rx_intr);
Postby CCP1CON » Tue Nov 24, 2015 7:34 pm
I use at_register_uart_rx_intr(user_uart_rx_intr); to register a UART0 RX interrupt function.
I’m unsure about the calls to this function.
Let’s assume the other controller, connected to UART0, sends 32 bytes.
How often user_uart_rx_intr() will be called?
32 times once for each char?
Only once delivering 32 bytes in a bunch?
Or it is unpredictable?
Thanks for your time.
Re: at_register_uart_rx_intr(user_uart_rx_intr);
Postby CCP1CON » Sat Nov 28, 2015 4:46 pm
I figured it out myself.
You will not get any interrupt unless the last two bytes are 0x10, 0x13 (LF and CR) (or the UART0 buffer over runs at 100 bytes or so).
Strange, my intentionn is not to send a AT command neither a String.
So why is this?
Re: at_register_uart_rx_intr(user_uart_rx_intr);
Postby tve » Sun Nov 29, 2015 5:21 pm
You can get an interrupt when the fifo reaches a fill level you set or when there are characters in the fifo and nothing new has been received in a time period you set.
Re: at_register_uart_rx_intr(user_uart_rx_intr);
Postby CCP1CON » Sun Nov 29, 2015 5:37 pm

How can I set/read the FIFO fill level and the mentioned time period?
What are the default values?
Or where can I find these information?
Thanks
Re: at_register_uart_rx_intr(user_uart_rx_intr);
Postby CCP1CON » Tue Dec 01, 2015 4:16 am
WRITE_PERI_REG(UART_CONF1(0),
((0x01 & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S) |
((0x01 & UART_RX_FLOW_THRHD) << UART_RX_FLOW_THRHD_S) |
UART_RX_FLOW_EN);
Is there a description of all these registers and definitions?
Thanks in advance.
Re: at_register_uart_rx_intr(user_uart_rx_intr);
Postby CCP1CON » Thu Dec 03, 2015 4:09 am
I found that a RX full threshold would not fit to my needs because I do not have a fix packet length.
Therefore I go for a TOUT threshold.
In 8E-ESP8266__Interface_UART__EN_v0.2.pdf manual it says:
„The unit of TOUT threshold value is equal to the time of transmitting 8 byte data via UART, almost a byte.“
I guess it must read … transmitting 8 bit …
Because my max packet length is 66 bytes and stop bit and parity is enable I should set the threshold to 82?
66 * 10 (8+2) = 660 bits div 8 = 82
To have a little safety gap I will set it to 85.
Is my math correct?
And my code would be something like this:
Code: Select all
WRITE_PERI_REG(0x60000024, 85 << UART_RX_TOUT_THRHD_S | UART_RX_TOUT_EN);
SET_PERI_REG_MASK(0x6000000C, UART_RXFIFO_TOUT_INT_ENA);
Thanks
Re: at_register_uart_rx_intr(user_uart_rx_intr);
Postby tve » Sat Dec 05, 2015 11:50 am
Re: at_register_uart_rx_intr(user_uart_rx_intr);
Postby CCP1CON » Wed Dec 09, 2015 1:23 am
I have set TOUT to 5 (5x8=40; approx. 4 Byte) and it works ok.
There is one more question.
ESP does not receive the first byte. It always shows a zero instead. I did search a bit and think that ESP seems to expect a Break signal. Is there a way to configure ESP such that it will immediately capture the first byte?
Or is there another reason?
Who is online
Users browsing this forum: No registered users and 137 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.