最近在进行ESP32开发的时候,发现设备启动报了一个错误:
E (527) uart: uart_set_hw_flow_ctrl(264): rx flow thresh error
搜了一下,发现是结构体初始化风格的问题。
原初始化代码
uart_config_t uart0_config;
//串口参数配置->uart0
uart0_config.baud_rate = 115200; //波特率
uart0_config.data_bits = UART_DATA_8_BITS; //数据位
uart0_config.parity = UART_PARITY_DISABLE; //校验位
uart0_config.stop_bits = UART_STOP_BITS_1; //停止位
uart0_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE; //硬件流控
修改后代码,修改后就不报错了。
uart_config_t uart0_config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
};