[SOLVED] Pin.PULL_UP not working?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

[SOLVED] Pin.PULL_UP not working?

Post by pythoncoder » Wed Jun 09, 2021 12:32 pm

Reading forum posts this must have worked in the past. Yet I've tested today on two boards - including the reference board - with the same floating pin result. Adding physical resistors fixed the problem. Am I missing something or has a regression crept in? I'm running the latest daily build. The session below was on the reference board with all pins unconnected.

Code: Select all

MPY: soft reboot
MicroPython v1.15 on 2021-06-09; ESP32 module with ESP32
Type "help()" for more information.
>>> from machine import Pin
>>> 
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== nxt = Pin(36, Pin.IN, Pin.PULL_UP)  # Move to next control
=== sel = Pin(37, Pin.IN, Pin.PULL_UP)  # Operate current control
=== prev = Pin(38, Pin.IN, Pin.PULL_UP)  # Move to previous control
=== increase = Pin(39, Pin.IN, Pin.PULL_UP)  # Increase control's value
=== 
>>> nxt()
0
>>> sel()
0
>>> prev()
0
>>> increase()
0
>>> 
[EDIT]
It is something to do with the specific pins, which are brought out on the TTGO T-Display but not on the reference board. On the latter, if I specify pin 18 or 19 which are brought out, the pullups work.

Does the MicroPython firmware fully support pins 36-39? The pins work, but the internal pullups don't.
Peter Hinch
Index to my micropython libraries.

User avatar
RobH
Posts: 91
Joined: Fri Mar 23, 2018 3:37 pm
Location: Netherlands
Contact:

Re: Pin.PULL_UP not working?

Post by RobH » Wed Jun 09, 2021 1:25 pm

Hello Peter,
I've a TTGO-T8 V1.7 ESP32 board here with Pins 36 and 39 brought out (according to the Pin layout picture). With PULL_UP Pin 36 gives value 0 like with you, but PIn 39 gives value 1 with PULL_UP and value 0 when specified with PULL_DOWN.
BTW On the PCB these 2 Pins are marked VP and VN respectively.
Rob.

Shards
Posts: 39
Joined: Fri Jun 25, 2021 5:14 pm
Location: Milton Keynes, UK

Re: Pin.PULL_UP not working?

Post by Shards » Wed Jun 30, 2021 7:54 pm

I had just this issue this morning when testing a PCB design and checked the Expressif documentation and found: 'GPIO34-39 can only be set as input mode and do not have software pullup or pulldown functions.'

So Pin.PULL_UP is never going to work for those GPIO pins and external pull ups are necessary.

User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

Re: Pin.PULL_UP not working?

Post by water » Thu Jul 01, 2021 6:51 pm

GPIO-34, GPIO-35, GPIO-36, GPIO-39 input only pins, These pins don’t have internal pull-ups or pull-down resistors.

Image

https://randomnerdtutorials.com/esp32-p ... nce-gpios/

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Pin.PULL_UP not working?

Post by pythoncoder » Fri Jul 02, 2021 11:25 am

You are right, as @Shards has pointed out. The link you posted is a useful resource.
Peter Hinch
Index to my micropython libraries.

Post Reply