← index #4142PR #17518
Related · high · value 0.988
QUERY · ISSUE

ESP32: RTC no function 'wake_on_ext0'

openby linuskohleropened 2018-09-15updated 2019-05-21
port-esp32

Hello,
this question may already be answered, but I can't find any working version for me.

I'm trying to use an interrupt-Pin on my newly flashed ESP32.
I tried with multiple snippets I found online (e.g. this or this), but it always breaks down to the point that RTC doesn't have the attribute now() or wake_on_ext0.

AttributeError: 'RTC' object has no attribute 'wake_on_ext0'

Is there anything I'm doing wrong? I'm using a flashed ESP32 wroom and the latest binaries from here (esp32-20180915-v1.9.4-528-gabb536da4.bin).

Thanks for your help!

CANDIDATE · PULL REQUEST

esp32: Add esp32.wake_on_gpio.

mergedby meirarmonopened 2025-06-17updated 2025-12-06
port-esp32

Summary

Some boards support waking up from deepsleep via GPIO pins (for instance ESP32C3, ESP32C6), but this is not currently supported by MicroPython. This commit adds support for waking with GPIO in a similar interface to waking with ext0, ext1, touch and ulp. This commit adds documentation for this new function as well.

This is a long standing request, with a lot of chatter online. Over the years there have been several attempts to add this (https://github.com/micropython/micropython/pull/15498, https://github.com/micropython/micropython/pull/13333 and https://github.com/micropython/micropython/pull/9583), but with no success. I also explain below why my approach is better (it is based on the existing PRs, so thanks to @m-cas, @puppet13th and @ondiiik).

Testing

Tested ESP32_GENERIC_C3with:

import machine
import esp32
esp32.wake_on_gpio((machine.Pin(5),machine.Pin(2)), esp32.WAKEUP_ANY_HIGH)
machine.deepsleep()

and checked that the relevant pins wake up from deepsleep.

Trade-offs and Alternatives

The existing PRs mentioned above modify wake_on_ex1, testing if the port is specifically ESP32C3. My solution adds a wake_on_gpio which is a similar interface, and tests for the SOC capabilities.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied