NONOS - Anyone have any sample code of receiving UART data
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
NONOS - Anyone have any sample code of receiving UART data
Postby AgentSmithers » Wed Jan 24, 2018 3:26 pm
Also os_printf also appears to stop printing once I run uart_config. Any way to keep that functionality while using UART?
Thanks everyone!
Re: NONOS - Anyone have any sample code of receiving UART data
Postby Her Mary » Thu Jan 25, 2018 5:36 pm
Code: Select all
// install uart1 putc callback
os_install_putc1((void *)uart1_write_char);//print output at UART1
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: NONOS - Anyone have any sample code of receiving UART data
Postby AgentSmithers » Fri Jan 26, 2018 12:25 am
Her Majesty wrote:You should note that the code below will change your os_printf to output from UART1. Maybe your application mistakenly called it.Code: Select all
// install uart1 putc callback
os_install_putc1((void *)uart1_write_char);//print output at UART1
Thanks!
I don't recall seeing this line but I'll take a look. Much appreciate. Thank you for your prompt response.
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: NONOS - Anyone have any sample code of receiving UART data
Postby AgentSmithers » Tue Jan 30, 2018 1:53 pm
I wrote this, However if I can write the 16 bytes before the WDT everything works great. As soon as I write one byte without the other 15 I get a WDT. Anyone know why? Like I need to clear the interrupt or something?
Code: Select all
LOCAL void uart0_rx_intr_handler(void *para)
{
char RcvChar[4];
RcvMsgBuff *pRxBuff = (RcvMsgBuff *)para;
if (UART_RXFIFO_FULL_INT_ST != (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_FULL_INT_ST)) {
return;
}
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR);
while (READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S))
{
ETS_UART_INTR_DISABLE();
RcvChar[0] = READ_PERI_REG(UART_FIFO(UART0)) & 0xFF;
/* you can add your handle code below.*/
gpio_output_set(0, (1 << 2), 0, 0);
uart0_tx_buffer(RcvChar, 1);
// Clear pending FIFO interrupts
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_TOUT_INT_CLR | UART_RXFIFO_FULL_INT_ST);
ETS_UART_INTR_ENABLE();
}
}
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: NONOS - Anyone have any sample code of receiving UART data
Postby AgentSmithers » Tue Jan 30, 2018 2:13 pm
WRITE_PERI_REG(UART_CONF1(uart_no), ((0x01 & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S) | ((0x01 & UART_RX_FLOW_THRHD) << UART_RX_FLOW_THRHD_S) | UART_RX_FLOW_EN | (0x02 & UART_RX_TOUT_THRHD) << UART_RX_TOUT_THRHD_S | UART_RX_TOUT_EN);
Anyone have a link to the document for these flags? I don't see it in the Programming guide from Expressif.
Anyone know the line that adjust the parity on UART0?
EDIT:
I think i found the answer.
//WRITE_PERI_REG(UART_CONF0(uart_no), CALC_UARTMODE(UartDev.data_bits, UartDev.parity, UartDev.stop_bits));
WRITE_PERI_REG(UART_CONF0(uart_no), CALC_UARTMODE(UartDev.data_bits, NONE_BITS, UartDev.stop_bits));
So to see the current option set I assume I use GET_PERI_REG, as it stands using UartDev.data_bits set to the current value its set to with no changes correct?
Re: NONOS - Anyone have any sample code of receiving UART data
Postby Her Mary » Wed Jan 31, 2018 2:03 pm
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: NONOS - Anyone have any sample code of receiving UART data
Postby AgentSmithers » Thu Feb 01, 2018 8:19 am
Her Majesty wrote:This document may help you https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf.
Ah that works!
Thanks. Give's me a good read.
Who is online
Users browsing this forum: No registered users and 117 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.