My application uses a LOT of I2C communications and a customer's board recently experienced a failure with an I2C buffer chip that I'm using in my design. The chip failed and was holding the SDA pin state low indefinitely. I quickly noticed that my I2C commands would fail to time-out when the SDA pin was pulled down indefinitely. Zbasic just won't abandon the bus (so to speak). Once the SDA pin is pulled down permanently any I2CPutBit or I2CCmd seems to halt the execution of the program permanently.
Is there any fix for this besides a watchdog timer? Seems like the command should just fail at some point and allow the program to continue to execute.
-Jeff
I2C Bus Lock-up
I2C Bus Lock-up
Last edited by everest on 21 April 2011, 6:29 AM, edited 1 time in total.
Re: I2C Bus Lock-up
As far as I know, the I2C protocol has no mechanism for timeout. A slave can intentionally stall a transaction indefinitely as can component failure. The SMBus protocol was invented as an improvement on I2C and includes, among other things, a timeout mechanism.everest wrote:Seems like the command should just fail at some point and allow the program to continue to execute.
One thing you could do is to read the SDA and SCL pins (configured as inputs) prior to beginning an I2C transaction. If either line is not read as a one, there is a bus fault somewhere. This doesn't address, however, the issue of the slave holding a transaction indefinitely.
- Don Kinzer