Advantages and Limitations of I2C Communication - JohnHau/mis GitHub Wiki
I2C Communication Background
Contents History Theory of Operation Features Benefits and Drawbacks References History When connecting multiple devices to a microcontroller, the address and data lines of each device were conventionally connected individually. This would take up precious pins on the microcontroller, result in a lot of traces on the PCB, and require more components to connect everything together. This made these systems expensive to produce and susceptible to interference and noise.
To solve this problem, Philips developed Inter-IC bus (inter integrated circuit), or I2C, in the 1980s. I2C is a low-bandwidth, short distance protocol for on board communications. All devices are connected through two wires: serial data (SDA) and serial clock (SCL).
The I²C communication protocol uses only two bidirectional open collector or open drain lines, Serial Data Line (SDA) and Serial Clock Line (SCL), pulled up with resistors. Traditionally typical voltages used have been +5 V or +3.3 V; however, recently +2.5 V, +1.8 V, and +1.2 V have become more common.
Regardless of how many slave units are attached to the I2C bus, there are only two signals connected to all of them. Consequently, there is additional overhead because an addressing mechanism is required for the master device to communicate with a specific slave device.
Because all communication takes place on only two wires, all devices must have a unique address to identify it on the bus. Slave devices have a predefined address, but the lower bits of the address can be assigned to allow for multiples of the same devices on the bus.
The advent of the Internet of Things ("IOT") coupled with the low pin count of I2C serial communication has led to a resurgence in I2C utilization. Common applications are for serial data management, including serial data transfer to/from sensors, programming EEPROM's, and retrieving polling/receiving sensor data.
Theory of Operation I2C has a master/slave protocol. The master initiates the communication. The sequence of events are:
The Master device issues a start condition. This condition informs all the slave devices to listen on the serial data line for instructions. The Master device sends the address of the target slave device and a read/write flag. The Slave device with the matching address responds with an acknowledgement signal. Communication proceeds between the Master and the Slave on the data bus. Both the master and slave can receive or transmit data depending on whether the communication is a read or write. The transmitter sends 8-bits of data to the receiver which replies with a 1-bit acknowledgement. When the communication is complete, the master issues a stop condition indicating that everything is done.
Features I2C has many important features worth mentioning. It supports multiple data speeds: Standard-mode (100 kbps), Fast-mode(400 kbps), Fast-mode plus, High-speed mode (3.4 Mbps), and Ultra Fast-mode (5.0 Mbps) I2C communications.
Other features include:
Built in collision detection 10-bit Addressing Multi-master support Data broadcast (general call). For more information about other features, take a look at the references at the end of this article.
Benefits and Drawbacks Since only two wires are required, I2C is well suited for boards with many devices connected on the bus. This helps reduce the cost and complexity of the circuit as additional devices are added to the system.
Due to the presence of only two wires, there is additional complexity in handling the overhead of addressing and acknowledgments. This can be inefficient in simple configurations and a direct-link interface such as SPI might be preferred.