-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
esp32: Add esp32.wake_on_gpio. #17518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c9561f2 to
a12c15c
Compare
|
@dpgeorge as specified in the description, this is a feature request that is very long standing (several years at least). I think that my implementation should satisify your standards, and if it does, I would appreciate serious consideration and merging this for the next release. Thank you for maintaining MicroPython and all of your hard work :-) |
|
@dpgeorge is there any way to oush this? Is there anything that I can do? |
|
Would love to see this merged! I'm stuck with a bunch of C3 and C6 boards laying around that would be significantly more useful with this implemented. |
|
Same here, been running this PR on some C3 for a while, and it works very well. |
|
@jimmo maybe you can help push this? As you can see, many people will benefit by merging this |
|
Just tested the patch on my ESP32-C3. Works as expected! Many thanks! My board is small, labelled "ESP32-C3 Super Mini" on back side, no vendor information, and those boards are sold widely on marketplaces. There are 16 legs, and no one of them are connected to the RST, so that feature is really, really needful. Hopefully this PR will be in the next release! |
|
Needed to rebase on top of master in order to build with a recent IDF, but indeed allows to wakeup from multiple Pins fine. Testing :
Note AFAIKT None of the existing |
|
Rebase with master needed otherwise it will compile but linking fails. I did manual testing with esp32c3 and wake up pin 2
Is works fine. Thanks a lot!!! You made me happy. Some remarks:
I did the same tests with esp32c6 and it also works. Valid wake up pins are: GPIO 0-7 |
dpgeorge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this feature, and sorry it took a while to get to.
It's a very straightforward extension of the existing wake_on_XXX functions, so it fits in nicely with them (from an API point of view).
Some boards support waking up via GPIO pins, 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. Signed-off-by: Meir Armon <[email protected]>
a12c15c to
b4ab3a8
Compare
I don't think it's possible to validate the pins in
That's also how the existing |
|
Thank you! |
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 (#15498, #13333 and #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:
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 awake_on_gpiowhich is a similar interface, and tests for the SOC capabilities.