When connecting multiple devices to a microcontroller, the address and data lines of each devices 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, 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).
Figure 23 : Sample I2C Implementation.
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 commnication 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.
1.2.2 I2C Theory of Operation
I2C has a master/slave protocol. The master initiates the communication. Here is a simplified description of the protocol. For precise details, please refer to the Philips I2C specification. The sequence of events are as follows:
- The master device issues a start condition. This condition informs all the slave devices to listen on the serial data line for their respective address.
- 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 acknowledgment 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 acknowledgment.
- When the communication is complete, the master issues a stop condition indicating that everything is done.
Figure 24 shows a sample bitstream of the I2C protocol.
Figure 24 : I2C Protocol.
Since there are only two wires, this protocol includes the extra overhead of the addressing and acknowledgement mechanisms.
1.2.3 I2C Features
I2C has many features other important features worth mentioning. It supports multiple data speeds: standard (100 kbps), fast (400 kbps) and high-speed (3.4 Mbps) communications.
Other features include:
- Built-in collision detection
- 10-bit Addressing
- Multi-master support
- Data broadcast (general call)
For more information about other features, see the references at the end of this section.
1.2.4 I2C 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.
'Hardware' 카테고리의 다른 글
Xbee, 초기 설정 (0) | 2021.07.15 |
---|---|
SPI Interface (0) | 2021.06.17 |
Charge Pump ( 차지펌프 ) ? (0) | 2021.01.26 |
기초전자공학, Bias (바이어스) 는 무엇일까? (0) | 2021.01.19 |
기초전자공학, Linear Regulator (LDO) 선택시 고려사항 (0) | 2021.01.17 |