I2c Communication Protocol Understanding I2c Primer Pmbus and Smbus
I2c Communication Protocol Understanding I2c Primer Pmbus and Smbus
Abstract Aside from the most commonly used I2C Primer, there are two additional
I2C, or Inter-Integrated Circuit, is a commonly used serial communication variations of I2C that focus on the usage for system and power applications.
protocol in establishing communication between devices, especially for two These are called System Management Bus (SMBus) and Power Management
or more different circuits. I2C Primer is the most commonly used I2C. This Bus (PMBus).
article will provide the basic features and standards for I2C Primer, primarily By definition, Inter-Integrated Circuit (I2C)—also known as Inter IC—is a hardware
to address proper usage during communication implementation. From the communication protocol that uses synchronous communication with a multi-
fundamentals of I2C, we’ll walk through the availability of its variant subsets, main, multi-node, and serial communication bus. Synchronous communication
System Management Bus (SMBus) and Power Management Bus (PMBus), and means two (or more) devices exchanging data share a common clock line. I2C
their differences. Each of the three has dedicated functions intended to is widely used for connecting lower speed peripheral ICs to processors and
address different customer requirements. microcontrollers. The I2C bus was designed by Philips to allow easy communica-
tion between components that reside on the same circuit board.
Why Is It Important?
I2C provides benefits to the designer in establishing simple, 2-way, flexible
I2C Primer
communication between numerous nodes in a system. I2C reduces complexity Interface
by using just two bidirectional wires for transmitting and receiving information. Connections are minimized by using a serial data (SDA) line, a serial clock (SCL)
It also allows designers to configure communication between multiple main- line, and a common ground to carry all communications.
node system ICs. I2C also benefits developers in managing the system and
Main Node
power, which gives them the advantage to create a high quality product inside
the best possible timeline.
SDA SDA
“Communication works for those who work at it.”
—John Powell
Communication protocol plays a big role in organizing communication between SCL SCL
devices. It is designed in different ways based on system requirements, and these Figure 1. Integrated circuits directly communicate with each other.
protocols have specific, agreed-upon rules to achieve successful communication.
There are two wires in each I2C device:
You’ve probably used I2C if you’ve ever built systems with LED displays, sensors,
or even accelerometer modules, to name a few. I2C supports the feature of X The SDA is the line for the main device and node to send and receive data.
connecting multiple nodes to a single main device and multiple main devices X The SCL is the line that carries the clock signal. The SCL is always generated
to multiple nodes. This feature is helpful if you want to maximize having one by the I2C main. The specification requires minimum periods for the low and
microcontroller logging data to a single memory card or displaying text to a high phases of the clock signal.
single LCD.
The I2C bus uses only two bidirectional lines: SDA and SCL for each device for
simple inter-IC communication.
VISIT ANALOG.COM
VDD Reserved I2C Node Address
Rp Rp
There are 16 reserved I2C addresses. These addresses correspond to one of two
SCL patterns: 0000 XXX or 1111 XXX. Table 2 shows I2C addresses reserved for special
purposes.
SDA
tf
70%
SDA
70%
30%
tSU(STA) tHD(STA)
30%
70%
SCL
30%
VISIT ANALOG.COM 3
Data Frame Step 2
After the main detects the ACK bit from the node, the first data frame is ready to The main sends each node the 7-bit or 10-bit address of the node it wants to
be sent. The data frame is always 8 bits long and sent with the most significant communicate with, along with the write bit.
bit first. Each data frame is immediately followed by an ACK/NACK bit to verify For example, a 7-bit address is 0x2D. Adding a write bit equivalent to 0, it will be 0x5A.
that the frame has been received successfully. The ACK bit must be received by
either the main or the node (depending on who is sending the data) before the Step 3
next data frame can be sent. See Figure 9. Each node compares the address sent from the main to its own address. If the
address matches, the node returns an ACK bit by pulling the SDA line low for one
Stop Condition bit. If the address from the main does not match the node’s own address, the
After all the data frames have been sent, the main can send a stop condition to node leaves the SDA line high.
the node to halt the transmission. The stop condition is a voltage transition from
low to high on the SDA line after a low-to-high transition on the SCL line, with the ACK is possible by bringing the SDA line low during the ninth pulse of the SCL and
SCL line remaining high. floating high for NACK.
The SDA line switches from a low voltage level to a high voltage level after the Step 4
SCL line switches from low to high. See Figure 10. The main sends or receives the data frame.
70% 70%
30% 30%
tSU(DAT) tSU(DAT)
70%
70% 70%
30%
30% 30%
70% tr
SDA
30%
tSU(STO)
70%
70%
SCL 30%
30%
P
SDA
MSB Acknowledgement Acknowledgement Sr
Signal from Node Signal from Receiver
Byte Complete,
Interrupt Within Node
Clock Line Held Low While
Interrupts Are Serviced
SCL S Sr
or 1 2 7 8 9 1 2 3–8 9 or
Sr P
ACK ACK
Start or Repeated Stop or Repeated
Start Condition Start Condition
Figure 11. Data sheet example for I2C transmission of write single location.
Steps of I2C Data Transmission: Read Single Main with Multiple Nodes
Step 1 Because I2C uses addressing, multiple nodes can be controlled from a single
main. With a 7-bit address, 128 (27) unique addresses are available. Using 10-bit
The main sends the start condition to every connected node by switching the
addresses is uncommon but provides 1024 (210) unique addresses. To connect
SDA line from a high voltage level to a low voltage level before switching the SCL
multiple nodes to a single main, wire them with 4.7 kΩ pull-up resistors connect-
line from high to low.
ing the SDA and SCL lines to VCC.
Step 2
The main sends each node the 7-bit or 10-bit address of the node it wants to
Multiple Mains with Multiple Nodes
communicate with, along with the write bit. Multiple main devices can be connected to a single node or multiple nodes. The
problem with multiple main devices in the same system comes when two mains
For example, a 7-bit address is 0x2D. Adding a write bit equivalent to 0, it will try to send or receive data at the same time over the SDA line.
be 0x5A.
To solve this problem, each main needs to detect if the SDA line is low or high
Step 3 before transmitting a message.
Each node compares the address sent from the main to its own address. If the If the SDA line is low, this means that another main has control of the bus, and
address matches, the node returns an ACK bit by pulling the SDA line low for one the main should wait to send the message. If the SDA line is high, then it’s safe
bit. If the address from the main does not match the node’s own address, the to transmit the message. To connect multiple mains to multiple nodes, use the
node leaves the SDA line high. diagram shown in Figure 13, with 4.7 kΩ pull-up resistors connecting the SDA and
Step 4 SCL lines to VCC.
After the initial start, addressing, and acknowledge, since the main already Main Node
knows its node and the address to point to, some devices have a repeated start
condition to clean the transaction. SDA SDA
The main sends each node the 7-bit or 10-bit address of the node it wants to Main Node
communicate with, along with the read bit.
For example, a 7-bit address is 0x2D. Adding a read bit equivalent to 1, it will SDA SDA
be 0x5B.
Each node compares the address sent from the main to its own address. If the
Main Node
address matches, the node returns an ACK bit by pulling the SDA line low for one
bit. If the address from the main does not match the node’s own address, the
SDA SDA
node leaves the SDA line high.
Step 7
SCL SCL
After the ACK bit, the main receives the data frame from the node.
After each data frame has been transferred, the main returns another ACK bit to Figure 13. Multiple mains with multiple nodes connected.
the sender to acknowledge successful receipt of the frame, or the main returns
a NACK if the read request is already done. Arbitration
Several I2C multi-main devices can be connected to the same I2C bus and oper-
Step 9 ate concurrently. By constantly monitoring the SDA and SCL for start and stop
To stop the data transmission, the main sends a stop condition to the node by conditions, they can determine whether the bus is currently idle or not. If the
switching SCL high before switching SDA high. bus is busy, the main device delays pending I2C transfers until a stop condition
indicates that the bus is free again.
VISIT ANALOG.COM 5
However, it may happen that two main devices start a transfer at the same Which I2C Node Devices Need Clock Stretching?
time. During the transfer, the mains constantly monitor the SDA and SCL. If one
Whether or not clock stretching is needed depends on the functions of the node
of them detects that SDA is low when it should be high, it assumes that another
device. Here are two examples:
main is active and immediately stops its transfer. This process is called arbitra-
tion. Both mains generate a start bit and proceed with their transmissions. X A processing device, such as a microprocessor or a microcontroller, may
need additional time to process an interrupt, receive and manage data, and
If the mains happen to choose the same logic levels, nothing happens.
perform the appropriate function(s).
As soon as the mains attempt to impose different logic levels, the main driving X A simpler device, such as an EEPROM, does not process data internally, so it
the signal low is proclaimed the winner; the loser detects the logic mismatch
does not need clock stretching to perform any of its functions.
and abandons its transmission.
Take a moment to appreciate the simplicity and efficacy of this arrangement: I2C Data Sheet Sample Overview
There are different approaches in terms of creating a data sheet depending on
X The winner continues its transmission without interruption—no corrupted
different companies and manufacturers. As a starter, Figure 13 shows a sample
data, no driver contention, no need to restart the transaction.
data sheet and basic I2C details including registers and electronic specifications.
X Theoretically the loser could monitor the node address during the arbitration
process and make a proper response if it happens to be the addressed node.
X If the competing mains are both requesting data from the same node, the
arbitration process does not unnecessarily interrupt either transaction—no
mismatch will be detected, and the node will output its data to the bus such
that multiple mains can receive it.
Clock Stretching
This is also referred to as clock synchronization.
Note: The I2C specification does not specify any timeout conditions for clock
stretching—that is, any device can hold down SCL if it likes.
In I2C communication protocol, the clock speed and signals are always gener-
ated by the main device. The signal generated by the I2C main device provides
synchronization between the main and node connection.
There are instances where a node or subnode is not fully working and needs to
slow down prior to receiving the generated clock from the main. This is accom-
plished through a mechanism known as clock stretching.
During the clock stretching period, in order to reduce the bus speed, the node is
allowed to hold down the clock. While on the main side, it is necessary that, after Figure 15. Microcontroller memory map.
its high state, the clock signal must be read back. Then it must wait until the line
has reached the high state. Table 4 shows the most used I2C registers. Names and descriptions may vary
depending on the data sheet, but the functionality and usage is common.
Bandwidth
Table 4. I2C Register Description
While clock stretching is a common practice, there is an effect on the bandwidth
side. In using clock stretching, the total bandwidth among the shared bus might Name Description
be significantly decreased. Bus performance must still be reliable and fast even I2C_ADDR1 Main address byte 1
using this technique. It is necessary to cover the estimated effects of using clock
I2C_ADDR2 Main address byte 2
stretching, especially on I2C buses shared by multiple devices.
I2C_BYT Start byte
I2C_ID Node address device ID
I2C_MCTL Main control
I2C_MRX Main receive data
I2C_SCTL Node control
I2C_SRX Node receive
Figure 14. Microcontroller data sheet. I2C_STAT Main and node FIFO status
Clock stretching allows an I2C node device to force the main device into a wait
state. A node device may perform clock stretching when it needs more time to
manage data—for example, to store received data or prepare to transmit another
byte of data. This typically occurs after the node device has received and
acknowledged a byte of data.
SMBCLK
Main Node
SMBDAT
Initialization
Tx Handler Tx Handler Figure 16. SMBus topology.
Rx Handler Rx Handler
SMBus Pull-Up Circuitry
Event Interrupt
VBUS VBUS VDD
Error Interrupt
OR IP IP SMBus
RP RP
SMBus Device
supply voltage, fan monitor, and/or control integrated chips. Figure 17. SMBus pull-up circuitry.
The SMBus is a 2-wire bus that is similar to the I C bus that was developed by
2
SMBus Address
Philips in the 1980s. The two main signals are the clock, or SMBCLK, and data, SMBus addresses are 7 binary bits long and are conventionally expressed as
or SMBDAT. The I2C primer and SMBus are compatible with each other, but there 4 bits followed by 3 bits followed by the letter b—for example, 0001 110b. These
are notable differences such as: addresses occupy the high 7 bits of an 8-bit field on the bus. The low bit of this
X The SMBus logic level thresholds are fixed and not proportional to a device’s field, however, has another semantic meaning that is not part of an SMBus address.
supply voltage. This allows devices with different supply voltages to operate
on the same primer. For example, one SMBus might have devices powered
from 1.8 V, 3.3 V, and 5 V.
X They both operate on the same speed up to 100 kHz, but the I2C primer has Figure 18. Node address.
400 kHz and 2 MHz versions. A 7-bit destination address is sent from the main to one or more devices (such
X The SMBus provides for a minimum clock speed and limits the amount the as with the general call address) on the bus.
clock may be stretched in one transaction. A violation of the timeout limits
Note the start and stop conditions are transitions, not bits, and are shown with-
causes all SMBus devices to reset their I/O logic to allow the bus to restart.
out a bit count number above the symbol. When shown in a transaction diagram,
This enhances the robustness of the bus.
the repeated start is also a transition, not a bit, and is shown without a bit count
X The timeout for both is also different. The I2C primer has no timeout while above the symbol.
the SMBus has a timeout—consider 35 ms for a 10 kHz minimum clock speed.
X Packet error checking (PEC) was originally defined for SMBus. A packet error
code byte is added at the end of each transaction.
X Some of the remaining differences involve transfer types, alert line, suspend Figure 19. An SMBus message.
line, and power down or up. SMBus Timing Measurements
It is an explicit requirement that an SMBus device must acknowledge (ACK) its
Table 6. SMBus Parameters
own address every time it is received, regardless of what else the device may be
doing. This assures that a main device can accurately determine what devices Symbol Parameters Units
are active on the bus. fSMB SMBus operating frequency kHz
All SMBus transactions are carried out through one of the specified SMBus protocols. tBUF Bus free time between stop and start condition µs
THD-STA Hold time after (repeated) start condition µs
The SMBus includes an optional signal, SMBALERT#, that node devices can use to
TSU-STA Repeated start condition set-up time µs
quickly notify the main or system host that it has information for the main, such
as reporting a fault condition. tSU(STO) Stop condition set-up time µs
tHD(DAT) Data hold time ns
tSU(DAT) Data set-up time ns
tTIMEOUT Detect clock low timeout ms
tLOW Clock low period µs
tHIGH Clock high period µs
VISIT ANALOG.COM 7
PMBus: Power Management Redefined Pull-Ups
In addition to SMBus comes a variant, the PMBus, which is an open standard Only weak pull-up resistors shall be on the SCL or SDA lines inside the power
power management protocol. This flexible and highly versatile standard allows supply. The main pull-up resistors are provided by the system and may be con-
for communication between devices based on both analog and digital technolo- nected to 3.3 V or 5 V. For the system design, the main pull-ups shall be located
gies, and provides true interoperability, which will reduce design complexity and external to the power supply and derive their power from the standby rail.
shorten time to market for power system designers.
Data Speed
PMBus is used in digital management of power supplies with power control and The PMBus device in the power supply shall operate at the full 100 kbps SMBus
management components. It has commands and structures to support the require-
speed and avoid using clock stretching as much as possible, as it can slow down
ment for power management. This means both I2C primer and PMBus are compatible
the bus.
and interoperable on the electrical requirements and command semantics.
One of the essential parameters in power management is monitoring of overvolt- Summary
age level, and PMBus provides a command for setting and reading it. By adding Table 8 provides a general view and summary in terms of specifications:
to the available features of I2C primer and SMBus, PMBus acts as a protocol layer signaling, timing, and electrical among I2C Primer, SMBus (both for high and low
on top of the existing standards, especially the SMBus. power), and PMBus.
The I2C specification only describes the physical layer, timing, and flow control
How Are I2C Primer, SMBus, and PMBus Related?
of a 2-wire bus. The I2C specification does not describe the format of messages
(like the SMBus protocols) and does not describe the content of the messages. Originally developed to facilitate battery management systems, SMBus uses I2C
hardware but adds second-level software, which ultimately allows devices to be
The PMBus specification is a complete power management protocol. It includes hot swapped without restarting the system. PMBus extends SMBus by defining
how to get the bits and bytes from one device to another (that is, transport); it a set of device commands specifically designed to manage power converters,
also describes a command language that gives meaning to those bits and bytes. exposing device attributes such as measured voltage, current, temperature,
and more. In general, I2C primer, SMBus, and PMBus devices can share a bus
Addressing
without any major issues.
For redundant systems there are up to three signals to set the address location
of the power supply once it is installed in the system: Address2, Address1, and I2C, SMB, PMB Advantages
Address0. For non-redundant systems, the power supply device address location X Only uses two wires
should be B0h. X With ACK/NACK bit
Hardware X Well-known protocol
The device in the power supply shall be compatible with SMBus 2.0 high power
X Supports multiple main devices and multiple nodes
specifications for I2C VDD-based power and drive (for VDD = 3.3 V). This bus shall X Hardware is less complicated than UART
operate at 3.3 V. X Widely used method
VIL(MAX) – 0.15 V
VIL(MAX) – 0.15 V
tBUF
P S S P
For regional headquarters, sales, and distributors or ©2021 Analog Devices, Inc. All rights reserved. VISIT ANALOG.COM
to contact customer service and technical support, Trademarks and registered trademarks are
visit analog.com/contact. the property of their respective owners.