ESP8266EX:Fix A Potential Error For Uart RX

User avatar
dexterash
Posts: 7
Joined: Fri Nov 07, 2014 7:10 pm
Location: Online
Contact:

Re: ESP8266EX:Fix A Potential Error For Uart RX

Postby dexterash » Mon Nov 17, 2014 9:46 pm

costaud wrote:try this to set baudrate to 115200 bps.

Code: Select all

#include "driver/uart_register.h"
void user_init(void)
{
   uart_div_modify(0, UART_CLK_FREQ / 115200);
   //clear rx and tx fifo,not ready
   SET_PERI_REG_MASK(UART_CONF0(0), UART_RXFIFO_RST | UART_TXFIFO_RST);
   CLEAR_PERI_REG_MASK(UART_CONF0(0), UART_RXFIFO_RST | UART_TXFIFO_RST);
        os_printf("set baudrate to 115200\n\r");
        os_printf("SDK version:%d.%d.%d\n", SDK_VERSION_MAJOR, SDK_VERSION_MINOR, SDK_VERSION_REVISION);


Thank you! It worked like a charm. I think the code can be reused for anyone trying to change the UART speed.

Don't forget to include the uart_register.h file.

costaud
Posts: 138
Joined: Fri Oct 24, 2014 7:40 pm

Re: ESP8266EX:Fix A Potential Error For Uart RX

Postby costaud » Wed Nov 19, 2014 2:46 am

dexterash wrote:
costaud wrote:try this to set baudrate to 115200 bps.

Code: Select all

#include "driver/uart_register.h"
void user_init(void)
{
   uart_div_modify(0, UART_CLK_FREQ / 115200);
   //clear rx and tx fifo,not ready
   SET_PERI_REG_MASK(UART_CONF0(0), UART_RXFIFO_RST | UART_TXFIFO_RST);
   CLEAR_PERI_REG_MASK(UART_CONF0(0), UART_RXFIFO_RST | UART_TXFIFO_RST);
        os_printf("set baudrate to 115200\n\r");
        os_printf("SDK version:%d.%d.%d\n", SDK_VERSION_MAJOR, SDK_VERSION_MINOR, SDK_VERSION_REVISION);


Thank you! It worked like a charm. I think the code can be reused for anyone trying to change the UART speed.

Don't forget to include the uart_register.h file.

Does it work properly?
If not ,you can try this one .
viewtopic.php?f=7&t=25&p=70#p70

User avatar
dexterash
Posts: 7
Joined: Fri Nov 07, 2014 7:10 pm
Location: Online
Contact:

Re: ESP8266EX:Fix A Potential Error For Uart RX

Postby dexterash » Wed Nov 19, 2014 4:28 am

costaud wrote:Does it work properly?

It works very nice! Thank you again.

Who is online

Users browsing this forum: No registered users and 212 guests