On any bidirectional bus there is a risk that two or more de
On any bidirectional bus, there is a risk that two (or more) devices may try to place different voltage levels on the bus at the same time. When interfacing with the LCD, this problem was overcome with tristate outputs. How does I2C overcome this problem? In other words, how does I2C handle bus contention (where two devices attempt to drive the same wire (the SDA line, for example) to different voltage levels at the same time)? What are the consequences of this design? Why wouldn’t a tristate solution (like the LCD interface) work for I2C?
Solution
The bus contention problem in I2C is overcome by giving different addresses to the different devices connected on the line. The consequence of this is that two devices with the same I2C address cannot be connected to a bus.
I2C lines ( both SCLK and SDA ) are open drain drivers i.e., the chip can drive its output low but cannot drive it high.For the line to enable to go high, pull up resistors are provided, which are tied to the power supply. Now, if a tristate situation occurs, the line would be pulled high. Due to this, we would not know if the output from the device is high or if it is tri state. Hence a tri-state solution will not work for I2C.
