These are chat archives for nebrius/raspi-io

Jul 2016
Jul 14 2016 11:50

@nebrius Any reason I'd be getting:

Error: EIO: i/o error, write
    at Error (native)
    at Object.fs.writeSync (fs.js:780:20)
    at Bus.i2cWriteSync (/home/pi/dev/dome-bot/node_modules/i2c-bus/i2c-bus.js:340:13)
    at I2C.writeSync (/home/pi/dev/dome-bot/node_modules/raspi-i2c/lib/index.js:332:34)
    at Raspi.i2cWrite (/home/pi/dev/dome-bot/node_modules/raspi-io/lib/index.js:559:19)
    at (/home/pi/dev/dome-bot/node_modules/node-pixel/lib/pixel.js:281:26)
    at Timeout._repeat (/home/pi/dev/dome-bot/bot.js:117:18)
    at Timeout.wrapper [as _onTimeout] (timers.js:417:11)
    at tryOnTimeout (timers.js:224:11)
    at Timer.listOnTimeout (timers.js:198:5)

On some I2C writes. Oddly it's not happening all the time.

Some context:

Raspio is doing direct I2C work with 2 items on the I2C bus (a nodepixel backpack and a new HCSR04 Array backpack I'm building). In addition I have a USB Uno which has some sensors etc of it's own and it driving a servo.

Seemingly if I turn off the USB board things are more stable.
but I don't understand why that would cause an issue at all...
Jul 14 2016 12:05
Actually - on further tinkering, it appears it's to do with the two I2C backpacks...
as I removed all of the other code
and I'm still getting the same error
Jul 14 2016 13:25
Okay a little more info fwiw - it appears as occasionally I'm getting a read or a write conflict on the I2C bus and IO doesn't know what to do with it. Given my use case I just catch the exception and then ignore it because really if I drop one value from a set of proximity readings or drop one pixel from a frame running at 30fps then it won't matter. But it does raise an interesting question about what to do with these errors
Brian Cooke
Jul 14 2016 15:41
@ajfisher is the I2C code on the backpacks fast enough to function without stretching the I2C clock?
The Pi doesn't support I2C clock stretching and the default I2C baudrate is 100000.
Jul 14 2016 23:37

@fivdi should be - either of the backpacks should be plenty fast enough and I've never seen any issues with them individually on an RPi previously.

It's consistently either at I2C.writeSync or at I2C.readSync that seems to cause the issue and if I up the speed data read / write to very high levels it occurs more frequently.