LP GPIO Wakeup
Overview
This sample demonstrates the LP core waking the HP core from deep sleep when a low level is detected on an LP GPIO pin. The LP core uses the Zephyr GPIO API to configure the pin and enable the wakeup interrupt.
The HP core boots, prints its wake count, and enters deep sleep via
sys_poweroff(). A RTC_DATA_ATTR variable tracks the number of
wakeups across deep sleep cycles.
By default, the sample uses GPIO0 (LP_IO_0) with a low-level trigger
and internal pull-up enabled. Any LP GPIO pin (GPIO0-GPIO7) can be used
by changing the wakeup-pin alias in the board overlay.
How it works
HP core loads LP core binary, configures LP IO as the wakeup source, and enters deep sleep.
LP core boots, signals the HP core via
ulp_lp_core_wakeup_main_processor(), configures the GPIO pin as input with pull-up and low-level interrupt, then halts.When the pin is pulled low, the LP core resets and repeats from step 2, waking the HP core again.
Wiring
Connect a button or jumper wire to GPIO0. The internal pull-up is enabled, so the pin is high by default. Briefly touch the pin to GND to trigger a wakeup.
Building and Flashing
Build the sample code as follows:
west build -b esp32c6_devkitc/esp32c6/hpcore --sysbuild samples/boards/espressif/ulp/lp_core/gpio_wakeup
Flash it to the device with the command:
west build -b esp32c6_devkitc/esp32c6/hpcore samples/boards/espressif/ulp/lp_core/gpio_wakeup
west flash
Sample Output
First boot, LP core will wake us on LP GPIO edge
HP core entering deep sleep...
After touching GPIO0 to GND:
Woke up from LP core (LP IO)! Wake count: 1
HP core entering deep sleep...