Hardware I2C unreliable on RCM6700

I have a current project using a RCM6700 module in an embedded industrial monitor and control application. Among other tasks the RCM6700 is using an I2C bus to talk to various peripheral chips, including analog inputs and bus expanders driving relays and LEDs. The RCM6700 is also hosting a dynamically generated web page used for user setup and monitoring.

The software is compiled in Dynamic C 10.66, and I am using the Hardware I2C library.

What I have noticed during testing is that sometimes when the web site is being heavily loaded, refreshing a large page over and over again, reads from the I2C bus occasionally return garbage data. My code calls the I2C_ReadFromSlave command several times a second to get data from ADC chips monitoring temperature, voltage, and other analog signals, and every now and then I’ll see a one-time read of a value that is completely off what it should be. On closer inspection the contents of the buffer are not being changed by the read, but are simply retaining their value from the previous read, even though the return value from I2C_ReadFromSlave is 0, indicating a successful read.

I have also noticed that during heavy web access the relays on the board will occasionally click on for a moment without being commanded. I suspect this is a related issue, where I2C_WriteToSlave occasionally writes nonsense data to the I2C bus and then gives a return code indicating a successful write.

I note that the documentation of the I2C hardware routines state that they are non re-entrant. While my code is multi-threaded, only one thread is permitted to access the I2C port, so I don’t think this bug is due to multiple threads trying to access the I2C port at the same time.

Given that this project is potentially to be used for industrial control systems where we really can’t tolerate random relay glitches, I have decided that the hardware I2C libraries on the RCM6700 are dangerously unreliable. I have rewritten my code to use a modified version of the software I2C library instead. This seems to be completely reliable - I have not had any random garbage data or relay glitches since doing so.

I have not yet tried compiling this code under 10.70, so it’s possible the bug was fixed there.

I was coding for I2C using I2c_hw.lib but i’ve found several bugs and failures. I have submitted a ticket to digi support and they told me is due to bugs on the library and they advise me to use the bit-banged version of library (I2C_sw.lib).

I modified this file to match my pin assignment and it works fine!

In the lastest release of Dynamic C, 10.72, all I2C libraries still the same.

Hello, Yes, in the Dynamic C 10.72 I2c_hw.lib not yet updated. I think if you send mail to (tech support )support.wizards@digi.com ,you can get library patch for this.