Giter Site home page Giter Site logo

Comments (4)

alex9849 avatar alex9849 commented on September 27, 2024

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.

eitch avatar eitch commented on September 27, 2024

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.

FDelporte avatar FDelporte commented on September 27, 2024

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.

alex9849 avatar alex9849 commented on September 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.