Unable to Determine Hardware Version Bcm2835

I ran into this same problem using Java with Raspbian on a Pi iii and found a posting from the Pi4J development team indicating that the trouble is that when Pi4J is automatically installed, a re-create of the wiringPi library is also installed and the copy of wiringPi in the installation package is erstwhile. I call up this is a problem with Pi iii.

Run across https://github.com/Pi4J/pi4j/issues/319

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

The suggested work effectually is to cause the Pi4J component to dynamically load the wiringPi library rather than use the erstwhile version in the Pi4J packet. This is done with a organisation properties add-on. The control line to run an awarding must include the -Dpi4j.linking=dynamic option as in:

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

I have set this using the JAVA_TOOL_OPTIONS environment variable and then that I exercise not demand to remember to specify the pick on the control line when invoking java to run my application.

export JAVA_TOOL_OPTIONS=-Dpi4j.linking=dynamic

I take a shell script that I do a source Linux command on to ready my Java surround on Raspberry Pi. It contains the post-obit directives for my Coffee surroundings.

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

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

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

Here is a brief overview well-nigh Java and the Java Virtual Machine and hardware specific libraries that utilize the Coffee Native Interface (JNI).

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

Some Coffee classes demand to access specific hardware or operating system features that are non part of the standard Java installation. The Raspberry Pi hardware is an case. This requires that a Java class that is providing access to those specific features volition demand an boosted 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 manner to admission the hardware pins of the Raspberry Pi. In gild to do so, the Pi4J classes use the wiringPi library as the mechanism to gain access to the Pi hardware. Then the Pi4J classes provide a Coffee interface to the wiringPi library which in turn provides the interface to the actual Pi hardware.

What this means is that in guild 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 and so that when the Pi4J classes needed for your application are loaded, the needed wiringPi library is also loaded.

To brand using the Pi4J library like shooting fish in a barrel to install and use, the development team included in their install a copy of the wiringPi library. Notwithstanding if in that location 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 apply a version of the wiringPi library other than the one arranged with the Pi4J class install package.

0 Response to "Unable to Determine Hardware Version Bcm2835"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel