8000 docs/esp32/quickref: Refine deep-sleep power-saving notes. · micropython/micropython@41c86f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41c86f7

Browse files
committed
docs/esp32/quickref: Refine deep-sleep power-saving notes.
This attempts to better explain how pull-ups and pull-downs operate in deep-sleep.
1 parent ba629d9 commit 41c86f7

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

docs/esp32/quickref.rst

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ Notes:
176176

177177
* Pins 34-39 are input only, and also do not have internal pull-up resistors
178178

179-
* The pull value of some pins can be set to ``Pin.PULL_HOLD`` to reduce power
180-
consumption during deepsleep.
179+
* See :ref:`Deep_sleep_Mode` for a discussion of pin behaviour during sleep
181180

182181
There's a higher-level abstraction :ref:`machine.Signal <machine.Signal>`
183182
which can be used to invert a pin. Useful for illuminating active-low LEDs
@@ -498,6 +497,8 @@ See :ref:`machine.WDT <machine.WDT>`. ::
498497
wdt = WDT(timeout=5000)
499498
wdt.feed()
500499

500+
.. _Deep_sleep_mode:
501+
501502
Deep-sleep mode
502503
---------------
503504

@@ -517,15 +518,28 @@ Notes:
517518
* Calling ``deepsleep()`` without an argument will put the device to sleep
518519
indefinitely
519520
* A software reset does not change the reset cause
520-
* There may be some leakage current flowing through enabled internal pullups.
521-
To further reduce power consumption it is possible to disable the internal pullups::
522521

523-
p1 = Pin(4, Pin.IN, Pin.PULL_HOLD)
522+
Some ESP32 pins (0, 2, 4, 12-15, 25-27, 32-39) are connected to the RTC during
523+
deep-sleep and can be used to wake the device with the ``wake_on_`` functions in
524+
the :mod:`esp32` module. The output-capable RTC pins (all except 34-39) will
525+
also retain their pull-up or pull-down resistor configuration when entering
526+
deep-sleep.
527+
528+
If the pull resistors are not actively required during deep-sleep and are likely
529+
to cause current leakage (for example a pull-up resistor is connected to ground
530+
through a switch), then they should be disabled to save power before entering
531+
deep-sleep mode::
532+
533+
from machine import Pin, deepsleep
524534

525-
After leaving deepsleep it may be necessary to un-hold the pin explicitly (e.g. if
526-
it is an output pin) via::
535+
# configure input pin with pull-up on boot
536+
pin = Pin(2, Pin.IN, Pin.PULL_UP)
537+
538+
# put the device to sleep for 10 seconds
539+
pin.init(pull=None)
540+
machine.deepsleep(10000)
527541

528-
p1 = Pin(4, Pin.OUT, None)
542+
Non-RTC GPIO pins will be disconnected by default on entering deep-sleep.
529543

530544
SD card
531545
-------

0 commit comments

Comments
 (0)
0