Hi
I need to build a UART console routine ( as a thread ) for my ESP8266 project under RTOS SDK ( 1.4.0 ), for debugging purposes, but, I couldn't use scanf or getchar to get data from UART0. The program is compiled and linked without problem, but, at execution, the FreeRTOS enter in a crazy loop. The console routine is built as a thread. If I comment the block code with scanf or getchar, the thread works perfectly, indicating that the problem is over scanf or getchar.
Which function can I use instead scanf or getchar?
Any example available, please?
Thanks
Sergio
ESP8266 RTOS SDK version 1.4.0 "how to get data from UART0?"
Re: ESP8266 RTOS SDK version 1.4.0 "how to get data from UART0?"
Postby pratik » Sat Nov 19, 2016 1:51 pm
Did you look up the UART APIs in RTOS SDK API Reference PDF?
You can simply register an interrupt handler and process the keystrokes in there. That would be the best way to work with UART. Meanwhile I can try to come up with some examples for the same.
Also, see the function definitions in uart.h header file... they are described in the header file itself and you can use the character receive function from there!
You can simply register an interrupt handler and process the keystrokes in there. That would be the best way to work with UART. Meanwhile I can try to come up with some examples for the same.
Also, see the function definitions in uart.h header file... they are described in the header file itself and you can use the character receive function from there!
Re: ESP8266 RTOS SDK version 1.4.0 "how to get data from UART0?"
Postby serkam » Tue Nov 22, 2016 5:21 am
Hi Pratik
Thanks you for your directions.
I solved my problem, without using interrupt:
if( (READ_PERI_REG(UART_STATUS(0))>>UART_RXFIFO_CNT_S) & UART_RXFIFO_CNT )
{
data = READ_PERI_REG(UART_FIFO(0) );
}
As my console is a thread and the data flux is low ( few console commands ), polling method works very well.
Problem solved.
Anyway, thank you for your kind support.
Sergio
Thanks you for your directions.
I solved my problem, without using interrupt:
if( (READ_PERI_REG(UART_STATUS(0))>>UART_RXFIFO_CNT_S) & UART_RXFIFO_CNT )
{
data = READ_PERI_REG(UART_FIFO(0) );
}
As my console is a thread and the data flux is low ( few console commands ), polling method works very well.
Problem solved.
Anyway, thank you for your kind support.
Sergio
Re: ESP8266 RTOS SDK version 1.4.0 "how to get data from UART0?"
Postby pratik » Fri Nov 25, 2016 1:23 pm
Thanks for taking the time to post your solution. This is simple and useful for low transfer rates! 

Who is online
Users browsing this forum: No registered users and 58 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
-
- All times are UTC+08:00
- Top
- Delete all board cookies
- 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.