0

I am trying to poll data from an I2C device on a Raspberry Pi. Currently it is hooked up to a 7" touch screen, and I am getting an error that seems to be due to a clock-stretching bug. (https://github.com/fivdi/i2c-bus/issues/36) (http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html)

Will removing the screen and running the Pi headless improve baud rate performance / clock consistency?

I am getting the following error:

/home/pi//node_modules/i2c-bus/i2c-bus.js:355
  return i2c.readI2cBlockSync(peripheralSync(this, addr), cmd, length, buffer);
         ^

Error: , Remote I/O error
at Bus.readI2cBlockSync (/home/pi/node_modules/i2c-bus/i2c-bus.js:355:14)
at Ina219.readRegister (/home/pi/node_modules/ina219/ina219.js:184:12)
at Ina219.getShuntVoltage_raw (/home/pi/node_modules/ina219/ina219.js:448:7)
at Ina219.getShuntVoltage_mV (/home/pi/node_modules/ina219/ina219.js:500:7)
at Timeout.setInterval [as _onTimeout] (/home/pi/test.js:44:12)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)```
1

I don't see how. The remote I2C device requests the clock stretch because it can't keep up with the Pi. Making the Pi more responsive will just make the situation worse as far as the remote I2C device is concerned.

If you think clock stretch is the problem drop the I2C bus speed to something like 50kbps.

  • I tried lowering bus speed by setting dtparam=i2c_baudrate=5000 in /boot/config.txt. – Matthew Sep 20 '18 at 18:05
  • I was still getting errors, so perhaps the problem is somewhere else? – Matthew Sep 20 '18 at 18:05
  • What device is attached to the I2C bus? Does it clock stretch at all? – joan Sep 20 '18 at 20:03
  • I'm not sure. It's an INA219 and being polled with node-ina219 (npmjs.com/package/ina219). – Matthew Sep 20 '18 at 21:21
  • @Matthew There is no mention of clock stretch in the INA219 datasheet. You have not given details of the error you actually get. – joan Sep 21 '18 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.