Pin.PULL_HOLD with ESP32 DevKit DOIT problem - Does it work with deepsleep and Pin.OUT?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
rockyrobin
Posts: 4
Joined: Fri May 14, 2021 2:07 pm

Pin.PULL_HOLD with ESP32 DevKit DOIT problem - Does it work with deepsleep and Pin.OUT?

Post by rockyrobin » Sun May 16, 2021 8:54 am

I've been trying to get my ESP32 DevKit DOIT to go to deepsleep and maintain 0v on a pin.
I can cycle between 3.3v and 0v, but as soon as I try to PULL.HOLD the pin before sleep, followed by deepsleep the pin then goes to 2.5v and stays at that voltage until the board wakes up and then cycles the pin state between 3.3v and 0v again.
If anyone can offer me any advice on where I am going wrong would be grateful, thanks.

Code: Select all

import time
from machine import Pin
from machine import deepsleep

pn0 = Pin(23, Pin.OUT)
print("Initial Pin value = ", pn0.value())

for n in range (2):

    pn0.on()
    print("Pin value = ", pn0.value())
    time.sleep(3)
    pn0.off()
    print("Pin value = ", pn0.value())
    time.sleep(3)

pn0 = Pin(23, pull=Pin.PULL_HOLD)
time.sleep(0.5)
print("Sleeping!")
deepsleep(10_000)

rockyrobin
Posts: 4
Joined: Fri May 14, 2021 2:07 pm

Re: Pin.PULL_HOLD with ESP32 DevKit DOIT problem - Does it work with deepsleep and Pin.OUT?

Post by rockyrobin » Sun May 16, 2021 11:41 am

Just been reading the technical docs and I think it says the pin hold feature only 'remembers' the state before, during and after deepsleep.
The actual state itself cannot be maintained during deepsleep.
Looks like i'm out of luck then!

Post Reply