[求助] 串口2发送数据时,报文顺序错乱, 4.2稳定版

jame113
Posts: 19
Joined: Fri Dec 25, 2020 4:47 am

[求助] 串口2发送数据时,报文顺序错乱, 4.2稳定版

Postby jame113 » Fri Dec 25, 2020 5:00 am

求助, 如题, 谢谢。
4.2稳定版,发送数据如:
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F (15byte)
逻辑分析仪和接收端拿到的数据均为:
0x0C, 0x0D, 0x0E, 0x0F , 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B(15byte)
串口0和串口1都没有问题, 之前用的是3.6.1版本,也没有这个问题, 升级4.2就出问题了, 初始化代码如下:

Code: Select all

	//串口配置结构体
	uart_config_t uart2_config = {
		.baud_rate = 9600,					   //波特率
		.data_bits = UART_DATA_8_BITS,		   //数据位
		.parity = UART_PARITY_DISABLE,		   //校验位
		.stop_bits = UART_STOP_BITS_1,		   //停止位
		.flow_ctrl = UART_HW_FLOWCTRL_DISABLE, //硬件流控
	};

	//注册串口服务即使能+设置缓存区大小
	ESP_ERROR_CHECK(uart_driver_install(UART_NUM_2, 1024, 1024, 0, NULL, 0));

	//设置串口2
	ESP_ERROR_CHECK(uart_param_config(UART_NUM_2, &uart2_config));

	//IO映射
	ESP_ERROR_CHECK(uart_set_pin(UART_NUM_2, TX_AUDIO_PIN, RX_AUDIO_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));

Who is online

Users browsing this forum: No registered users and 129 guests