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.