Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Hardware : BCM2835 error on RaspberryPi B+ #319

Closed
Azn9 opened this issue Feb 24, 2017 · 54 comments
Closed

Hardware : BCM2835 error on RaspberryPi B+ #319

Azn9 opened this issue Feb 24, 2017 · 54 comments
Assignees
Labels

Comments

@Azn9
Copy link

Azn9 commented Feb 24, 2017

Unable to determine hardware version. I see: Hardware : BCM2835
,

  • 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 ONLY.

I use a RaspberryPi B+.

@dyercode
Copy link

Also seeing this on a Zero and a B+. It was previously working on the B+.

Unable to determine hardware version. I see: Hardware   : BCM2835
,
 - 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 ONLY.
user@system ~> gpio -v
gpio version: 2.38
Copyright (c) 2012-2017 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi Zero, Revision: 03, Memory: 512MB, Maker: Sony
  * Device tree is enabled.
  *--> Raspberry Pi Zero Rev 1.3
  * This Raspberry Pi supports user-level GPIO access.

@savageautomate
Copy link
Member

It looks like this was a change as of Kernel v4.8. WiringPi did add support for this change in December. See this commit: Pi4J/wiringPi@b1dfc18#diff-672071e4cd5d0146a80fb586c87c38e1R723

Can you please try Pi4J Version 1.2-SNAPSHOT to see if its working on your systems?
http://pi4j.com/download.html

The SNAPSHOT builds are compiled against the latest WiringPi builds.

Maybe we need to go back and produce a new release of v1.1 source base compiled with the latest WiringPi?

Thanks, Robert

@savageautomate savageautomate self-assigned this Feb 25, 2017
@savageautomate
Copy link
Member

One other option if you need to use the existing v1.1 release of Pi4J is to use the dynamic linking option where Pi4J is dynamically linked to WiringPi rather than the default static linking.

Build and install the latest WiringPi on your system.
http://wiringpi.com/download-and-install/

Now when starting your Java app, you need to set the system property of "pi4j.linking=dynamic"

Here is an example command line where I'm defining the system property via command line:
sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample

Note that I also define the system property of pi4j.debug so that I can verify that Pi4J comes up and uses the dynamic linking.

My output looks something like this:

^Cpi@rpi3b:~/pi4j-dev $ sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample
<--Pi4J--> GPIO Blink Example ... started.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Attempting to load [libpi4j.so] using path: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] loaded successfully using embedded resource file: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
 ... the LED will continue blinking until the program is terminated.
 ... PRESS <CTRL-C> TO STOP THE PROGRAM.

Thanks, Robert

@dyercode
Copy link

Both the snapshot version and the dynamic linking on 1.1 worked for me.

@savageautomate
Copy link
Member

@dyercode ,

Thanks for the update and glad to hear both alternate options are working!

@patriciowallace
Copy link

Hi, I use the static option because is more portable for me
the static option with the snapshot 1.2 is not working.

Any other sugestion ?

Regards
Patricio

@savageautomate
Copy link
Member

@patriciowallace

Static + 1.2-SNAPSHOT should be working!

Please make sure to download the latest 1.2-SNAPSHOT build here:
http://pi4j.com/download.html

Thanks, Robert

@patriciowallace
Copy link

I re built all the project again with the 1.2 snapshot version, I am sure that the j4pi is the 1.2

the result

Unable to determine hardware version. I see: Hardware : BCM2835
,

  • 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 ONLY.

Same result.

Any sugestions.

Regards
Patricio

@patriciowallace
Copy link

I use the core.jar and device.jar if it helps

Regards
Patricio

@patriciowallace
Copy link

any answer please

@savageautomate
Copy link
Member

I have not had a chance to test it here locally yet to confirm. Which Pi model are you working with?

@Azn9
Copy link
Author

Azn9 commented Mar 3, 2017

Hi I've tested pi4j 1.2 snapshot, and it works fine on raspi B+!

@jesperldk
Copy link

1.2 snapshot works on raspi 3.
When will we have a proper release?
And perhaps you could update the home page right away - I am sure this is confusing many new users as my self.
Thanks! :-)

