I can't seem to set the pull-up resistor mode on the PI4 with most methods I try. I have tried: C# (the new System.Device.Gpio interface), WiringPi (using a C# abstraction), and wiringPi command line interface. Setting the pin mode to input or output always works, just not changing the pull up mode. If I use an example python script, the mode does change, so the hardware is likely not broken.

Steps to reproduce:

root@raspberrypi:/home/pi# gpio -g mode 24 in
root@raspberrypi:/home/pi# gpio -g mode 24 up
root@raspberrypi:/home/pi# gpio -g read 24 

There's nothing connected to BCM Pin 24, so the result should be 1. Same result with WiringPi 2.50 and 2.52. Same result on other pins.


I can confirm that result with version 2.52 of wiringPi, setting the pulls does not work on the Pi4B.

wiringPi is now deprecated.


You could contact the author but do not expect a response.

  • Yes, I've seen that. What confuses me is that also the new .NET interface doesn't work, and I don't think that one uses wiringpi internally. – PMF Oct 6 '19 at 15:53
  • I have no idea what .NET uses internally. Presumably it has not been updated for the Pi4B either (the Pi4B has a new GPIO design with a different way of setting the pulls). – joan Oct 6 '19 at 15:57
  • Good hint. Luckily, the .NET code is open source: github.com/dotnet/iot It has several Driver modules, the default one is called RaspberryPi3Driver (sic!). There's one for libgpiod, but that one explicitly does not support setting the pulls. You don't by chance know what would need to be changed here: github.com/dotnet/iot/blob/master/src/System.Device.Gpio/System/… do you ;-) ...? – PMF Oct 6 '19 at 17:10
  • You need to change setInputPullMode to recognise it is running on a BCM2711 and then use updated code to set the pulls. This shows how I do it in pigpio. github.com/joan2937/pigpio/blob/master/pigpio.c#L8785 – joan Oct 6 '19 at 17:38
  • That's a start. Will take me some time to investigate this, though. – PMF Oct 6 '19 at 17:53

I have run into the very same issue, setting pull-up with latest wiringPI (2.52) on the 4B+ does not work. I solved it by using 'raspi-gpio' utility ( https://github.com/RPi-Distro/raspi-gpio ) to just activate the pull-ups via commandline, which worked fine with my 4B+ Just be aware that raspi-gpio do use 'BCM' numbering. So in your case for GPIO.24 you need to use '13'; the raspi-gpio line would be 'raspi-gpio set 13 pu'

hope that helps


Although WiringPi is discontinued there is an unofficial patch: https://github.com/neuralassembly/raspi/blob/master/wp-pi4.patch

It worked great on my RaspberryPi4 after that.


While working on the next version of Pi4J, Robert Savage found a solution by using the unofficial version of WiringPi that be found on GitHub in WiringPi > WiringPi.

Remove the existing WiringPi installation, clone the GitHub project and build it like this:

echo "--------------------------------------------"
echo "Uninstalling any existing WiringPi versions "
echo "--------------------------------------------"
sudo apt-get remove wiringpi -y
sudo apt-get --force-yes --yes install git-core gcc make
echo "--------------------------------------------"
echo "Cloning latest WiringPi sources from repo   "
echo "--------------------------------------------"
cd /opt/pi4j
git clone https://github.com/WiringPi/WiringPi --branch master --single-branch wiringpi
cd /opt/pi4j/wiringpi
echo "--------------------------------------------"
echo "Building and installing WiringPi library"
echo "--------------------------------------------"
sudo ./build uninstall
sudo ./build clean
sudo ./build

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.