Chapter 2. API Reference
For example, on ESP32-WROOM-32 board, GPIO16 and GPIO17 are linked to VDD_SPI power domain. If
they are configured to remain high during light sleep, the power domain should be configured to remain powered
ON. This can be done with esp_sleep_pd_config():
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_ON);
UART wakeup (light sleep only)
to wake up the chip when input data is available. UART peripheral contains a feature which allows waking up the
chip from light sleep when a certain number of positive edges on RX pin are seen. This number of positive edges
can be set using
uart_set_wakeup_threshold()
(and any characters before it) will not be received by the UART after wakeup. This means that the external device
typically needs to send an extra character to the ESP32-S2 to trigger wakeup, before sending the data.
esp_sleep_enable_uart_wakeup()
Power-down of RTC peripherals and memories
By default,
esp_deep_sleep_start()
all RTC power domains which are not needed by the enabled wakeup sources. To override this behaviour,
esp_sleep_pd_config()
If some variables in the program are placed into RTC slow memory (for example, using RTC_DATA_ATTR attribute),
RTC slow memory will be kept powered on by default. This can be overridden using
function, if desired.
Entering light sleep
esp_light_sleep_start()
is also possible to go into light sleep with no wakeup sources configured, in this case the chip will be in light sleep
mode indefinitely, until external reset is applied.
Entering deep sleep
esp_deep_sleep_start()
is also possible to go into deep sleep with no wakeup sources configured, in this case the chip will be in deep sleep
mode indefinitely, until external reset is applied.
Configuring IOs
Some ESP32-S2 IOs have internal pullups or pulldowns, which are enabled by default. If an external circuit drives
this pin in deep sleep mode, current consumption may increase due to current flowing through these pullups and
pulldowns.
To isolate a pin, preventing extra current draw, call
For example, on ESP32-WROVER module, GPIO12 is pulled up externally. GPIO12 also has an internal pull-
down in the ESP32 chip. This means that in deep sleep, some current will flow through these external and in-
ternal resistors, increasing deep sleep current above the minimal possible value. Add the following code before
esp_deep_sleep_start()
rtc_gpio_isolate(GPIO_NUM_12);
Espressif Systems
When ESP32-S2 receives UART input from external devices, it is often required
function. Note that the character which triggers wakeup
function can be used to enable this wakeup source.
and
esp_light_sleep_start()
function is provided.
function can be used to enter light sleep once wakeup sources are configured. It
function can be used to enter deep sleep once wakeup sources are configured. It
rtc_gpio_isolate()
to remove this extra current:
1040
Submit Document Feedback
functions will power down
esp_sleep_pd_config()
function.
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?