3

Unable to determine hardware version.

I see the following error message:

expecting BCM2708 or BCM2709. If this is a genuine Raspberry Pi then please report this to projects@drogon.net. If this is not a Raspberry Pi then you are on your own as wiringPi is designed to support the Raspberry Pi.

/proc/cpuinfo

model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 57.60
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part :
0xc07
CPU revision : 5
Hardware : BCM2709
Revision : a21041
Serial : 000000005c678cec
  • So, what exactly is your question? Your software error specifically says where to report the error. This is not that place. – Jacobm001 Nov 14 '16 at 19:16
  • Quiet simply, your issue is due to an outdated linked WiringPi binary (written in C) that is included in the Python version of WiringPi. There is nothing that can be done about this. – IgorGanapolsky Dec 18 '17 at 14:31
2

I ran into this same problem using Java with Raspbian on a Pi 3 and found a posting from the Pi4J development team indicating that the problem is that when Pi4J is automatically installed, a copy of the wiringPi library is also installed and the copy of wiringPi in the installation package is old. I think this is a problem with Pi 3.

See https://github.com/Pi4J/pi4j/issues/319

Also see https://www.raspberrypi.org/forums/viewtopic.php?t=182191#p1194857

The suggested work around is to cause the Pi4J component to dynamically load the wiringPi library rather than use the old version in the Pi4J package. This is done with a system properties addition. The command line to run an application must include the -Dpi4j.linking=dynamic option as in:

java -Dpi4j.linking=dynamic <class to run>

I have set this using the JAVA_TOOL_OPTIONS environment variable so that I do not need to remember to specify the option on the command line when invoking java to run my application.

export JAVA_TOOL_OPTIONS=-Dpi4j.linking=dynamic

I have a shell script that I do a source Linux command on to set up my Java environment on Raspberry Pi. It contains the following directives for my Java environment.

export CLASSPATH="$CLASSPATH:"'/opt/pi4j/lib/*'
export JAVA_TOOL_OPTIONS="-Dpi4j.linking=dynamic"

The first directive is to set the CLASSPATH environment variable by adding to the existing CLASSPATH the directory where the Pi4J library jar files are located. The second is to provide the necessary directive to java when running an application using Pi4J. screen shot showing application behavior with and without JAVA_TOOL_OPTION

Addendum: Java classes, JVM, JNI (C Extensions) overview

Here is a brief overview about Java and the Java Virtual Machine and hardware specific libraries that use the Java Native Interface (JNI).

The Java compiler compiles the source code of Java classes into Java Virtual Machine byte code as class files. When the application is run, the Java Virtual Machine (JVM) loads the initial application class along with any additional classes needed for the application to run. In order to find the class files for the additional classes, the JVM uses the CLASSPATH list of directories to search for the additional classes.

Some Java classes need to access specific hardware or operating system features that are not part of the standard Java installation. The Raspberry Pi hardware is an example. This requires that a Java class that is providing access to those specific features will need an additional component written in C or other programming language to provide an interface to those features or functionality.

The Pi4J classes used with Java on the Raspberry Pi provide a way to access the hardware pins of the Raspberry Pi. In order to do so, the Pi4J classes use the wiringPi library as the mechanism to gain access to the Pi hardware. So the Pi4J classes provide a Java interface to the wiringPi library which in turn provides the interface to the actual Pi hardware.

What this means is that in order for the Pi4J classes to work, they require access to the wiringPi library which is loaded long with the Pi4J classes. So the JVM needs to know that the library is required and how to find it so that when the Pi4J classes needed for your application are loaded, the needed wiringPi library is also loaded.

To make using the Pi4J library easy to install and use, the development team included in their install a copy of the wiringPi library. However if there are changes to the wiringPi library the version bundled with the Pi4J classes becomes out of date.

This answer is how to trigger the Pi4J classes and the JVM to use a version of the wiringPi library other than the one bundled with the Pi4J class install package.

  • Great answer. Had searched everywhere, but finally :) – Kshitij Mar 8 '18 at 8:04
  • I got confused. After wiringPi is built, it says "To compile programs with wiringPi, you need to add: -lwiringPi to your compile line(s) To use the Gertboard, MaxDetect, etc. code (the devLib), you need to also add: -lwiringPiDev to your compile line(s)." What is it for then? – Kshitij Mar 8 '18 at 8:14
  • Sorry for the hazy question what is meant was "What is -lwiringPi added for ? " Or in other words, is it possible to compile a java class using -lwiringPi as a flag? – Kshitij Mar 8 '18 at 10:20
  • 1
    @Kshitij saxena the -l is a compile/link flag used to indicate a library needed for a program to successfully build. It is normally used with a language such as C which requires an application to be built by compiling and linking. Java uses virtual machine; Java classes are compiled to byte code. The Java Virtual Machine loads classes at run time including classes other classes depend on. The class path is how JVM finds those additional classes. Some Java classes use C extensions to access hardware functionality. The Pi4J classes is one such using wiringPi library to access Pi hardware. – Richard Chambers Mar 8 '18 at 11:38
1

I just had the same/similar issue. If you are really using an Raspberry Pi it's likely that you just need the newest version...

git clone https://github.com/Wyliodrin/wiringPi.git
cd wiringPi
./build

Maybe you did git clone already then do

cd wiringPi
git pull
./build

And it should work again even without reboot...

  • 1
    Why do you think this solves the error OP reported? The latest version of WiringPi C lib is 2.44. Python's wiringpi version, however, is 2.25 – IgorGanapolsky Dec 18 '17 at 14:33
0

You may have an old version of wiringPi.

Could you edit your post and add the result of the following command.

cat /proc/cpuinfo

You should also send that information as requested to e-mail address projects @ drogon.net

  • This is what it is displaying:- model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 57.60 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5 Hardware : BCM2709 Revision : a21041 Serial : 000000005c678cec – muk Nov 17 '16 at 10:40
  • 1
    @muk You already have been given all the information you need. You have an old version of wiringPi. – joan Nov 17 '16 at 10:50
  • 1
    Emailing the project lead will just get an auto-reply telling you that they do not support any language other than C. – IgorGanapolsky Dec 18 '17 at 14:37
0

If you are still stuck then try this.

Open wiringPi.c in the wiringPi/wiringPi folder.

Remark out the exit line only (just below the BCM Comments) ~ around line 700.

fprintf (stderr, "Raspberry Pi ONLY.\n") ;  // here for reference only
//exit (EXIT_FAILURE) ;

Save this, then go back up to the wiringPi folder and do a ./build

Then try gpio readall

0

This error happens with old wiringPi package. Unfortunately, sudo apt-get update && sudo apt-get upgrade does not update the wiringPi.

On original wiringPI website there is manual upgrade procedure for wiringPi. Both "Plan A" and "Plan B" work.

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.