golemparts/rppal

Internal pull resistors do not always work on Raspberry Pi 4B

TheBerkin opened this issue · 2 comments

It appears that attempting to activate internal pull resistors on certain pins does not work on the Raspberry Pi 4B. Specifically, I have noticed that internal pull-up resistors fail to activate when using Pin::into_input_pullup() on BCM pins 17, 27, and 22. The pins remain floating, resulting in undefined behavior on the inputs.

I tested the pins in Python using gpiozero and confirmed that they behave correctly there when using internal pull-up resistors, so the problem seems to be isolated to rppal.

I did some digging and found this C program which caught my attention. On line 117 you'll find the function used to set the internal pull resistors. It appears to have a branch with separate logic for the BCM 2711 SoC (used in the Pi 4B) that appears to modify the GPIO memory in a completely different way.

Perhaps this is an incompatibility problem?

Looks like this problem does not happen for me on a Model 3B+, so now I'm positive this is a compatibility problem.

pin 18 is also not working so would say pull-ups on RPi4 just aren't working correctly in general.