I have a raspberry B rev2 (revision 000f from /proc/cpuinfo)
I'm running Raspbian GNU/Linux 8 (jessie) kernel 4.4.37+ #936 Fri Dec 9 16:53:10 GMT 2016 armv6l
/boot/config has dtoverlay=mcp23017 (with or without this the error still occurs)
(with the dtoverlay) the MCP23017 device is recognised and is presented to the /sys FS as
/sys/devices/platform/soc/20804000.i2c/i2c-1/1-0020/gpio/gpiochip496
using the example MCP23017GpioExample code - having changed the provider line to:
Code: Select all
provider = new MCP23017GpioProvider(I2CBus.BUS_1, 0x20);Code: Select all
java -cp pi4j-example-1.2-SNAPSHOT.jar:pi4j-core-1.2-20161229.215408-19.jar:pi4j-device-1.2-20161229.215426-19.jar:pi4j-gpio-extension-1.2-20161229.215417-19.jar MCP23017GpioExample
Code: Select all
<--Pi4J--> MCP23017 GPIO Example ... started.
Exception in thread "main" com.pi4j.io.i2c.I2CIOException: Failed to select slave device!
at com.pi4j.io.i2c.impl.I2CBusImpl.selectBusSlave(I2CBusImpl.java:284)
at com.pi4j.io.i2c.impl.I2CBusImpl.runBusLockedDeviceAction(I2CBusImpl.java:243)