"No gpio chip yet initialized!" on a Raspberry Pi CM5
Hi. I cloned the repo, changed nothing and ran it as instructed here: https://www.pi4j.com/getting-started/minimal-example-application/
On my Raspberry Pi CM5, this is the result:
[main] INFO com.pi4j.util.Console - Board model: Unknown [main] INFO com.pi4j.util.Console - Operating system: Name: Linux, version: 6.12.25+rpt-rpi-2712, architecture: aarch64 [main] INFO com.pi4j.util.Console - Java versions: Version: 17.0.15, runtime: 17.0.15+6-Debian-1deb12u1, vendor: Debian, vendor version: null [main] INFO com.pi4j.util.Console - Board model: Unknown [main] INFO com.pi4j.util.Console - Raspberry Pi model with RP1 chip (Raspberry Pi 5): false [main] INFO com.pi4j.util.Console - OS is 64-bit: true [main] INFO com.pi4j.util.Console - JVM memory used (MB): 8.461479187011719 [main] INFO com.pi4j.util.Console - Board temperature (°C): 60.4 Exception in thread "main" java.lang.IllegalStateException: No gpio chip yet initialized! at [email protected]/com.pi4j.library.gpiod.internal.GpioDContext.getOrOpenLine(GpioDContext.java:78) at [email protected]/com.pi4j.plugin.gpiod.provider.gpio.digital.GpioDDigitalOutputProviderImpl.create(GpioDDigitalOutputProviderImpl.java:63) at [email protected]/com.pi4j.plugin.gpiod.provider.gpio.digital.GpioDDigitalOutputProviderImpl.create(GpioDDigitalOutputProviderImpl.java:47) at [email protected]/com.pi4j.io.gpio.digital.DigitalOutputProvider.create(DigitalOutputProvider.java:57) at [email protected]/com.pi4j.example.MinimalExample.main(MinimalExample.java:124)
Seems like the CM5 is not correctly identified. Do you need more info?
Maybe this revision $ cat /proc/cpuinfo | grep Revision Revision : b041a0
needs to be added here? https://github.com/Pi4J/pi4j/blob/develop/pi4j-core/src/main/java/com/pi4j/boardinfo/definition/BoardModel.java#L228
we just released a new version earlier today with better CM5 support! can you please retry with Java 21 and Pi4J 3.0.2, see new version of pom.xml in this repo.
Just today? What a coincidence! Will try! :) (y)
@moritzvieli yes, just today, but unfortunately, b041a0 is a value I've not seen before, so it's not in the list...
Raspberry Pi makes it very hard to find the revision info of all the boards...
You can also specify the type of board yourself, see https://www.pi4j.com/documentation/board-info/#overriding-the-detected-board
BoardInfoHelper.current().setBoardModel(BoardModel.COMPUTE_5);
var pi4j = Pi4J.newAutoContext();
I found a more extended list here: https://community.volumio.com/t/guide-identifying-your-raspberry-pi-board-on-volumio-a-comprehensive-guide-to-revision-codes/71350
Your code + a few others are added now, but they will only be available in a next release, sorry... https://github.com/Pi4J/pi4j/commit/55ed9bc511483e29534f6b945753d7ab5f448eae