QUERY · ISSUE
Bug: Deep Sleep Wake-up Issue on ESP32-C3
bugport-esp32
Port, board and/or hardware
ESP32 PORT, ESP32-C3 Super Mini
MicroPython version
Micropython 1.24.1
Reproduction
Title: Bug: Deep Sleep Wake-up Issue on ESP32-C3
Description:
I am experiencing an issue with the deep sleep wake-up functionality on the ESP32-C3 using MicroPython. The device does not wake up as expected when a GPIO pin changes from low to high.
Steps to Reproduce:
- Flash the latest version of MicroPython on an ESP32-C3.
- Use the following code to enter deep sleep and wake up on a GPIO pin change:
import machine import esp32 import time WAKEUP_GPIO_PIN = 0 LED_GPIO_PIN = 8 pin = machine.Pin(WAKEUP_GPIO_PIN, machine.Pin.IN, machine.Pin.PULL_UP) esp32.wake_on_ext0(pin=pin, level=esp32.WAKEUP_ANY_HIGH) wake_reason = machine.wake_reason() if wake_reason == machine.WAKEUP_EXT0: print("Woke up from deep sleep") machine.Pin(LED_GPIO_PIN, machine.Pin.OUT).value(1) time.sleep(1) machine.Pin(LED_GPIO_PIN, machine.Pin.OUT).value(0) else: print("Entering deep sleep") time.sleep(2) machine.deepsleep()
Expected behaviour
Wake up with change on GPIO0.
Observed behaviour
Does not wake up.
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
CANDIDATE · PULL REQUEST
ports/esp32: Fix ESP32-C3 deep/light sleep wake on GPIOs support.
port-esp32
Fixed the issue that machine wake up on GPIOs when deep/light sleep failed on esp32c3
after compiling firmware with ESP-IDF v4.4 and higher versions.
Tested with this code passed:
>>> import esp32
>>> import machine
>>> esp32.wake_on_pins([machine.Pin(4)], esp32.WAKEUP_ALL_LOW)
>>> machine.deepsleep()
# Let the GPIO4 low.
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x5 (DSLEEP),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xe3c
load:0x403ce000,len:0x6f4
load:0x403d0000,len:0x28d8
entry 0x403ce000
MicroPython 963e599ec-dirty on 2022-07-31; ESP32C3 module with ESP32C3
Type "help()" for more information.
>>>