@zzApotheosis
Copy link

zzApotheosis commented Apr 30, 2017

Using

Raspberry Pi 3 - Model B
Pi4J 1.1

Problem

Looks like I'm getting the same problem now. It literally just started happening after a Raspberry Pi reboot. I'm using the Raspberry Pi 3 - Model B.

The only difference I can think of between reboots is that I disabled some interfaces in Raspbery Pi Configuration (disabled Camera, I2C, and Serial). I don't really see how disabling those interfaces would mess up my hardware version.

Edit 30 April 2017

I just installed a fresh installation of Raspbian and now I have no problems running my project on Pi4J 1.1. Pretty weird. I still have no idea what could be causing it, but I also suspect that it may be a bug in wiringPi and not Pi4J.

I'd also like to point out that running the command "cat /proc/cpuinfo" echoes the hardware version near the bottom of the dialog. After a fresh installation of Raspbian, it reads BCM2709, the way Pi4J/wiringPi likes it. After doing a "sudo apt-get update" and "sudo apt-get upgrade" and restarting the device, the hardware version reads BCM2835.

@NorthFred
Copy link

Problem still persists on Raspberry Pi 3 (B) with the Pi4J 1.2 Snapshot.
Fresh image: Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26
Hardware is still detected as BCM2835.

@vinny4
Copy link

vinny4 commented May 9, 2017

After updating my rpi couple of days ago - i have this hardware version now
Hardware : BCM2835
Revision : a22082
Serial : 0000000056f0096a
with kernel version Linux XXXRPi 4.9.25-v7+ #995 SMP Thu May 4 15:52:25 BST 2017 armv7l GNU/Linux.

