AliOS-Things icon indicating copy to clipboard operation
AliOS-Things copied to clipboard

ESP32无法使用串口1,2

Open leoadvance opened this issue 8 years ago • 2 comments

ESP32串口0(下载&log)可以正常使用。配置串口1和2时,无法发送数据。

   // 初始化
   uart_dev_t uart_1;
   uart_1.port                = 1;
   uart_1.config.baud_rate    = 115200;
   uart_1.config.data_width   = DATA_WIDTH_8BIT;
   uart_1.config.parity       = NO_PARITY;
   uart_1.config.stop_bits    = STOP_BITS_1;
   uart_1.config.flow_control = FLOW_CONTROL_DISABLED;
   hal_uart_init(&uart_1);
   
   // 循环发送测试命令 但SD3管脚(UART1_Tx)并未有数据输出。
   hal_uart_send(&uart_1,"test", 4, 500);

leoadvance avatar May 07 '18 10:05 leoadvance

找到原因,在调用hal_uart_init之前要先调用uart_param_config和uart_set_pin配置参数和管脚。

leoadvance avatar May 20 '18 16:05 leoadvance

@leoadvance 你好,我刚开始弄esp32.请问有没有esp32对串口操作的例程。我参考下。看aliosthings,不知道从哪里下嘴,谢谢

warman2000 avatar Nov 12 '18 10:11 warman2000