How to change UART baudrate ? - 修改 UART 波特率

Posts: 1643
Joined: Mon Oct 27, 2014 11:08 am

How to change UART baudrate ? - 修改 UART 波特率

Postby ESP_Faye » Thu Feb 05, 2015 4:41 pm

:idea: :idea: :idea:
ESP8266 default baudrate is 74880, and output from UART0, if we want to change it.
For example, change baudrate to 115200.

call uart_init(115200, 115200); in user_init.

Code: Select all

uart_init(UartBautRate uart0_br, UartBautRate uart1_br)
    // rom use 74880 baut_rate, here reinitialize
    UartDev.baut_rate = uart0_br;
    UartDev.baut_rate = uart1_br;

    // install uart1 putc callback
    os_install_putc1((void *)uart1_write_char);

Notice that the last sentence in uart_init, os_install_putc1((void *)uart1_write_char) is going to change "os_printf" to output from UART1.
So if you don't want to use UART1, please delete the last sentence in uart_init.

Code: Select all

 //os_install_putc1((void *)uart1_write_char);

ESP8266 默认波特率为 74880 ,从 UART0 输出。
如果我们想修改波特率,例如改为 115200。

请在 user_init 中调用 uart_init(115200, 115200);

uart_init 中的最后一句 os_install_putc1((void *)uart1_write_char) 设置将 "os_printf" 的打印信息从 UART1 输出 .
如果您不需要使用 UART1,将这最后一句注释掉即可。

Thanks for your interest in ESP8266 !

Who is online

Users browsing this forum: No registered users and 1 guest