3

I am using an kontron embedded computer to to communicate to an ST micro controller over I2C. I'm using the dev adapter to interface with the I2C, using the simple read() and write() functions described here.

The problem is if the slave fails to acknowledge a byte for whatever reason, the I2C bus freezes and the master can't send or receive any info (even if the programme is closed and restarted!). The only way I can at the moment reset the I2C bus is by rebooting, which is far from ideal. Does anyone have any suggestions of what I could do?

1
  • Apparently it's possible to do an i2c reset. However I can't get any useful information on it. Commented Oct 30, 2018 at 9:25

1 Answer 1

1

I've been looking into this myself for an UpBoardX86 with DesignWare I2C controller. I worked out a way to cause the kernel to unbind and rebind the /dev/i2c-5 device again.

ls -al /dev/i2c-5 echo -n "808622C1:01" > /sys/bus/platform/drivers/i2c_designware/unbind ls -al /dev/i2c-5 echo -n "808622C1:01" > /sys/bus/platform/drivers/i2c_designware/bind ls -al /dev/i2c-5 

The /dev/i2c-* name and the device tree path name would vary depending on the hardware that you have. The ls -al command will fail after the unbind, this demonstrates that the device is no longer present. I learned how to do this from the following article: https://lwn.net/Articles/143397

I'm not sure if this will fix the problem you are encountering, but it might be the closest thing to a reboot you can do.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.