3

I've discovered pigpio and am starting to learn to use it with Python. I thought I would use it to "discover" the pullup status of a pin before setting it, but while mode has both .set_mode() and .get_mode() methods as shown in this documentation, there is only the .set_pull_up_down() method, apparently without a corresponding "getter method".

Question: Is there a way to read the pullup status of a GPIO pin in python with, or if not, without pigpio?

If it is relevant, I have a RPi 3 and using Raspbian 4.4.21-v7+

6

It is not possible.

Page 100 of BCM2835 ARM Peripherals

GPIO Pull-up/down Register (GPPUD)

SYNOPSIS

The GPIO Pull-up/down Register controls the actuation of the internal pull-up/down control line to ALL the GPIO pins. This register must be used in conjunction with the 2 GPPUDCLKn registers.

Note that it is not possible to read back the current Pull-up/down settings and so it is the users’ responsibility to ‘remember’ which pull-up/downs are active. The reason for this is that GPIO pull-ups are maintained even in power-down mode when the core is off, when all register contents is lost.

The Alternate function table also has the pull state which is applied after a power down.

  • Bingo! Thank you for the speedy and well-reference answer! I'll be sure to consult the document before asking my next pigpio question. – uhoh Dec 17 '17 at 12:22

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.