But the problem still persists.
its really annoying now :(

@NorthFred
Copy link

NorthFred commented May 10, 2017

The only reasonable solution so far is to downgrade the kernel to v.4.4.49.

Can be found here:
raspberrypi/firmware@4ff0432

@vkbarshah
Copy link

Thanks to savageautomate,
i was troubling with pi4j library for blinking led on pi 3 B.when i read your comment on BCM2835 and snapshot it really help full for me.Now,i am able to work with pi4j library.Moreover,i like your work keepit up('_')...

@kisdaniel
Copy link

I also had a same issue with raspberry pi 3, pi4j 1.1, and 4.9.24-v7 linux kernel version.

gpio -v
gpio version: 2.44
Copyright (c) 2012-2017 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

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

uname -a
Linux garazs 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux

After upgrading to pi4j 1.2-SNAPSHOT this problem disappeared.

When will be available 1.2 as a release?

ndrone added a commit to ndrone/HomeAutomation that referenced this issue May 23, 2017
@RGeorgy
Copy link

RGeorgy commented May 26, 2017

Thanks to the team.
I have done some simple tests with pi4j snapshot 1.2 - For me it seems to work so far!
I am using Raspberrry Pi3B Upgraded and updated 26th of May 2017.
Simply exchanged the main pi4j...jar files in my library.
Best regards

@duckie96
Copy link

Hi, noob needing some help please.
When I issue the gpio command, I get the error as above.

pi@piname:~ $ gpio -g write 4 1
Unable to determine hardware version. I see: Hardware : BCM2835
,

  • 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 ONLY.

It is a rea pi.

pi@study:~ $ cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7

Hardware : BCM2835
Revision : 100000e
Serial : 00000000765f50df

I upgraded pi4j, as mentioned above, no effect.

pi@study:~ $ dpkg -l | grep pi4j
ii pi4j 1.2~SNAPSHOT all Java library for IO access on the Raspberry Pi platform

I am using a straightforward php page, to issue the gpio command.

Not sure how to go forward with this.
Please any advice would be appreciated.

@duckie96
Copy link

Ahh got it, re installed wiringPi. . All sorted now.

@manorius
Copy link

The only thing that worked for me is the solution provided by neuralassembly here: https://github.com/WiringPi/WiringPi-Python/issues/47

camueller added a commit to camueller/SmartApplianceEnabler that referenced this issue Jun 5, 2017
@camueller
Copy link

Using a fresh install 2017-04-10-raspbian-jessie-lite.img followed by "apt-get update" and "apt-get upgrade" all I have to do is switching to pi4j 1.2-SNAPSHOT. Without pi4j 1.1 I get the "Unable to determine hardware version. I see: Hardware : BCM2835" error.
Please consider a release of pi4j 1.2 soon!

pi@raspberrypi:/app $ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 1
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 2
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 3
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

Hardware : BCM2835
Revision : a02082
Serial : 000000004190e153

@SamOrozco
Copy link

Using the snapshot fixed this issue for me.

@ricardojlrufino
Copy link

ricardojlrufino commented Mar 5, 2018

I get a filesystem error (EXT4-fs error) and hangs raspberry when i use PWM and SPI
Normal GPIO its working using 1.2-SNAPSHOT

@eitch
Copy link
Member

eitch commented Mar 5, 2018

Is your app running as root? Sadly PWM needs root access otherwise it hangs.

@ricardojlrufino
Copy link

Is your app running as root? Sadly PWM needs root access otherwise it hangs.

Running as ROOT worked... thanks

@DRChess
Copy link

DRChess commented Mar 18, 2018 via email

@DRChess
Copy link

DRChess commented Mar 19, 2018 via email

@BILLyTheLiTTle
Copy link

How can I get 1.2-SNAPSHOT from Gradle repository?

@hemantmandge
Copy link

I am facing same issue with Pi4J1.1.

Unable to determine hardware version. I see: Hardware : BCM2835
,

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 ONLY.

As suggested on forum I tried to execute program with to Pi4J 1.2-SNAPSHOT. Error went away but GPIO output not working.

Can somebody suggest some other approach.

@BILLyTheLiTTle
Copy link

@hemantmandge
Are you sure you are doing everything all right. Use the "gpio readall" while you are communicating with the pin and see if you have set the out mode and 1 value at the right pin. I suggest to start playing with the terminal first (http://wiringpi.com/the-gpio-utility/)

@hemantmandge
Copy link

Hi,
Yes I am doing everything right.
I used program at following link which uses Pi4j. It did not work
http://agilerule.blogspot.in/2016/05/iot-spring-boot-and-pi4j-integration.html

I even tried to use sample provided with pi4j 1.2 snapshot zip. The program did not give any error as such but failed to operate GPIO pin.

Just to give further input, I tried python program and it is working perfectly fine.

@BILLyTheLiTTle
Copy link

Have you tried the wiringPi utility? Is it working with it?

@ghost
Copy link

ghost commented Apr 26, 2018

Thanks is now available with apt-get:
1- Remove existing wiringpi

$ sudo apt-get purge wiringpi
$ hash -r

2- Install wiringpi
$ sudo apt-get install wiringpi
3- Check the installation

$ gpio -v
$ gpio readall

@daabutts
Copy link

I'm having the "I see: Hardware: BCM2835 - expecting BCM2708 or BCM2709" issue. I've tried the same boot SD in a pi2, pi3 B, and pi3B+. All exactly the same problem.

$ gpio readall
this seems to work and lists all the GPIO pins...

$ 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: Pi 3, Revision: 02, Memory: 1024MB, Maker: Embest

  • Device tree is enabled.
    *--> Raspberry Pi 3 Model B Rev 1.2
  • This Raspberry Pi supports user-level GPIO access.

$ pi4j -v

        THE Pi4J PROJECT

VERSION : 1.2-SNAPSHOT
TIMESTAMP : 2018-04-23 04:22:34

Here are the commands I used to install:
sudo apt-get purge wiringpi
hash -r
sudo apt-get install git-core
cd ~
git clone git://git.drogon.net/wiringPi
cd ~/wiringPi
git pull origin
./build
gpio -v
gpio readall
cd ~
pi4j -v
//this command doesn't get the latest for some reason
curl -s get.pi4j.com | sudo bash
//use this instead:
get the file from here http://get.pi4j.com/download/pi4j-1.2-SNAPSHOT.deb
sudo apt-get remove pi4j
curl -s get.pi4j.com/uninstall | sudo bash
sudo dpkg -i pi4j-1.2-SNAPSHOT.deb
pi4j -v

Here is the run command:
cmd : cd '/home/pi/NBPs//eB'; 'sudo' '/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/java' -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:53030 -Dfile.encoding=UTF-8 -Djava.library.path='lib' -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' -jar /home/pi/NBPs//eB/dist/eB.jar
running Gui**
loading
Aug 17, 2018 5:10:03 PM com.pi4j.util.NativeLibraryLoader load
FINE: Attempting to load [libpi4j.so] using path: [/lib/libpi4j.so]
Aug 17, 2018 5:10:04 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Aug 17, 2018 5:10:04 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] loaded successfully using embedded resource file: [/lib/libpi4j.so]
Unable to determine hardware version. I see: Hardware: BCM2835,

The program crashes on the Java line:
final GpioController gpio = GpioFactory.getInstance();

THEN I FOUND the problem: Solution:
In my NetBeans project, the Pi4J library was referencing 1.1 instead of 1.2.
Problem solved.
Hope this helps someone.

@dersch81
Copy link

Had fixed this by changing the Kernel from 4.9.xx to 4.4.47. Is it fixed by newer Kernel Version?

@PauloBrasko
Copy link

Solution that worked for me: I am using Netbeans, so I right-clicked in the project's name >> properties >> Categories: Run >> VM options: -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*'
Running again my project I got no error and the program was doing what was expected.

cweitkamp added a commit to cweitkamp/openhab-addons that referenced this issue Feb 26, 2019
Without this dependency the pi4j library did not work on my Raspberry Pi Model 3 B+.
Unfortunately there is another issue Pi4J/pi4j-v1#319 which can be resolved by updating to pi4j release 1.2 (not yet released).

Also-by: Michael Rumpf <michael@rumpfonline.de> (github: mrumpf)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
wborn pushed a commit to openhab/openhab-addons that referenced this issue Feb 26, 2019
Without this dependency the pi4j library did not work on my Raspberry Pi Model 3 B+.
Unfortunately there is another issue Pi4J/pi4j-v1#319 which can be resolved by updating to pi4j release 1.2 (not yet released).

Also-by: Michael Rumpf <michael@rumpfonline.de> (github: mrumpf)
Also-by: Wouter Born <github@maindrain.net>
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Pshatsillo pushed a commit to Pshatsillo/openhab-addons that referenced this issue Jun 19, 2019
Without this dependency the pi4j library did not work on my Raspberry Pi Model 3 B+.
Unfortunately there is another issue Pi4J/pi4j-v1#319 which can be resolved by updating to pi4j release 1.2 (not yet released).

Also-by: Michael Rumpf <michael@rumpfonline.de> (github: mrumpf)
Also-by: Wouter Born <github@maindrain.net>
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Pshatsillo <pshatsillo@gmail.com>
ne0h pushed a commit to ne0h/openhab-addons that referenced this issue Sep 15, 2019
Without this dependency the pi4j library did not work on my Raspberry Pi Model 3 B+.
Unfortunately there is another issue Pi4J/pi4j-v1#319 which can be resolved by updating to pi4j release 1.2 (not yet released).

Also-by: Michael Rumpf <michael@rumpfonline.de> (github: mrumpf)
Also-by: Wouter Born <github@maindrain.net>
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Maximilian Hess <mail@ne0h.de>
@pvsmian
Copy link

pvsmian commented Jun 24, 2020

One other option if you need to use the existing v1.1 release of Pi4J is to use the dynamic linking option where Pi4J is dynamically linked to WiringPi rather than the default static linking.

Build and install the latest WiringPi on your system.
http://wiringpi.com/download-and-install/

Now when starting your Java app, you need to set the system property of "pi4j.linking=dynamic"

Here is an example command line where I'm defining the system property via command line:
sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample

Note that I also define the system property of pi4j.debug so that I can verify that Pi4J comes up and uses the dynamic linking.

My output looks something like this:

^Cpi@rpi3b:~/pi4j-dev $ sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample
<--Pi4J--> GPIO Blink Example ... started.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Attempting to load [libpi4j.so] using path: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] loaded successfully using embedded resource file: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
 ... the LED will continue blinking until the program is terminated.
 ... PRESS <CTRL-C> TO STOP THE PROGRAM.

