This article covers the essential
characteristics and prominent advantages of the Inter–Integrated Circuit
(aka I2C) serial-communications protocol.
Communicating via Alphabet Soup
This article is about I2C, which is typically used for communications between individual integrated circuits located on the same PCB. Two other common protocols that also fit into this general category are UART (Universal Asynchronous Receiver/Transmitter) and SPI (Serial Peripheral Interface). You need to know the basic characteristics of I2C before you can thoroughly understand a comparison between these three interfaces, so we will discuss that topic at the end of this article.
Many Names, One Bus
The final layer of fog settles in when you notice that SMB or SMBus is apparently used as yet another way of referring to the I2C bus. Actually, these abbreviations refer to the System Management Bus, which is distinct from, though almost identical to, the I2C bus. The original I2C protocol was developed by Phillips Semiconductor, and years later Intel defined the SMBus protocol as an extension of I2C. The two buses are largely interchangeable; if you are interested in the minor differences between them, refer to page 57 of the System Management Bus Specification.
Like Trying to Have an Important Conversation in a Room Full of People . . .
The point is, there are a lot of things that can go wrong in this sort of communication environment. You have to keep this in mind when you are learning about I2C, because otherwise the protocol will seem insufferably complicated and finicky. The fact is, this extra complexity is what allows I2C to provide flexible, extensible, robust, low-pin-count serial communication.
Overview
- Only two signals (clock and data) are used, regardless of how many devices are on the bus.
- Both signals are pulled up to a positive power supply voltage through appropriately sized resistors.
- Every device interfaces to the clock and data signal through open-drain (or open-collector) output drivers.
- Each slave device is identified by means of a 7-bit address; the master must know these addresses in order to communicate with a particular slave.
- All transmissions are initiated and terminated by a master; the master can write data to one or more slaves or request data from a slave.
- The labels “master” and “slave” are inherently non-permanent: any device can function as a master or slave if it incorporates the necessary hardware and/or firmware. In practice, though, embedded systems often adopt an architecture in which one master sends commands to or gathers data from multiple slaves.
- The data signal is updated on the falling edge of the clock signal and sampled on the rising edge, as follows:
- Data is transferred in one-byte sections, with each byte followed by a one-bit handshaking signal referred to as the ACK/NACK (acknowledge or not-acknowledge) bit.
I2C vs. UART and SPI
- maintains low pin/signal count even with numerous devices on the bus
- adapts to the needs of different slave devices
- readily supports multiple masters
- incorporates ACK/NACK functionality for improved error handling
- increases the complexity of firmware or low-level hardware
- imposes protocol overhead that reduces throughput
- requires pull-up resistors, which
- limit clock speed
- consume valuable PCB real estate in extremely space-constrained systems
- increase power dissipation
You may need to intentionally avoid I2C if throughput is a dominant concern; SPI supports higher clock frequencies and minimizes overhead. Also, the low-level hardware design for SPI (or UART) is much simpler, so if you are working with an FPGA and developing your serial interface from scratch, I2C should probably be considered a last resort.
Conclusion
We have presented the salient characteristics of I2C, and we now know enough about the protocol’s pros and cons to allow for an informed decision on which serial bus you might choose for a given application. In future articles we will explore the protocol, and how to actually implement it, in more detail.
No comments:
Post a Comment