Chapter 2. API Reference
External wakeup (ext0) RTC IO module contains logic to trigger wakeup when one of RTC GPIOs is set to a
predefined logic level. RTC IO is part of RTC peripherals power domain, so RTC peripherals will be kept powered
on during deep sleep if this wakeup source is requested.
Because RTC IO module is enabled in this mode, internal pullup or pulldown resistors can also be used. They
need to be configured by the application using rtc_gpio_pullup_en() and rtc_gpio_pulldown_en()
functions, before calling esp_sleep_start().
esp_sleep_enable_ext0_wakeup() function can be used to enable this wakeup source.
Warning: After wake up from sleep, IO pad used for wakeup will be configured as RTC IO. Before using this
pad as digital GPIO, reconfigure it using rtc_gpio_deinit(gpio_num) function.
External wakeup (ext1) RTC controller contains logic to trigger wakeup using multiple RTC GPIOs. One of the
two logic functions can be used to trigger wakeup:
• wake up if any of the selected pins is high (ESP_EXT1_WAKEUP_ANY_HIGH)
• wake up if all the selected pins are low (ESP_EXT1_WAKEUP_ALL_LOW)
This wakeup source is implemented by the RTC controller. As such, RTC peripherals and RTC memories can be
powered down in this mode. However, if RTC peripherals are powered down, internal pullup and pulldown resistors
will be disabled. To use internal pullup or pulldown resistors, request RTC peripherals power domain to be kept on
during sleep, and configure pullup/pulldown resistors using rtc_gpio_ functions, before entering sleep:
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
gpio_pullup_dis(gpio_num);
gpio_pulldown_en(gpio_num);
Warning: After wake up from sleep, IO pad(s) used for wakeup will be configured as RTC IO. Before using
these pads as digital GPIOs, reconfigure them using rtc_gpio_deinit(gpio_num) function.
esp_sleep_enable_ext1_wakeup() function can be used to enable this wakeup source.
ULP coprocessor wakeup ULP coprocessor can run while the chip is in sleep mode, and may be used to poll
sensors, monitor ADC or touch sensor values, and wake up the chip when a specific event is detected. ULP copro-
cessor is part of RTC peripherals power domain, and it runs the program stored in RTC slow memory. RTC slow
memory will be powered on during sleep if this wakeup mode is requested. RTC peripherals will be automatically
powered on before ULP coprocessor starts running the program; once the program stops running, RTC peripherals
are automatically powered down again.
esp_sleep_enable_ulp_wakeup() function can be used to enable this wakeup source.
GPIO wakeup (light sleep only) In addition to EXT0 and EXT1 wakeup sources described above, one more
method of wakeup from external inputs is available in light sleep mode. With this wakeup source, each pin can be
individually configured to trigger wakeup on high or low level using gpio_wakeup_enable() function. Unlike
EXT0 and EXT1 wakeup sources, which can only be used with RTC IOs, this wakeup source can be used with any
IO (RTC or digital).
esp_sleep_enable_gpio_wakeup() function can be used to enable this wakeup source.
Warning: Before entering light sleep mode, check if any GPIO pin to be driven is part of the VDD_SPI power
domain. If so, this power domain must be configured to remain ON during sleep.
Espressif Systems 1039
Submit Document Feedback
Release v4.4