← index #6071PR #13367
Off-topic · high · value 6.100
QUERY · ISSUE

ESP32 - EN pin when in Deep Sleep State

openby hpereira98opened 2020-05-24updated 2020-05-28
port-esp32

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.

CANDIDATE · PULL REQUEST

nrf/modules/machine: Implement deepsleep()

openby cwaltheropened 2024-01-05updated 2025-10-20
port-nrf

Replace the previous dummy implementation of machine.deepsleep() with one that invokes the nRF's deep sleep state System OFF. The argument is ignored, nRF microcontrollers are incapable of waking on a timer as all clocks are off in the deep sleep state.

Pins are configured as wake sources using an additional argument sense to the machine.Pin constructor. This choice is up for debate, it seemed appropriate because it internally is a matter of GPIO configuration. I also considered using the unused wake argument to Pin.irq(), but rejected that because the configuration has nothing to do with IRQs. Another possibility would be a special function in the nrf module, akin to esp32.wake_on_ext0().

machine.reset_cause() returns the newly added DEEPSLEEP_RESET, like on other ports – the previous mapping to PWRON_RESET seemed wrong.

I am unsure where to document this, as there is no port-specific documentation for the nrf port. Should I add a Quick reference for the nRF51/52 section just for this?

Tested on nRF52832 (DS-D6) and nRF52840 (ItsyBitsy).

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