WiringPi issue after upgrading to Pi4

HI,
I have DietPi 7.0.2 successful working on a Raspberry Pi 3b. I moved the SD card to a Raspberry Pi 4 2G and all seemed to work. However I have a piece of code that uses Wiring Pi. I think Wiring Pi must be Raspberry Pi specific, since my code is not working. I have tried uninstalling Wiring Pi and reinstalling, but it is not installing properly.

I get the following when I run gpio -v

root@DietPi:/home/dietpi# gpio -v
gpio version: 2.46
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: 00, Revision: 02, Memory: 0MB, Maker: Sony 
  * Device tree is enabled.
  *--> Raspberry Pi 4 Model B Rev 1.2
  * This Raspberry Pi supports user-level GPIO access.

I think the Type and memory are reported incorrectly.

and when I run GPIO readall, I get:

root@DietPi:/home/dietpi# gpio readall
Oops - unable to determine board type... model: 17

This is meant to bring up a map of the GPIO pins with WiringPi and GPIO pin numbering.

Is anyone able to help me get WiringPi reinstalled correctly please.

Ok, I think I have found the issue, DietPi installs WiringPi version 2.46. However the Raspberry Pi4, requires WiringPi version 2.52

There are upgrade instructions on the WiringPi website http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/

cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

Will this work with the DietPi implementation?
Thanks.

it might not gonna work as DietPi will install WiringPi to /usr/local/bin while the deb package will be installed to /usr/bin

I would recommend to uninstall the DietPi version using dietpi-software + rm /usr/local/bin/gpio + reboot

Once done install the dep package afterwards

However, do a backup before. In case needed, you could restore.

[hr]
MichaIng
I know WiringPi deprecated http://wiringpi.com/wiringpi-deprecated/
But should we switch to the dep version 2.52 to allow support on RPi4?

Thanks for this, I have followed these instruction, then I did apt purge wiringpi to remove everything. I rebooted and checked it had been removed

root@DietPi:/home/dietpi# gpio -v
bash: /usr/bin/gpio: No such file or directory

So I then installed again with apt install wiringpi which resulted in this:

root@DietPi:/home/dietpi# apt install wiringpi
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  wiringpi
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 52.9 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 https://archive.raspberrypi.org/debian buster/main armhf wiringpi armhf 2.50 [52.9 kB]
Fetched 52.9 kB in 0s (168 kB/s)    
Selecting previously unselected package wiringpi.
(Reading database ... 47327 files and directories currently installed.)
Preparing to unpack .../wiringpi_2.50_armhf.deb ...
Unpacking wiringpi (2.50) ...
Setting up wiringpi (2.50) ...

So this looks like version 2.5 is installed, this still needs updating to v2.52. However when I check the version with gpio -v I get

root@DietPi:/home/dietpi# gpio -v
gpio version: 2.46
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: (null), Revision: 02, Memory: 0MB, Maker: Sony 
  * Device tree is enabled.
  *--> Raspberry Pi 4 Model B Rev 1.2
  * This Raspberry Pi supports user-level GPIO access.

Which shows version 2.46 installed. I’ve tried then upgrading to 2.5.2 with

cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

but it always stays at version 2.46. I tried this same procedure on a RPi4 with Raspberry Pi OS installed and it worked as expected.

Any idea what is going on?

looks like it depends how stuff is installed. If you install self compiled version 2.46 first, you still get this version even if it was uninstalled and a different version get installed. Maybe there are left overs leading to this


EDIT:
OK I found more files that would need to be removed before you can install the deb file

rm /usr/lib/libwiringPi*
rm /usr/local/lib/libwiringPi*

I did a comparison after compiling 2.46 and found these sym links

/usr/local/lib/
/usr/local/lib/libwiringPi.so -> libwiringPi.so.2.46
/usr/local/lib/libwiringPi.so.2.46
/usr/local/lib/libwiringPiDev.so -> libwiringPiDev.so.2.46
/usr/local/lib/libwiringPiDev.so.2.46



/usr/lib/
/usr/lib/libwiringPi.so -> /usr/local/lib/libwiringPi.so.2.46
/usr/lib/libwiringPiDev.so -> /usr/local/lib/libwiringPiDev.so.2.46

after removing them, the deb file installation was successful and showing correct version.

MichaIng
We definitely should rework WiringPi removal process.

Perfect, all working well now. Thank you very much for your time on this. really appreciate it. :smiley:

thx for confirmation, good it is working now. :sunglasses: