machine.Pin.pull_down ?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
bellad
Posts: 83
Joined: Tue May 14, 2019 1:47 pm

machine.Pin.pull_down ?

Post by bellad » Wed May 20, 2020 8:13 am

Hello,
i have pin out from esp32 ( 1=activ ) , go to stm32 in pin
on stm32 , the pin in , i put machine.Pin.pull_down ? or other
esp32 ( pin out ) -> stm32 (pin in )
thank

SpotlightKid
Posts: 420
Joined: Wed Apr 08, 2015 5:19 am

Re: machine.Pin.pull_down ?

Post by SpotlightKid » Wed May 20, 2020 1:57 pm

Sorry, I don't understand a word of what you have written. Could you try to rephrase it?

bellad
Posts: 83
Joined: Tue May 14, 2019 1:47 pm

Re: machine.Pin.pull_down ?

Post by bellad » Mon May 25, 2020 2:09 pm

sorry for the delay
on my esp32 :

Code: Select all

rel= machine.Pin(16, machine.Pin.OUT)
if a == 0:
rel.value=1
else:
rel.value=0
with a physical wire esp32 to stm32 on PE8

Code: Select all

if PE8 == 1 :
print('ok')
else:
print('no good')
for PE8 declare machine.Pin.pull_down or machine.Pin.pull_up ?

User avatar
dhylands
Posts: 3481
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: machine.Pin.pull_down ?

Post by dhylands » Mon May 25, 2020 4:03 pm

Pull up and pull down are only applicable to input pins. Output pins are driven high or driven low, so pullups don't apply. I think you might be able to use pull up on an open drain output, but that's the only case I can think of tht makes sense.

According to the documentation: http://docs.micropython.org/en/latest/l ... achine.Pin
something like this:

Code: Select all

p = machine.Pin('PE8', mode=machine.Pin.IN, pull=machine.Pin.PULL_UP)

bellad
Posts: 83
Joined: Tue May 14, 2019 1:47 pm

Re: machine.Pin.pull_down ?

Post by bellad » Thu May 28, 2020 2:26 pm

thank you ,
i hope " p = machine.Pin('PE8', mode=machine.Pin.IN, pull=machine.Pin.PULL_DOWN)
because i input +3.3v and 0v when nothing

chrismas9
Posts: 149
Joined: Wed Jun 25, 2014 10:07 am

Re: machine.Pin.pull_down ?

Post by chrismas9 » Fri May 29, 2020 12:40 am

When you drive an input from a push pull source you don't need a pull-up or pulldown, just a normal high impedance input. You only need a pull resistor if the driving source can become high impedance, eg open drain or tristate.

If the ESP32 output is push pull, always either 0V or 3.3V, then the STM32 input does not need a pull-up or pulldown resistor.

The exception would be if the ESP32 went into a sleep mode where its outputs are disabled. I don't know if that happens.

Post Reply