1

I'm following this tutorial to use the RPi B+ as a parallel EEPROM programmer. In the Python code in the tutorial, it sets all of the output pins with pull down resistors

GPIO.setup (10, GPIO.OUT, pull_up_down = GPIO.PUD_DOWN) #A0
GPIO.setup (9,  GPIO.OUT, pull_up_down = GPIO.PUD_DOWN) #A1
...

This makes sense because the low voltage threshold is 0.8 volts so this makes sure the pins don't float. However, when I run similar code on my Pi (on all pins I have tested (pin 15 & 16 with GPIO.BOARD mode set) I receive the following error.

Traceback (most recent call last):
  File "program.py", line 19, in <module>
    GPIO.setup (outputEnablePin, GPIO.OUT, pull_up_down = GPIO.PUD_DOWN)
VlueError: pull_up_down parameter is not valid for outputs 

I assume you can use the internal pull-down resistors on output pins because it is used in the tutorial code and there are several positive comments about the tutorial. So does anyone know why I'm facing this error and if there is a way to fix it?

Additionally, he uses pin 15 with a pull-down in his code which corresponds to pin 22 as he uses GPIO.BCM, so we are using the same pin.

  • This is a nonsense. It makes no sense to enable pull-up or pull-down on an output pin. I am unsure if the SOC would even permit this, but even if it did it would make ABSOLUTELY no difference (the effective impedance of a GPIO output is <50Ω). – Milliways Jul 19 '17 at 9:53
  • @Milliways Not even if the output is going into an active low pin in the EEPROM? – Dan13_ Jul 19 '17 at 10:01
  • What is an "active low pin"? The fact remains that connecting a ~50kΩ resistor in parallel with 50Ω (even if it was possible) would make no practical difference. – Milliways Jul 19 '17 at 10:06
  • 1
    @Milliways An active low pin is a pin that is in the on state (in the EEPROM) when its voltage is logic low, usually tied to ground to avoid interference, but in this case it is on whilst the voltage is below 0.8v – Dan13_ Jul 19 '17 at 10:10
1

The term "pull" is used in the tutorial, but not with respect to the internal pull-up or pull-down resistors. The author appears simply to be using the term "pull up" instead of "driven high", which is more appropriate for an output.

Pulls are only for undriven signals, which most commonly would be inputs. Outputs are driven (unless they're open collector, for example), so they do not need pull-ups or pull-downs and in fact the effect of any such resistors is negated by the driven state itself.

In short, no, you cannot enable the internal pulls for output pins, nor would there be any point in doing so because they can never float.

If the source of the confusion is that you thought using a pull-up/pull-down was the proper way to set the state of an output, then here's the correct way:

GPIO.setup(10, GPIO.OUT, initial=GPIO.HIGH)  # make pin initially high output
GPIO.output(10, GPIO.LOW)    # set output low
GPIO.output(10, GPIO.HIGH)   # set output high again

You can also just use 0 and 1 as the second parameter in the GPIO.output() call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.