ESP32 - EN pin when in Deep Sleep State
When my board is in deep sleep state ( machine.deepsleep() ), when I press the EN button the machine.reset_cause() returns the machine.PWRON_RESET instead of the machine.DEEPSLEEP_RESET. Is this supposed to happen? How can I get the machine.DEEPSLEEP_RESET by pressing a button?
I tried the embedded EN button and connecting a physical button to the EN pin.
ESP32-C6: WAKEUP_ALL_LOW causes GPIO pin to be stuck upon waking from deeepsleep
Port, board and/or hardware
ESP32_C6_GENERIC, Seeed Studio XIAO ESP32-C6
MicroPython version
MicroPython v1.25.0 on 2025-04-15; ESP32C6 module with ESP32C6
Reproduction
- Copy the code below into
main.pyon an ESP32-C6 board. - Reset the board.
from machine import Pin, deepsleep
from esp32 import wake_on_ext1, WAKEUP_ALL_LOW
from time import sleep_ms
BUTTON_PIN = 0 # must be RTC-capable pin.
LED_PIN = 15 # XIAO ESP32-C6 User LED pin, active LOW
sleep_ms(1000) # wait for button to be released
button = Pin(BUTTON_PIN, Pin.IN, Pin.PULL_UP)
led = Pin(LED_PIN, Pin.OUT, value=1) # active low
def blink_led(period_ms):
led.value(0) # turn on LED
sleep_ms(period_ms)
led.value(1) # turn off LED
blink_led(500)
if button.value() == 1:
wake_on_ext1([button], WAKEUP_ALL_LOW)
deepsleep()
else:
print("Button is pressed. Not going to sleep.")
while True:
sleep_ms(100)
blink_led(100)
Expected behaviour
Expected to long-blink the LED once after reset.
If pin GPIO 0 is briefly connected to GND you should get another single blink.
Observed behaviour
The LED long-blinks once, then again after 1 second, then flashes rapidly, indicating that pin 0 is stuck LOW.
Interrupting with mpremote repl you can examine the state of button:
>>> button.value()
0
>>>
Additional Information
If you use esp32.WAKEUP_ANY_HIGH (and Pin.PULL_DOWN) it works correctly.
Also, wake_on_ext0(button, WAKEUP_ALL_LOW) doesn't wake up on the GPIO going LOW.
Code of Conduct
Yes, I agree