Page 1 of 1

ESP32-C3-WROOM­02串口问题

Posted: Fri Sep 17, 2021 6:12 am
by wwwwwwww
串口设置如图,用串口调试工具发现, 开发板可以发送但是无法接收.

Re: ESP32-C3-WROOM­02串口问题

Posted: Fri Sep 17, 2021 7:18 am
by ESP_Gargamel
不要重复发帖,有图贴图上来。

Re: ESP32-C3-WROOM­02串口问题

Posted: Fri Sep 17, 2021 7:54 am
by wwwwwwww
  1. static void uart_init()
  2. {
  3.     uart_config_t uart_config1 = {
  4.             .baud_rate = 57600,
  5.             .data_bits = UART_DATA_8_BITS,
  6.             .parity = UART_PARITY_DISABLE,
  7.             .stop_bits = UART_STOP_BITS_1,
  8.             .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
  9.             .source_clk = UART_SCLK_APB,
  10.         };
  11.     uart_param_config(UART_NUM_0, &uart_config1);
  12.     uart_set_pin(UART_NUM_0, 12, 11, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
  13.     uart_driver_install(UART_NUM_0, BUF_SIZE * 2, 0, 0, NULL, 0);
  14. }
  1. for(;;)
  2. {
  3.     vTaskDelay(pdMS_TO_TICKS(200));
  4.     ESP_ERROR_CHECK(uart_get_buffered_data_len(UART_NUM_0, (size_t*)&length));
  5.     if(length>0)
  6.        {
  7.             len = uart_read_bytes(UART_NUM_0, starting_up, length, 30/portMAX_DELAY);
  8.             vTaskDelay(pdMS_TO_TICKS(500));
  9.             if(len>0)
  10. {

Re: ESP32-C3-WROOM­02串口问题

Posted: Fri Sep 17, 2021 8:10 am
by ESP_Gargamel

Re: ESP32-C3-WROOM­02串口问题

Posted: Fri Sep 17, 2021 8:43 am
by wwwwwwww
我用C3mini的芯片就没问题,可以正常收发数据.换成WROOM的就不能接收了.我看了那个帖子,我已经用了read函数也是读不到

Re: ESP32-C3-WROOM­02串口问题

Posted: Fri Sep 17, 2021 9:31 am
by ESP_Gargamel
uart_set_pin(UART_NUM_0, 12, 11, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
你再看看 TX/RX 管脚对不对。

Re: ESP32-C3-WROOM­02串口问题

Posted: Sat Sep 18, 2021 6:59 am
by wwwwwwww
引脚肯定没问题,TX都可以正常发送

Re: ESP32-C3-WROOM­02串口问题

Posted: Sat Sep 18, 2021 7:00 am
by wwwwwwww
名称 序号 类型1 功能
IO8 7 I/O/T GPIO8
IO9 8 I/O/T GPIO9
GND 9, 19P 接地
IO10 10 I/O/T GPIO10, FSPICS0
RXD 11 I/O/T GPIO20, U0RXD
TXD 12 I/O/T GPIO21, U0TXD

Re: ESP32-C3-WROOM­02串口问题

Posted: Sat Sep 18, 2021 7:34 am
by ESP_Gargamel
RXD 11 I/O/T GPIO20, U0RXD
TXD 12 I/O/T GPIO21, U0TXD
用模组管脚,还是芯片管脚?

Re: ESP32-C3-WROOM­02串口问题

Posted: Sat Sep 18, 2021 8:21 am
by wwwwwwww
我用的是官方的开发板,我程序里写的是12 11.但是12 11和GPIO21,GPIO20.我都尝试过.都是只有TX没有RX.