[已解决] ESP32S2 GPIO28 无法驱动LED

MilesWang
Posts: 5
Joined: Tue May 18, 2021 4:02 am

[已解决] ESP32S2 GPIO28 无法驱动LED

Postby MilesWang » Tue May 18, 2021 5:24 am

20210518132110.jpg
红灯GPIO37能正常亮灯
绿灯GPIO28无法正常亮灯,电压约2.0V

ESP-IDF版本
ESP-IDF v4.3-beta3-131-ge45be4dd4

demo:
simple_ota

code:
  1. #define CONFIG_GREEN_LED_GPIO 28
  2. #define CONFIG_RED_LED_GPIO 37
  3.  
  4. #define GREEN_LED_GPIO CONFIG_GREEN_LED_GPIO
  5. #define RED_LED_GPIO CONFIG_RED_LED_GPIO
  6.  
  7. #define Led_Set_Red_On() gpio_set_level(RED_LED_GPIO, 0)
  8. #define Led_Set_Green_On() gpio_set_level(GREEN_LED_GPIO, 0)
  9. #define Led_Set_Red_Off() gpio_set_level(RED_LED_GPIO, 1)
  10. #define Led_Set_Green_Off() gpio_set_level(GREEN_LED_GPIO, 1)
  11.  
  12.     gpio_config_t cfg = { .pin_bit_mask = BIT64(GREEN_LED_GPIO),
  13.                         .mode = GPIO_MODE_OUTPUT,
  14.         //for powersave reasons, the GPIO should not be floating
  15.         .pull_up_en = false,
  16.         .pull_down_en = false,
  17.         .intr_type = GPIO_INTR_DISABLE, };
  18.  
  19.     Led_Set_Green_On();
  20.     gpio_config(&cfg);
  21.     gpio_set_drive_capability(GREEN_LED_GPIO, GPIO_DRIVE_CAP_3);
  22.     gpio_hold_dis(GREEN_LED_GPIO);
  23.     gpio_hold_en(GREEN_LED_GPIO);
  24.  
  25.     Led_Set_Red_On();
  26.     cfg.pin_bit_mask = BIT64(RED_LED_GPIO);
  27.     gpio_config(&cfg);
  28.     gpio_set_drive_capability(RED_LED_GPIO, GPIO_DRIVE_CAP_3);
  29.     gpio_hold_dis(RED_LED_GPIO);
  30.     gpio_hold_en(RED_LED_GPIO);

MilesWang
Posts: 5
Joined: Tue May 18, 2021 4:02 am

Re: ESP32S2 GPIO28 无法驱动LED

Postby MilesWang » Tue May 18, 2021 9:39 am

硬件I/O标示错误,已解决。

Who is online

Users browsing this forum: No registered users and 147 guests