Comments (13)
@FDelporte that's exactly the one I'm using. It seems to work very well. It appears to probe what the hardware can actually do at run time and then compile for that. In fact, part of its probing is what's causing issues with pigpio's stealing of signals (another bug I'm close to fixing).
from pi4j-v2.
If the error is not in the Pi4J core library, then its possible its either in the PiGpio Provider Plugin or the PiGpio JNI (wrapper) Library code.
- Are you using the native or remote (TCP socket) implementation of PiGpio?
See if you can trace the variables here and make sure all the input parameters are still correct and length
has not been overwritten/modified.
Pi4J PiGpio Provider Plugin
Pi4J PiGpio JNI (Wrapper) Library
Then .. depending on if using native PiGpio or remote via TCP ...
TCP/SOCKET IMPL:
NATIVE (JNI WRAPPER):
NATIVE C IMPL
from pi4j-v2.
It's in the native library rather than running over TCP. Looks like the JNI wrapper is the place to enable tracing and see what happens. I'm not that familiar with how to set the debugging though. If I recall correctly you need some sort of library (slf4j-simple rings a bell) and to set a Java property. Could someone remind me of the details?
from pi4j-v2.
Well it looks like the instrumented trace info is not really printing out the actual length and offset so you may have to add you own messages to print out the length
and offset
values.
Yes, include slf4j-simple JAR in your dependencies and set this system property to print log/debug/trace message to the console.
// configure default lolling level, accept a log level as the fist program argument
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "TRACE");
Example:
from pi4j-v2.
Well this is exciting! I had to download and then rebuild all of pi4j-v2 because of updates in the system (not that I blame anyone, it's a work in progress). However, once it was all rebuilt I couldn't get the result to run.
Interesting issue and probably worth raising elsewhere. I was building on a 64-bit Pi 4 running the 64-bit OS. It did produce the 32-bit binaries for the Pi zero I'm running on but it wasn't compiled for the v6 architecture so it didn't work! This is probably a bug that needs fixing. In the meantime are there any workarounds anyone can suggest?
from pi4j-v2.
Interesting issue and probably worth raising elsewhere. I was building on a 64-bit Pi 4 running the 64-bit OS. It did produce the 32-bit binaries for the Pi zero I'm running on but it wasn't compiled for the v6 architecture so it didn't work! This is probably a bug that needs fixing. In the meantime are there any workarounds anyone can suggest?
I was afraid that might happen with the new cross-compiler stuff I was working on -- I'll have to revisit the new compiler stuff and get it building for ARMv6 as well.
In the meantime, try to clone from this older commit (using the previous native compiler logic) which should build for all 32-bit RaspberryPis. You will have to build on a 32-bit system or build using the -Pnative -Pdocker
profiles and build using the cross-compiler Docker image. You should be able to use the Docker build if you install Docker on your 64-bit Pi : https://github.com/Pi4J/pi4j-v2/tree/ec2815015bf269b2365d90be000f67024fe9013a
Fingers crossed.
Thanks, Robert
from pi4j-v2.
Well… It loads the cross-compiler on the 64-bit machine and produces a 32-bit library. So that's not too bad. All I think it needs is he right compiler flags and we're sorted. If I had to guess, and with a bit of poking around, I'd support setting -march=armv6+fp -mfloat-abi=hard -mfpu=vfp will work just fine as it's GCC's default options on the Pi.
A little more poking around reveals that the default for the cross-compiler on the 64-bit Raspberry OS is -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb -march=armv7-a+fp which explains why it doesn't work (for so many reasons).
My knowledge of maven is amazingly poor. The same applies to the build scripts for pi4j-v2's native libraries. However, using -Pnative I can at least get it to build the 32-bit libraries (if wrongly). All I need is to know the tweaks to add those compiler flags in (-march=armv6+fp -mfloat-abi=hard -mfpu=vfp). The probably need to be in the shell scripts that build the libraries.
I think having the 64-bit and 32-bit (as just v6) is a good mix. I see little value in adding other 32-bit architectures as almost all of the rest of the 32-bit OS is compiled for v6.
from pi4j-v2.
I've read that compiler flags alone are not enough.
Granted I have not tested it myself, but I suspect a custom compiler toolchain is needed.
See:
The older commit that I referenced will build using an older Docker cross-compiler image that I created that uses the RaspberryPi Tools GCC v4 cross compiler toolchain. From this older commit, you can build directly on a 32-bit RaspberryPi or build with the Docker image and it should produce ARMv6 compatible binaries.
As for the latest build logic in the master
branch, this all uses newer builder docker images that I recently created and those are not using the custom compiler toolchains.
If you want to experiment with the compiler flags and try out march=armv6+fp -mfloat-abi=hard -mfpu=vfp
I believe you can simply ...
Based on this line the Makefile:
I think you can export your own CARGS
with whatever custom arguments you want to include.
The best place to add that export is here in the build.sh
script where the 32-bit build is located:
pi4j-v2/libraries/pi4j-library-pigpio/src/main/native/build.sh
Lines 102 to 109 in 75e1909
You may have to add a CARGS=${CARGS}
argument here too where the make
is getting called. I'm not 100% certain.
from pi4j-v2.
Well, I've totally failed to get the libraries built for the v6 architecture. On the plus side that's not this bug!
It turns out that the bug is not about getting the length wrong, ironically it's about checking the length. In the i2cWriteI2CBlockData method of PiGpioNativeImpl then length check it wrong! Line 1134 is:
validateI2cBlockLength(data.length);
when it should be:
validateI2cBlockLength(length);
so that means we have a fix for this bug. Now all we need to do is to get the system working again on the v6 architecture!
from pi4j-v2.
@hackerjimbo what JDK or you using on v6 architecture? I've not been successful on that side...
@savageautomate mentioned this one before but didn't try it out yet: https://www.azul.com/downloads/zulu-community/?version=java-11-lts&os=linux&architecture=arm-32-bit-hf&package=jdk
from pi4j-v2.
@hackerjimbo, I created a pull request (#29) for you to review and test out that includes the fixes you mentioned.
from pi4j-v2.
I have sent you a JAR to test with that should be compatible with ARMv6 and include the fixes from the commits in branch: https://github.com/Pi4J/pi4j-v2/tree/issue/%2327
Let me know if the issue is fully resolved of if there are any lingering bugs.
Thanks, Robert
from pi4j-v2.
Received confirmation from @hackerjimbo the fix is working as expected.
Merged pull request into master.
Issue closed.
from pi4j-v2.
Related Issues (20)
- Context shutdown() does not appear to close files HOT 2
- Cant control LED-Controller using UART by Pi4j-v2
- Requesting Support for GPIO Pin Access on Konstakang AOSP for Raspberry Pi HOT 3
- Pi4j PPA v2 outdated
- MockSpi.transfer() doesn't allow the tester to provide mock data
- MockSpi logging is hard to read because it is broken up across multiple lines
- Feature request: Method for MockSpi class that allows reading of the entire buffer for testing purposes
- Data read over I2C becomes out of sync over a slower wireless network HOT 1
- Use Socket#setSoTimeout to timeout read requests of GPIO socket implementation HOT 2
- Extend Digital Input and Output implementations in LinuxFS HOT 4
- Unable to obtain data from DHT11 HOT 2
- Is I2C available in this project for output to a 16x2 LCD? HOT 10
- Does Pi4J support the new PI 5? HOT 6
- pi4j-example-minimal doesn't work on Raspberry Pi 5 HOT 1
- New plugin to add support for the new Raspberry Pi 5 HOT 3
- i2cWriteByte is not able to write value greater then 128 0x80 HOT 1
- java.io.IOException: Remote I/O error java.base/java.io.RandomAccessFile.writeBytes(Native Method) HOT 2
- Extend support for Raspberry Pi 5: PWM and SPI
- Merge pi4j-board-info into core library
- [HELP] Raspberry PI 5 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pi4j-v2.