Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Tic825 i2c communication issue

#1

I need, to periodically update speed of my motor. generally like this:

cc=1
while cc==1:
       file = open("/home/pi/M0.txt", "r")
       speedM0=file.read()
       file.close()
       new_target=int(speedM0)*100000
       tic.set_target_speed(new_target)
       time.sleep(0.02)

It doesn’t work correctly. It crashes randomly with:

    File "/usr/local/lib/python2.7/dist-packages/smbus2/smbus2.py", line 497, in i2c_rdwr
       ioctl(self.fd, I2C_RDWR, ioctl_data)
IOError: [Errno 121] Remote I/O error
#2

Hello.

It sounds like the issue might be caused by the Raspberry Pi’s I2C clock-stretching bug, which prevents the I2C module from working reliably. Did you set up the I2C on your Raspberry Pi as described under the “Example I2C code for Linux in C” section in the Tic user’s guide?

- Amanda