Hi all,
I'm trying to use I2C on GPIO of Raspberri PI 3B.
I2C interface has been enabled using raspi-config.
Actually I don't have an I2C device connected to the GPIO pins, but only an oscilloscope connected.
I'm using the code suggested by Erel here: https://www.b4x.com/android/forum/threads/iot-jpi4j-raspberry-pi-gpio-controller.37493/#content
I'm in debug mode. If I use Bus 0 I obtain Error: "java.lang.reflect.InvocationTargetException". To avoid this I changed to Bus 1 as follow and it works:
When I get the bus I have the following WARNINGS:
Anyway I proceed and I get bus and device correctly, but when in the Sub Write(...) the RunMethod runs, I have this error:
I don't know what I'm doing wrong.
Please someone can help me fixing this error?
Thanks to everyone.
I'm trying to use I2C on GPIO of Raspberri PI 3B.
I2C interface has been enabled using raspi-config.
Actually I don't have an I2C device connected to the GPIO pins, but only an oscilloscope connected.
I'm using the code suggested by Erel here: https://www.b4x.com/android/forum/threads/iot-jpi4j-raspberry-pi-gpio-controller.37493/#content
I'm in debug mode. If I use Bus 0 I obtain Error: "java.lang.reflect.InvocationTargetException". To avoid this I changed to Bus 1 as follow and it works:
B4X:
Dim bus As JavaObject = GetBus(1)
Dim device As JavaObject = GetDevice(bus, 0)
Write(device, 120)
B4X:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.pi4j.io.file.LinuxFile (file:/home/pi/tempjars/AsyncInput1) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.pi4j.io.file.LinuxFile
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
B4X:
Error occurred on line: 684
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:676)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:240)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:
167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.objects.Timer$TickTack$1.run(Timer.java:118)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.enterNestedEventLoop(RunnableProces
sor.java:107)
at javafx.graphics/com.sun.glass.ui.monocle.MonocleApplication._enterNestedEventLoop(MonocleApplication.java:143)
at javafx.graphics/com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:509)
at javafx.graphics/com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:591)
at javafx.graphics/javafx.stage.Stage.showAndWait(Stage.java:465)
at javafx.controls/javafx.scene.control.HeavyweightDialog.showAndWait(HeavyweightDialog.java:162)
at javafx.controls/javafx.scene.control.Dialog.showAndWait(Dialog.java:345)
at anywheresoftware.b4j.objects.JFX.Msgbox2(JFX.java:220)
at anywheresoftware.b4j.objects.JFX.Msgbox(JFX.java:185)
at b4j.example.main._appstart(main.java:260)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflec
t.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.start(main.java:38)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.
graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: sun/misc/SharedSecrets
at com.pi4j.io.file.LinuxFile.getFileDescriptor(LinuxFile.java:215)
at com.pi4j.io.file.LinuxFile.ioctl(LinuxFile.java:103)
at com.pi4j.io.i2c.impl.I2CBusImpl.selectBusSlave(I2CBusImpl.java:291)
at com.pi4j.io.i2c.impl.I2CBusImpl.runBusLockedDeviceAction(I2CBusImpl.java:258)
at com.pi4j.io.i2c.impl.I2CBusImpl.writeByteDirect(I2CBusImpl.j
ava:169)
at com.pi4j.io.i2c.impl.I2CDeviceImpl.write(I2CDeviceImpl.java:92)
... 57 more
Caused by: java.lang.ClassNotFoundException: sun.misc.SharedSecrets
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 63 more
Please someone can help me fixing this error?
Thanks to everyone.