-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
Type: For referenceCommon questions & problemsCommon questions & problemsType: QuestionOnly questionOnly question
Description
Board
esp32-h2
Device Description
Hello. While working on deep-sleep wakeup finds problem with gpio wakeup on esp32-h2. In API guide wrote using esp_deep_sleep_enable_gpio_wakeup to wakeup, but in ide this function not available for esp32-h2 board
Hardware Configuration
GPIO 12 connecting via button to GND
Version
latest stable Release (if not listed below)
IDE Name
VScode
Operating System
windows 11
Flash frequency
40MHz
PSRAM enabled
yes
Upload speed
115200
Description
Hello. While working on deep-sleep wakeup finds problem with gpio wakeup on esp32-h2. In API guide wrote using esp_deep_sleep_enable_gpio_wakeup to wakeup, but in ide this function not available for esp32-h2 board
Sketch
static void deep_sleep_task(void *pvParameters){
gpio_wakeup_enable(GPIO_PIN_BUTON,GPIO_INTR_LOW_LEVEL);
esp_deep_sleep_enable_gpio_wakeup(GPIO_PIN_BUTON);
bool button_st;
while(1){
if (xQueueReceive(button_queue, &button_st, portMAX_DELAY)) {
gpio_intr_disable(GPIO_PIN_BUTON);
int64_t timer = 0;
vTaskDelay(pdMS_TO_TICKS(50));
if (gpio_get_level(GPIO_PIN_BUTON) == 0){
ESP_LOGI("ISR", "Button is pressed");
timer = esp_timer_get_time();
}
while(gpio_get_level(GPIO_PIN_BUTON) == 0);
vTaskDelay(pdMS_TO_TICKS(50));
if (gpio_get_level(GPIO_PIN_BUTON) == 1){
ESP_LOGI("ISR", "Button is released");
if((esp_timer_get_time() - timer)>= 3000000){
ESP_LOGI("ESP", "Entering in Deep Sleep");
esp_deep_sleep_start();
}else{timer = 0;}
}
gpio_intr_enable(GPIO_PIN_BUTON);
}
}
}
Debug Message
C:/Users/fedot/Documents/X-TechProjects/X-RT/main/esp_zb_light.c:1740:5: error: implicit declaration of function 'esp_deep_sleep_enable_gpio_wakeup'; did you mean 'esp_sleep_enable_gpio_wakeup'? [-Wimplicit-function-declaration]
1740 | esp_deep_sleep_enable_gpio_wakeup(GPIO_PIN_BUTON);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| esp_sleep_enable_gpio_wakeup
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Metadata
Metadata
Assignees
Labels
Type: For referenceCommon questions & problemsCommon questions & problemsType: QuestionOnly questionOnly question
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
SuGlider commentedon Jun 4, 2025
Please reefer to IDF deep sleep example:
https://github.com/espressif/esp-idf/tree/master/examples/system/deep_sleep
H2 can use EXT1
or GPIO (only for pads powered by VDD3P3_RTC)as wakeup source.Don't forget to include necessary header files
SuGlider commentedon Jun 4, 2025
@VigilusPrime -
esp_deep_sleep_enable_gpio_wakeup()
is not supported by ESP32-H2.Based on https://github.com/espressif/esp-idf/blob/release/v5.4/components/esp_driver_gpio/include/driver/gpio.h#L548-L579
In order to support
esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type);
, the SoC must defineSOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
which is not the case for ESP32-H2.SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
is valid for ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61 and ESP32-P4 only.Therefore, the sketch should use EXT1 as Deepsleep wakeup source.
https://docs.espressif.com/projects/esp-idf/en/v5.4.1/esp32h2/api-reference/system/sleep_modes.html
NOTE: Only GPIO7~14 on ESP32H2 can support chip deep sleep wakeup through EXT1 wake up
ESP32-H2 GPIO9 is used as BOOT Button.
This example works:
VigilusPrime commentedon Jun 5, 2025
Many thanks! now it works!