Thanks, Robert

Would this dynamic linking work with PI4J v1.0 as well?

@savageautomate
Copy link
Member

One other option if you need to use the existing v1.1 release of Pi4J is to use the dynamic linking option where Pi4J is dynamically linked to WiringPi rather than the default static linking.
Build and install the latest WiringPi on your system.
http://wiringpi.com/download-and-install/
Now when starting your Java app, you need to set the system property of "pi4j.linking=dynamic"
Here is an example command line where I'm defining the system property via command line:
sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample
Note that I also define the system property of pi4j.debug so that I can verify that Pi4J comes up and uses the dynamic linking.
My output looks something like this:

^Cpi@rpi3b:~/pi4j-dev $ sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample
<--Pi4J--> GPIO Blink Example ... started.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Attempting to load [libpi4j.so] using path: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] loaded successfully using embedded resource file: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
 ... the LED will continue blinking until the program is terminated.
 ... PRESS <CTRL-C> TO STOP THE PROGRAM.

Thanks, Robert

Would this dynamic linking work with PI4J v1.0 as well?

No, unfortunately not.

And the custom library loader does not appear to have any logic to load alternate libs.
https://github.com/Pi4J/pi4j/blob/release/1.0/pi4j-core/src/main/java/com/pi4j/util/NativeLibraryLoader.java

