I2C Bus Lock-up

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

I2C Bus Lock-up

Post by everest »

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
Last edited by everest on 21 April 2011, 6:29 AM, edited 1 time in total.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: I2C Bus Lock-up

Post by dkinzer »

everest wrote:Seems like the command should just fail at some point and allow the program to continue to execute.
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.

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
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

Thanks Don! That work-around of just reading the state would have worked in this case. I'm putting together a small diagnostic program to do a full work-out and system check and that's a great idea. Thanks!

-Jeff
Post Reply