Comments (4)
Hello Frank, :)
I just tested the LinuxFS implementations. The do work on a raspberry pi 3, but I get the following error on a raspberry pi 5:
java.io.IOException: Invalid argument
at java.base/sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:na]
at java.base/sun.nio.ch.FileDispatcherImpl.write(FileDispatcherImpl.java:62) ~[na:na]
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) ~[na:na]
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) ~[na:na]
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:67) ~[na:na]
at java.base/sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:288) ~[na:na]
at java.base/java.nio.channels.Channels.writeFullyImpl(Channels.java:74) ~[na:na]
at java.base/java.nio.channels.Channels.writeFully(Channels.java:96) ~[na:na]
at java.base/java.nio.channels.Channels$1.write(Channels.java:171) ~[na:na]
at java.base/java.nio.file.Files.write(Files.java:3517) ~[na:na]
at java.base/java.nio.file.Files.writeString(Files.java:3734) ~[na:na]
at java.base/java.nio.file.Files.writeString(Files.java:3674) ~[na:na]
at com.pi4j.plugin.linuxfs.internal.LinuxGpio.export(LinuxGpio.java:94) ~[pi4j-plugin-linuxfs-2.4.0.jar!/:na]
at com.pi4j.plugin.linuxfs.provider.gpio.digital.LinuxFsDigitalOutput.initialize(LinuxFsDigitalOutput.java:71) ~[pi4j-plugin-linuxfs-2.4.0.jar!/:na]
at com.pi4j.plugin.linuxfs.provider.gpio.digital.LinuxFsDigitalOutput.initialize(LinuxFsDigitalOutput.java:46) ~[pi4j-plugin-linuxfs-2.4.0.jar!/:na]
at com.pi4j.provider.impl.ProviderProxyHandler.invoke(ProviderProxyHandler.java:103) ~[pi4j-core-2.4.0.jar!/:na]
at jdk.proxy2/jdk.proxy2.$Proxy102.create(Unknown Source) ~[na:na]
at com.pi4j.context.Context.create(Context.java:325) ~[pi4j-core-2.4.0.jar!/:na]
at com.pi4j.internal.IOCreator.create(IOCreator.java:58) ~[pi4j-core-2.4.0.jar!/:na]
at com.pi4j.internal.IOCreator.create(IOCreator.java:96) ~[pi4j-core-2.4.0.jar!/:na]
at net.alex9849.cocktailpi.utils.PinUtils.getBoardOutputPin(PinUtils.java:41) ~[classes!/:1.0-SNAPSHOT]
The file /sys/class/gpio
does exist.
I initialized the context using:
ContextBuilder ctxBuilder = Pi4J.newContextBuilder();
ctxBuilder.add(LinuxFsI2CProvider.newInstance());
ctxBuilder.add(LinuxFsDigitalOutputProvider.newInstance());
ctxBuilder.add(LinuxFsDigitalInputProvider.newInstance());
... and created the DigitalOutput-instances using:
DigitalOutputConfig config = DigitalOutput
.newConfigBuilder(pi4J)
.address(address)
.shutdown(DigitalState.HIGH)
.initial(DigitalState.HIGH)
.build();
return new Pi4JOutputPin(outputPinMap.get(address));
I would like to get pi4J running on a raspberry pi 5. Sadly pigpio got incompatible.
from pi4j-v2.
Hi @alex9849
If you don't have a /sys/class/gpio file, then this means that a kernel module is not loaded. This would be something to do with the Raspberry Pi OS. Further the LinuxFS plugin doesn't use pigpio, just files exported by the kernel.
Sadly i don't yet have a Rasberry Pi 5, so i can't test this out. Maybe you can check the Raspberry Pi forums for the kernel which needs to be loaded? Are you using the latest OS? Maybe you need to enable it in the raspi-config tool?
from pi4j-v2.
Hi, I have a 5 but only did a very quick test with the minimal example. It looks like PiGpio doesn't work either - as expected based on some messages on tickets in the project, e.g.
joan2937/pigpio#589
I will try more later, but agenda is still blocked the next days.
from pi4j-v2.
Yes. pigpio got incompatible sadly. But I found a few things out.
My kernel is okay. I do have a /sys/class/gpio file. That's not the problem. I just wanted to point out that the error happens even tough that file exists. I tested the DigitalOutput integration with LinuxFS on a raspberry pi 3 and a raspberry pi 5. It works on the Pi3, but not on the Pi5.
The LinuxFS I2C integration works on both platforms. Maybe the format for the gpio files changed? Is the format documented somewhere?
I digged a bit more into it. I couldn't really find anything regarding /sys/class/gpio, but I looks like that interface got deprecated:
https://www.kernel.org/doc/Documentation/ABI/obsolete/sysfs-gpio
An alternative seem to be devices at /dev/gpiochip* and /dev/gpiomem*
https://docs.kernel.org/driver-api/gpio/using-gpio.html
that should be controlled using
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
I also found an example:
https://blog.lxsang.me/post/id/33
from pi4j-v2.
Related Issues (20)
- No Example for using Pi as I2C Slave device. HOT 2
- Detect the platform (type of Raspberry Pi if applicable) Pi4J is executed on HOT 9
- IOAlreadyExistsException when reopening Serial-connection HOT 3
- SPI w/ GPIO (non-CE)
- GPIO digital input doesn't change state as button is pressed/realised HOT 2
- Software PWM fails to work on Pi 1 HOT 9
- Export JavaDocs to website on new release HOT 1
- GitHub Action should not run completely in a fork HOT 3
- pigpiod startup problem HOT 4
- Add a callback to the Serial class fire when its open HOT 3
- 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
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.