@pvsmian
Copy link

pvsmian commented Jun 24, 2020

One other option if you need to use the existing v1.1 release of Pi4J is to use the dynamic linking option where Pi4J is dynamically linked to WiringPi rather than the default static linking.
Build and install the latest WiringPi on your system.
http://wiringpi.com/download-and-install/
Now when starting your Java app, you need to set the system property of "pi4j.linking=dynamic"
Here is an example command line where I'm defining the system property via command line:
sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample
Note that I also define the system property of pi4j.debug so that I can verify that Pi4J comes up and uses the dynamic linking.
My output looks something like this:

^Cpi@rpi3b:~/pi4j-dev $ sudo java -Dpi4j.debug -Dpi4j.linking=dynamic -classpath .:classes:/opt/pi4j/lib/'*' BlinkGpioExample
<--Pi4J--> GPIO Blink Example ... started.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Attempting to load [libpi4j.so] using path: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] loaded successfully using embedded resource file: [/lib/raspberrypi/dynamic/libpi4j.so]
Feb 25, 2017 3:41:26 PM com.pi4j.util.NativeLibraryLoader load
FINE: Library [libpi4j.so] has already been loaded; no need to load again.
 ... the LED will continue blinking until the program is terminated.
 ... PRESS <CTRL-C> TO STOP THE PROGRAM.

Thanks, Robert

Would this dynamic linking work with PI4J v1.0 as well?

No, unfortunately not.

And the custom library loader does not appear to have any logic to load alternate libs.
https://github.com/Pi4J/pi4j/blob/release/1.0/pi4j-core/src/main/java/com/pi4j/util/NativeLibraryLoader.java

Thank you. My question btw was prompted by some migration issues going from 1.0 to 2.0, so I was trying to avoid it entirely!

  • SerialDataListener changed to SerialDataEventListener, mandating code changes
  • Serial.writeln(msg) isn't working the same way with a ttyxxx modem. Through trial and error, Serial.write((msg+"\r").getBytes()) seems to be the equivalent

@FDelporte
Copy link
Member

Would it make sense to add a writeln(String msg) method in V2 to the IODataWriter?

https://github.com/Pi4J/pi4j-v2/blob/master/pi4j-core/src/main/java/com/pi4j/io/IODataWriter.java

@savageautomate
Copy link
Member

Closed.

Original issue resolved in v1.2.

Please report any Pi4J v2 issues to the Pi4J V2 repository.
https://github.com/Pi4J/pi4j-v2/issues

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests