androidthings / contrib-drivers

Open source peripheral drivers
Apache License 2.0
560 stars 174 forks source link

I/O error (code 5) #97

Open Yanqilong opened 6 years ago

Yanqilong commented 6 years ago

Sensor: BMP/BME I2C board: raspberry pi 3 model B

executor the statement will occur error

private static final int BMX280_REG_ID = 0x60;
mChipId = mDevice.readRegByte(BMX280_REG_ID);

error:

W/System.err: com.google.android.things.pio.PioException: android.os.ServiceSpecificException: I/O error (code 5)
W/System.err:     at com.google.android.things.pio.I2cDeviceImpl.readRegByte(I2cDeviceImpl.java:86)
W/System.err:     at com.iot.driver.bmx.Bmx280.connect(Bmx280.java:199)
W/System.err:     at com.iot.driver.bmx.Bmx280.<init>(Bmx280.java:177)
W/System.err:     at com.iot.driver.bmx.Bmx280.<init>(Bmx280.java:164)
W/System.err:     at com.iot.MainActivity.printDeviceId(MainActivity.java:37)
W/System.err:     at com.iot.MainActivity.onCreate(MainActivity.java:31)
W/System.err:     at android.app.Activity.performCreate(Activity.java:7000)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6991)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
W/System.err:     at android.app.ActivityThread.-wrap11(Unknown Source:0)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err:     at android.os.Looper.loop(Looper.java:164)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6494)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
W/System.err: Caused by: android.os.ServiceSpecificException: I/O error (code 5)
W/System.err:     at android.os.Parcel.readException(Parcel.java:2018)
W/System.err:     at android.os.Parcel.readException(Parcel.java:1950)
W/System.err:     at com.google.android.things.pio.IPeripheralManagerClient$Stub$Proxy.I2cReadRegByte(IPeripheralManagerClient.java:1301)
W/System.err:     at com.google.android.things.pio.I2cDeviceImpl.readRegByte(I2cDeviceImpl.java:84)
W/System.err:   ... 18 more

what`s the problem? This is a screenshot

Fleker commented 6 years ago

This seems to be related to an error connecting to and communicating with the peripheral. Can you verify that the device is connected correctly?