I did a lot of searching trying to understand the ESP32-ULP. Here are some links I'd like to save for later.
Hoping this will be of some help...
I struggled over much online help to find code that worked for deepsleep and external wake interrupt.
# magnetic reed switch on IO13
reed = machine.Pin(13, mode = machine.Pin.IN, pull = machine.Pin.PULL_DOWN)
# an external interrupt to wake from sleep if the door opens
reed.irq(trigger=machine.Pin.WAKE_LOW, wake=machine.DEEPSLEEP)
machine.deepsleep()
...this works well. I can pass a wake timer value in ms to the deepsleep() function or wake on interrupt.
Garry
-
https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/
-
https://lastminuteengineers.com/esp32-deep-sleep-wakeup-sources/
-
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/deep-sleep-stub.html
-
https://randomnerdtutorials.com/esp32-deep-sleep-arduino-ide-wake-up-sources/
-
https://codingfield.com/en/2019/01/15/ulp-esp32-un-exemple-simple/
-
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/ulp.html#
-
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/ulp.html