NXP UM10204 User Manual

UM10204
I2C-bus specification and user manual
Rev. 4 — 13 February 2012 User manual
Document information
Info Content Keywords I2C, I2C-bus, Standard-mode, Fast-mode, Fast-mode Plus, Fm+,
Ultra Fast-mode, UFm, High Speed, Hs, inter-IC, SDA, SCL, USDA, USCL
Abstract Philips Semiconductors (now NXP Semiconductors) developed a simple
bidirectional 2-wire bus for efficient inter-IC control. This bus is called the Inter-IC or I (SDA) and a serial clock line (SCL). Serial, 8-bit oriented, bidirectional data transfers can be made at up to 100 kbit/s in the Standard-mode, up to 400 kbit/s in the Fast-mode, up to 1 Mbit/s in the Fast-mode Plus (Fm+), or up to 3.4 Mbit/s in the High-speed mode . The Ultra Fast-mode is a uni-directional mode with data transfers of up to 5 Mbit/s.
2
C-bus. Only two bus lines are required: a serial data line
NXP Semiconductors
UM10204
I2C-bus specification and user manual
Revision history
Rev Date Description
v.4 20120213 Update user manual. Modifications: The format of this document has been redesigned to comply with the new identity guidelines of
NXP Semiconductors.
Legal texts have been adapted to the new company name where appropriate.
Table “Document information”: added keywords “Ultra Fast-mode”, “UFm”, “USDA” and “USCL”
New Section 3.1 created and (old) sections 3.1 to 3.17 are moved under this new section and
renumbered to Section 3.1.1
to Section 3.1.17.
Section 3.1.12 “Reserved addresses”, added descriptive line below title of Table 3
Added (new) Table 4 “Assigned manufacturer IDs”
Added (new) Section 3.2 “Ultra Fast-mode I
2
C-bus protocol”
Added (new) Section 4.6 “Display Data Channel (DDC)”
added (new) Section 5.4 “Ultra Fast-mode”
Table 9 “Characteristics of the SDA and SCL I/O stages”:
symbol Vsymbol Vparameter description for tof corrected from “output fall time from V
time from V
– t
Min values for Fast-mode and Fast-mode Plus are changed to “20 ns (VDD/5.5V)”
of
: deleted condition “VDD> 2 V”; deleted condition “VDD< 2 V” and its values
hys
replaced with symbol V
OL3
IHmin
to V
ILmax
”.
; added (new) Table note [3]
OL2
IHmax
to V
ILmax
” to “output
Table 10 “Characteristics of the SDA and SCL bus lines for Standard, Fast, and Fast-mode Plus
I2C-bus devices
– t
Min value for Fast-mode changed from “20 + 0.1Cbns” to “20 ns”
r
tf Min values for Fast-mode and Fast-mode Plus are changed to “20 ns (VDD/5.5V)”
Table 11 “Characteristics of the SDAH, SCLH, SDA and SCL I/O stages for Hs-mode I
devices”: second Condition for VOL changed from “VDD< 2 V” to “VDD≤ 2V”
[1]
:
2
C-bus
Added (new) Section 6.3 “Ultra Fast-mode devices”.
Section 7.1 “Pull-up resistor sizing”, third paragraph changed from “... is a function of the rise time
minimum (tr) ...” to “... is a function of the rise time maximum (tr) ...”
v.3 20070619 Many of today’s applications require longer buses and/or faster speeds. Fast-mod e Plus was
introduced to meet this need by increasing drive strength by as much as 10× and increasing the data rate to 1 Mbit/s while maintaining downward compatibility to Fast-mode and Standard-mode speeds and software commands.
2
v2.1 2000 Version 2.1 of the I
2
v2.0 1998 The I
v1.0 1992 Version 1.0 of the I Original 1982 first release
C-bus has become a de facto world standard that is now implemented in over 1000 different ICs and licensed to more than 50 companies. Many of today’s applications, however, require higher bus speeds and lower supply voltages. This updated version of the I requirements.
C-bus specification
2
C-bus specification
2
C-bus specification meets those
Contact information
For more information, please visit: http://www.nxp.com For sales office addresses, please send an email to: salesaddresses@nxp.com
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 2 of 64
NXP Semiconductors

1. Introduction

UM10204
I2C-bus specification and user manual
The I2C-bus is a de facto world standard that is now implemented in over 1000 different ICs manufactured by more than 50 companies. Additionally, the versatile I in various control architectures such as System Management Bus (SMBus), Power Management Bus (PMBus), Intelligent Platform Management Interface (IPMI), Display Data Channel (DDC) and Advanced Telecom Computing Architecture (ATCA).
This document assists device and system designers to underst and how the I and implement a working application. Various operating modes are described. It contains a comprehensive introduction to the I arbitration schemes. Detailed sections cover the timing and electrica l specifications for the
2
I
C-bus in each of its operating modes.
Designers of I that new devices meet all limits specified in this document. Designers of systems that include I data sheets.

2. I2C-bus features

In consumer electronics, telecommunications and industrial electronics, there are often many similarities between seemingly unrelated designs. For example, nearly every system includes:
Some intelligent control, usually a single-chip microcontroller
General-purpose circuits like LCD and LED drivers, remote I/O ports, RAM,
EEPROM, real-time clocks or A/D and D/A converters
Application-oriented circuits such as digital tuning and signal processing circuits for
radio and video systems, temperature sensors, and smart cards
2
C-bus is used
2
C-bus works
2
C-bus data transfer, handshaking and bus
2
C-compatible chips should use this document as a refe rence and ensure
2
C devices should review this document and also refer to individual component
To exploit these similarities to the benefit of both systems designers and equipment manufacturers, as well as to maximize hardware efficiency and circuit simplicity, Philips Semiconductors (now NXP Semiconductors) developed a simple bidirectional 2-wire bus for efficient inter-IC control. This bus is called the Inter IC or I compatible devices incorporate an on-chip interface which allows them to communicate directly with each other via the I problems encountered when designing digital control circuits.
Here are some of the features of the I
2
C-bus. This design concept solves the many interfacing
2
C-bus:
2
C-bus. All I2C-bus
Only two bus lines are required; a serial data line (SDA) and a serial clock line (SCL).
Each device connected to the bus is software addressable by a unique address and
simple master/slave relationships exist at all times; masters can operate as master-transmitters or as master-receivers.
It is a true multi-master bus including collision detection and arbitration to prevent data
corruption if two or more masters simultaneously initiate data transfer.
Serial, 8-bit oriented, bidirectional data transfers can be made at up to 100 kbit/s in
the Standard-mode, up to 400 kbit/s in the Fast-mode, up to 1 Mbit/s in Fast-mode Plus, or up to 3.4 Mbit/s in the High-speed mode.
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 3 of 64
NXP Semiconductors
I2C A/D or D/A Converters
I2C
General Purpose
I/O Expanders
I
2
C
LED Controllers
V
DD4
I2C
Repeaters/
Hubs/Extenders
I2C
DIP Switches
V
DD5
I2C
Slave
V
DD0
V
DD1
PCA9541
I
2
C
Master Selector/
Demux
I2C
Multiplexers
and Switches
V
DD2
I2C Port
via HW or
Bit Banging
I2C
Bus Controllers
MCUs
8
MCUs
I2C
Serial EEPROMs
LCD Drivers
(with I
2
C)
I
2
C
Real Time Clock/
Calendars
V
DD3
I2C
Temperature
Sensors
Bridges
(with I
2
C)
SPI
UART
USB
002aac858
Serial, 8-bit oriented, unidirectional data transfers up to 5 Mbit/s in Ultra Fast-mode
On-chip filtering rejects spikes on the bus data line to preserve data integrity.
The number of ICs that can be connected to the same bus is limited only by a
UM10204
I2C-bus specification and user manual
maximum bus capacitance. More capacitance may be allowed under some conditions. Refer to Section 7.2
.
Figure 1
shows an example of I2C-bus applications.
Fig 1. Example of I2C-bus applications

2.1 Designer benefits

I2C-bus compatible ICs allow a system design to progress rapidly directly from a functional block diagram to a prototype. Moreover, since they ‘clip’ directly onto the
2
I modified or upgraded simply by ‘clipping’ or ‘unclipping’ ICs to or from the bus.
Here are some of the features of I
C-bus without any additional external interfacing, they allow a prototype system to be
2
C-bus compatible ICs that are particularly attractive to
designers:
Functional blocks on the block diagram correspond with the actual ICs; designs
proceed rapidly from block diagram to final schematic.
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
No need to design bus interfaces because the I
on-chip.
User manual Rev. 4 — 13 February 2012 4 of 64
2
C-bus interface is already integrated
NXP Semiconductors
Integrated addressing and data-transfer protocol allow systems to be completely
The same IC types can often be used in many different applications.
Design-time reduces as designers quickly become familiar with the frequently used
ICs can be added to or removed from a system without affecting any other circuits on
Fault diagnosis and debugging are simple; malfunctions can be immediately traced.
Software development time can be reduced by assembling a library of reusable
In addition to these advantages, the CMOS ICs in the I designers special features which are particularly attractive for portab le equipment and battery-backed systems.
They all have:
Extremely low current consumption
High noise immunity
Wide supply voltage range
Wide operating temperature range.
software-defined.
functional blocks represented by I
the bus.
software modules.
I2C-bus specification and user manual
2
C-bus compatible ICs.
2
C-bus compatible range offer
UM10204

2.2 Manufacturer benefits

I2C-bus compatible ICs not only assist designers, they also give a wide range of benefits to equipment manufacturers because:
The simple 2-wire serial I
and there are not so many PCB tracks; result — smaller and less expensive PCBs.
The completely integrated I
and other ‘glue logic’.
The multi-master capability of the I
end-user equipment via external connections to an assembly line.
The availability of I
space requirements even more.
These are just some of the benefits. In addition, I design flexibility by allowing simple construction of equipment variants and easy upgrading to keep designs up-to-date. In this way, an entire family of equipment can be developed around a basic model. Upgrades for new equipment, or enhanced-feature models (that is, extended memory, remote control, etc.) can then be produced simply by clipping the appropriate ICs onto the bus. If a larger ROM is needed, it is simply a matter of selecting a microcontroller with a larger ROM from our comprehensive range. As new ICs supersede older ones, it is easy to add new features to equipment or to increase its performance by simply unclipping the outdated IC from the bus and clipping on its successor.
2
C-bus minimizes interconnections so ICs have fewer pins
2
C-bus protocol eliminates the need for address decoder s
2
C-bus allows rapid testing and alignment of
2
C-bus compatible ICs in various leadless packages reduces
2
C-bus compatible ICs increase system
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 5 of 64
NXP Semiconductors

2.3 IC designer benefits

Designers of microcontrollers are frequently under pressure to conserve output pins. The
2
I
C protocol allows connection of a wide variety of peripherals without the need for
separate addressing or chip enable signals. Additionally, a microcontroller that includes an
2
I
C interface is more successful in the marketplace due to the wide variety of existing
peripheral devices available.

3. The I2C-bus protocol

3.1 Standard-mode, Fast-mode and Fast-mode Plus I2C-bus protocols

Two wires, serial da ta (SDA) and serial clock (SCL), carry information between the devices connected to the bus. Each device is recognized by a unique address (whether it is a microcontroller, LCD driver, memory or keyboard interface) and can operate as either a transmitter or receiver, depending on the function of the device. An LCD driver may be only a receiver , whereas a memory can b oth receive and transmit data. In ad dition to transmitters and receivers, devices can also be considered as masters or slaves when performing data transfers (see Table 1 transfer on the bus and generates the clock signals to permit that transfer. At that time, any device addressed is considered a slave.
T able 1. Definition of I2C-bus terminology
Term Description
Transmitter the device which sends data to the bus Receiver the device which receives data from the bus Master the device which initiates a transfer, generates clock signals and
Slave the device addressed by a master Multi-master more than one master can attempt to control the bus at the same time
Arbitration procedure to ensure that, if more than one master simultaneously tries to
Synchronization procedure to synchronize the clock signals of two or more devices
UM10204
I2C-bus specification and user manual
). A master is the device which initiates a data
terminates a transfer
without corrupting the message
control the bus, only one is allowed to do so and the winning message is not corrupted
The I2C-bus is a multi-master bus. This means that more than one device capable of controlling the bus can be connected to it. As masters are usually microcontrollers, let us consider the case of a data transfer between two microcontrollers connected to the
2
I
C-bus (see Figure 2).
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 6 of 64
NXP Semiconductors
mbc645
SDA SCL
MICRO ­CONTROLLER A
STATIC RAM OR EEPROM
LCD DRIVER
GATE ARRAY
ADC
MICRO ­CONTROLLER B
Fig 2. Example of an I2C-bus configuration using two microcontrol le rs
This example highlights the master-slave and receiver-transmitter relationships found on the I direction of data transfer at that time. The transfer of data would proceed as follows:
UM10204
I2C-bus specification and user manual
2
C-bus. Note that these relationships are not permanent, but only depend on the
1. Suppose microcontroller A wants to send information to microcontroller B:
microcontroller A (master), addresses microcontroller B (slave)microcontroller A (master-transmitter), sends data to microcontroller B
(slave-receiver)
– microcontroller A terminates the transfer.
2. If microcontroller A wants to receive information from microcontroller B:
microcontroller A (master) addresses microcontroller B (slave)microcontroller A (master-receiver) receives data from microcontroller B
(slave-transmitter)
– microcontroller A terminates the transfer.
Even in this case, the master (microcontroller A) generates the timing and terminates the transfer.
2
The possibility of connecting more than one microcontroller to the I
C-bus means that more than one master could try to initiate a data transfer at the same time. To avoid the chaos that might ensue from such an event, an arbitration pro cedure has been developed. This procedure relies on the wired-AND connection of all I
2
C interfaces to the I2C-bus.
If two or more masters try to put information onto the bus, the first to pr oduce a ‘one’ when the other produces a ‘zero’ loses the arbitration. The clock sign als dur ing ar bitr ation are a synchronized combination of the clocks generated by the masters using the wired-AND connection to the SCL line (for more detailed information concerning arbitration see
Section 3.1.8
).
Generation of clock signals on the I each master generates its own clock signals when transferrin g dat a on the bus. Bus clock
2
C-bus is always the responsibility of master devices;
signals from a master can only be altered when they are stretched by a slow slave device holding down the clock line or by another master when arbitration occurs.
Table 2
summarizes the use of mandatory and optional portions of the I2C-bus
specification and which system configurations use them.
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 7 of 64
NXP Semiconductors
CMOS CMOS NMOS BIPOLAR
002aac860
V
DD1
=
5 V ± 10 %
R
p
R
p
SDA
SCL
V
DD2
V
DD3
T able 2. Applicability of I2C-bus protocol features
M = mandatory; O = optional; n/a = not applicable.
Feature Configuration
START condition M M M STOP condition M M M Acknowledge M M M Synchronization n/a M n/a Arbitration n/a M n/a Clock stretching O 7-bit slave address M M M 10-bit slave address O O O General Call address O O O Software Reset O O O START byte n/a O Device ID n/a n/a O
UM10204
I2C-bus specification and user manual
Single master Multi-master Slave
[2]
[2]
O
[3]
O
n/a
[1]
[1] Also refers to a master acting as a slave. [2] Clock stretching is a feature of some slaves. If no slaves in a system can stretch the clock (hold SCL LOW),
the master need not be designed to handle this procedure.
[3] ‘Bit banging’ (software emulation) multi-master systems should consider a START byte. See
Section 3.1.15
.

3.1.1 SDA and SCL signals

Both SDA and SCL are bidirectional lines, connected to a positive supply voltage via a current-source or pull-up resistor (see Figure 3 HIGH. The output stages of devices connected to the bus must have an open-drain or open-collector to perform the wired-AND function. Data on th e I at rates of up to 100 kbit/s in the Standard-mode, up to 400 kbit/s in the Fast-mode, up to 1 Mbit/s in Fast-mode Plus, or up to 3.4 Mbit/s in the High-speed mode. The bus capacitance limits the number of interfaces connected to the bus.
For a single master application, the master’s SCL output can be a push-pull driver design if there are no devices on the bus which would stretch the clock.
). When the bus is free, both lines are
2
C-bus can be transferred
V
, V
DD2
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 8 of 64
Fig 3. Devices with various supply voltages sharing the same bus
are device-dependent (for example, 12 V).
DD3
NXP Semiconductors
mba607
data line
stable;
data valid
change
of data
allowed
SDA
SCL
mba608
SDA
SCL
P
STOP condition
S
START condition

3.1.2 SDA and SCL logic levels

UM10204
I2C-bus specification and user manual
Due to the variety of different technology devices (CMOS, NMOS, bipolar) that can be connected to the I and depend on the associated level of V 70 % of V
; VIL is 0.3VDD and VIH is 0.7VDD. See Figure 38, timing diagram. Some
DD
legacy device input levels were fixed at V require this 30 %/70 % specification. See Section 6

3.1.3 Data validity

The data on the SDA line must be stable during the HIGH period of the clock. The HIGH or LOW state of the data line can only change when the clock signal on the SCL line is LOW (see Figure 4
Fig 4. Bit transfer on the I2C-bus
2
C-bus, the levels of the logical ‘0’ (LOW) and ‘1’ (HIGH) are not fixed
. Input reference levels are set as 30 % and
DD
= 1.5 V and VIH= 3.0 V, but all new devices
IL
for electrical specifications.
). One clock pulse is generated for each data bit transferred.

3.1.4 START and STOP conditions

All transactions begin with a START (S) and are terminated by a STOP (P) (see Figure 5). A HIGH to LOW transition on the SDA line while SCL is HIGH defines a START condition. A LOW to HIGH transition on the SDA line while SCL is HIGH defines a STOP condition.
Fig 5. START and STOP conditions
START and STOP conditions ar e a lwa ys ge ne ra te d by the m aster. The bus is considered to be busy after the START condition. The bus is considered to be free again a cert ain time after the STOP condition. This bus free situation is specified in Section 6
The bus stays busy if a repeated START (Sr) is generated instead of a STOP condition. In this respect, the ST ART (S) and repeated START (Sr) conditions are functionally identical. For the remainder of this document, therefore, the S symbol is used as a generic ter m to represent both the START and repeated START conditions, unless Sr is particularly relevant.
.
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 9 of 64
NXP Semiconductors
S or Sr Sr or P
SDA
SCL
MSB
1 2 7 8 9 1 2 3 to 8 9
ACK ACK
002aac861
START or
repeated START
condition
STOP or
repeated START
condition
acknowledgement
signal from slave
byte complete,
interrupt within slave
clock line held LOW while interrupts are serviced
P
Sr
acknowledgement
signal from receiver
Detection of START and STOP conditions by devices connected to the bus is easy if they incorporate the necessary interfacing hardwar e. However, microcontroller s with no such interface have to sample the SDA line at least twice per clock period to sense the transition.

3.1.5 Byte format

Every byte put on the SDA line must be eight bits long. The number of bytes that can be transmitted per transfer is unrestricted. Each byte must be followed by an Acknowledge bit. Data is transferred with the Most Significant Bit (MSB) first (see Figure 6 cannot receive or transmit another complete byte of dat a until it has performed some other function, for example servicing an internal interrupt, it can hold the clock line SCL LOW to force the master into a wait state. Data tr ansfer then continue s when th e slave is ready for another byte of data and releases clock line SCL.
UM10204
I2C-bus specification and user manual
). If a slave
Fig 6. Data transfer on the I2C-bus

3.1.6 Acknowledge (ACK) and Not Acknowledge (NACK)

The acknowledge takes place after e very byte. The acknowledge bit allows the receiver to signal the transmitter that the byte was successfully received and another byte may be sent. The master generates all clock pulses, including the acknowledge ninth clock pulse.
The Acknowledge signal is defined as follows: the transmitter releases the SDA line during the acknowledge clock pulse so the receiver can pull the SDA line LOW and it remains stable LOW during the HIGH period of th is clock pulse (see Figure 4 hold times (specified in Section 6
When SDA remains HIGH during this ninth clock pulse, this is defined as the Not Acknowledge signal. The master can then generate either a STOP condition to abort the transfer, or a repeated START condition to start a new transfer. There are five conditions that lead to the generation of a NACK:
1. No receiver is present on the bus with the transmitted address so there is no device to respond with an acknowledge.
2. The receiver is unable to receive or transmit because it is performing some real-time function and is not ready to start communication with the master.
3. During the transfer, the receiver gets data or commands that it does not understand.
4. During the transfer, the receiver cannot receive any more data bytes.
5. A master-receiver must signal the end of the transfer to the slave transmitter.
) must also be taken into account.
). Set-up and
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 10 of 64
NXP Semiconductors
CLK
1
CLK
2
SCL
counter reset
wait
state
start counting
HIGH period
mbc632

3.1.7 Clock synchronization

Two masters can begin transmitting on an idle bus at the same time and there must be a method for deciding which takes control of the bus and complete its transmission. This is done by clock synchronization and arbitration. In single master systems, clock synchronization and arbitration are not needed.
Clock synchronization is performed using the wired-AND connection of I the SCL line. This means that a HIGH to LOW transition on the SCL line causes the masters concerned to start counting off their LOW period and, once a master clock has gone LOW, it holds the SCL line in that state until the clock HIGH state is reached (see
Figure 7
transition of this clock may not change the sta te of the SCL line. Th e SCL line is therefore held LOW by the master with the longest LOW period. Masters with shorter LOW periods enter a HIGH wait-state during this time.
UM10204
I2C-bus specification and user manual
2
C interfaces to
). However, if another clock is still within its LOW period, the LOW to HIGH
Fig 7. Clock synchronization during the arbitration procedure
When all masters concerned have counted off their LOW period, the clock line is released and goes HIGH. There is then no difference between the master clocks and the state of the SCL line, and all the masters start counting their HIGH periods. The first master to complete its HIGH period pulls the SCL line LOW again.
In this way , a synchronized SCL clock is gene rated with its LOW period determined by the master with the longest clock LOW period, and its HIGH period determined by the one with the shortest clock HIGH period.

3.1.8 Arbitration

Arbitration, like synchronization, refe rs to a portio n of th e pr ot oco l req u ire d on ly if mo re than one master is used in the system. Slaves are not involved in the arbitration procedure. A master may start a transfer only if the bus is free. Two masters may generate a START condition within the minimum hold tim e (t condition which results in a valid START condition on the bus. Arbitration is then required to determine which master will complete its transmission.
Arbitration proceeds bit by bit. During every bit, while SCL is HIGH, each master checks to see if the SDA level matches what it has sent. This process may take many bits. Two masters can actually complete an entire transaction without error, as long as the
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 11 of 64
) of the START
HD;STA
NXP Semiconductors
msc609
DATA
1
DATA
2
SDA
SCL
S
master 1 loses arbitration
DATA 1 SDA
transmissions are identical. The first time a master tries to send a HIGH, but detects that the SDA level is LOW, the master knows that it has lost the arbitration and turns off its SDA output driver. The othe r master goes on to complete its transaction.
No information is lost during the arbitration process. A master that loses the arbitration can generate clock pulses until the end of the byte in which it loses the arbitration and must restart its transaction when the bus is idle.
If a master also incorporates a slave function and it loses arbitration during the addressing stage, it is possible that the winning master is trying to address it. The losing maste r must therefore switch over immediately to its slave mode.
UM10204
I2C-bus specification and user manual
Figure 8
shows the arbitration procedure for two masters. More may be involved depending on how many masters are connected to the bus. The moment there is a difference between the internal data level of the master generating DATA1 and the actual level on the SDA line, the DATA1 output is switched off. This does not affect the data transfer initiated by the winning master.
Fig 8. Arbitration procedure of two masters
Since control of the I2C-bus is decided solely on the address and data sen t by competing masters, there is no central master, nor any order of priority on the bus.
There is an undefined condition if the arbitration procedure is still in progress at the moment when one master sends a repeated START or a STOP condition while the other master is still sending data. In other words, the following combinations result in an undefined condition:
Master 1 sends a repeated START condition and master 2 sends a data bit.
Master 1 sends a STOP condition and master 2 sends a data bit.
Master 1 sends a repeated START condition and master 2 sends a STOP condition.
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 12 of 64
NXP Semiconductors
S
1 - 7 8 9 1 - 7 8 9 1 - 7 8 9
P
STOP
condition
START
condition
DATA ACKDATA ACKADDRESS ACKR/W
SDA
SCL
mbc604
mbc608
R/W
LSBMSB
slave address

3.1.9 Clock stretching

Clock stretching pauses a transaction by holding the SCL line LOW. The transaction cannot continue until the line is released HIGH again. Clock stretching is optional and in fact, most slave devices do not include an SCL driver so they are unable to stretch the clock.
On the byte level, a device may be able to receive bytes of data at a fast rate, but needs more time to store a received byte or prepare another byte to be transmitted. Slaves can then hold the SCL line LOW after reception and acknowledgment of a byte to force the master into a wait state until the slave is ready for the next byte transfer in a type of handshake procedure (see Figure 7
On the bit level, a device such as a microcontroller with or without limited har dware for the
2
C-bus, can slow down the bus clock by extending each clock LOW period. The speed of
I any master is adapted to the internal operating rate of this device.
UM10204
I2C-bus specification and user manual
).
In Hs-mode, this handshake feature can only be used on byte level (see Section 5.3.2

3.1.10 The slave address and R/W bit

Data transfers follow the format shown in Figure 9. After the START condition (S), a slave address is sent. This address is seven bits long followed by an eighth bit which is a data direction bit (R/W request for data (READ) (refer to Figure 10 STOP condition (P) generated by the master. However, if a master still wishes to communicate on the bus, it can generate a repeated START condition (Sr) and address another slave without first generating a STOP condition. Various combinations of read/write formats are then possible within such a transfer.
) — a ‘zero’ indicates a transmission (WRITE), a ‘one’ indicates a
).
). A data transfer is always terminated by a
Fig 9. A complete data transfer
Fig 10. The first byte after the START procedure
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 13 of 64
NXP Semiconductors
Possible data transfer formats are:
Master-transmitter transmits to slave-receiver. The transfer direction is not changed
Master reads slave immediately after first byte (see Figure 12). At the moment of the
Combined format (see Figure 13). During a change of direction within a transfer, the
Notes:
1. Combined formats can be used, for example, to control a serial memory. The internal
2. All decisions on auto-increment or decrement of previously accessed memory
3. Each byte is followed by an acknowledgment bit as indicated by the A or A
4. I
5. A START condition immediately followed by a STOP condition (void message) is an
6. Each device connected to the bus is addressable by a unique address. Normally a
UM10204
I2C-bus specification and user manual
(see Figure 11
first acknowledge, the master-transmitter becomes a master-receiver and the slave-receiver becomes a slave-transmitter. This first acknowledge is still generated by the slave. The master generates subsequent acknowledges. The STOP condition is generated by the master , which sends a not-acknowledge ( A condition.
START condition and the slave address are both repeated, but with the R/W reversed. If a master-receiver sends a repeated START condition, it sends a not-acknowledge (A
memory location must be written during the first data byte. After the START condition and slave address is repeated, data can be transferred.
locations, etc., are taken by the designer of the device.
the sequence.
2
C-bus compatible devices must reset their bus logic on receipt of a START or repeated START condition such that they all anticipate the sending of a slave address, even if these START conditions are not positioned according to the proper format.
illegal format. Many devices however are designed to operate properly under this condition.
simple master/slave relationship exists, but it is possible to have multiple identical slaves that can receive and respond simultaneously, for example in a group broadcast. This technique works best when using bus switching devices like the PCA9546A where all four channels are on and identical devices are con figured a t the same time, understanding that it is impossible to determine that each slave acknowledges, and then turn on one channel at a time to read back each individual device’s configuration to confirm the programming. Refer to individual component data sheets.
). The slave receiver acknowledges each byte.
) just before the STOP
bit
) just before the repeated START condition.
blocks in
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 14 of 64
NXP Semiconductors
mbc605
A/A
A
'0' (write)
data transferred
(n bytes + acknowledge)
A = acknowledge (SDA LOW) A = not acknowledge (SDA HIGH) S = START condition P = STOP condition
R/W
from master to slave
from slave to master
DATADATAASLAVE ADDRESSS P
mbc606
A
(read)
data transferred
(n bytes + acknowledge)
R/W A1PDATADATASLAVE ADDRESSSA
mbc607
DATAAR/W
read or write
A/A
DATAAR/W
(n bytes
+ ack.)
*
direction of transfer may change at this point.
read or write
(n bytes
+ ack.)
*
Sr = repeated START condition
A/A
*
not shaded because transfer direction of data and acknowledge bits depends on R/W bits.
SLAVE ADDRESSSSrPSLAVE ADDRESS
Fig 11. A maste r-tran smitter addressing a slave receiver with a 7-bit address
UM10204
I2C-bus specification and user manual
(the transfer direction is not changed)
Fig 12. A master reads a slave immediately after the first byte
Fig 13. Combined format

3.1.11 10-bit addressing

10-bit addressing expands the number of possible addresses. Devices with 7-bit and 10-bit addresses can be connected to the same I addressing can be used in all bus speed modes. Currently, 10-bit addressing is not being widely used.
The 10-bit slave address is formed from the first two bytes following a START condition (S) or a repeated START condition (Sr).
2
C-bus, and both 7-bit and 10-bit
The first seven bits of the first byte are the combination 11 11 0XX of which the last two bits (XX) are the two Most-Significant Bits (MSB) of the 10-bit address; the eighth bit of the first byte is the R/W
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 15 of 64
Although there are eight possible combina tions of the reserved address bits 1111 XXX, only the four combinations 1111 0XX are used for 10-bit addressing. The remaining four combinations 1111 1XX are reserved for future I
bit that determines the direction of the messag e.
2
C-bus enhancements.
NXP Semiconductors
mbc613
R/W
A1
(write)
A2
A
A/A
1 1 1 1 0 X X 0
SLAVE ADDRESS
1st 7 BITS
S DATA PDATA
SLAVE ADDRESS
2nd BYTE
mbc614
R/W A1
(write)
A3 DATA DATAA2 R/W
(read)
1 1 1 1 0 X X 0 1 1 1 1 0 X X 1
A
APSr
SLAVE ADDRESS
1st 7 BITS
SLAVE ADDRESS
2nd BYTE
SLAVE ADDRESS
1st 7 BITS
S
All combinations of read/write formats prev iously described for 7-bit addressing are possible with 10-bit addressing. Two are detailed here:
Master-transmitter transmits to slave-receiver with a 10-bit slave address.
Master-receiver reads slave-transmitter with a 10-bit slave address.
UM10204
I2C-bus specification and user manual
The transfer direction is not changed (see Figure 14 a START condition, each slave compares the first seven bits of the first byte of the slave address (1111 0XX) with its own address and tests if the eighth bit (R/W direction bit) is 0. It is possible that more than one device finds a match and generate an acknowledge (A1). All slaves that found a match compare the eight bits of the second byte of the slave address (XXXX XXXX) with their own addresse s, but only one slave finds a match and generates an acknowledge (A2). The matching slave remains addressed by the master until it receive s a ST OP co nditio n (P) o r a repe ated START condition (Sr) followed by a different slave address.
The transfer direction is changed after the second R/W including acknowledge bit A2, the procedure is the same as that described for a master-transmitter addressing a slave-receiver. After the repeated START condition (Sr), a matching slave remembers that it was addressed before. This slave then checks if the first seven bits of the first byte of the slave address following Sr are the same as they were after the START condition (S), and tests if the eighth (R/W If there is a match, the slave considers that it has been addressed as a transmitter and generates acknowledge A3. The slave-transmitter remains addressed until it receives a STOP condition (P) or until it receives another repeated START condition (Sr) followed by a different slave address. After a repeated START condition (Sr), all the other slave devices will also compare the first seven bits of the first byte of the slave address (1111 0XX) with their own addresses and test the eighth (R/W However, none of them will be addressed because R/W 1111 0XX slave address (for 7-bit devices) does not match.
). When a 10-bit address follows
bit (Figure 15). Up to and
) bit is 1.
) bit.
= 1 (for 10-bit devices), or the
Fig 14. A master-transmitter addresses a slave-receiver with a 10-bit address
Fig 15. A master-receiver addresses a slave-transmitter with a 10-bit address
Slave devices with 10-bit addressing react to a ‘general call’ in the same way as slave devices with 7-bit addressing. Hardware masters can transmit their 10-bit address after a ‘general call’. In this case, the ‘general call’ address byte is followed by two successive bytes containing the 10-bit address of the master-transmitter. The format is as shown in
Figure 15
where the first DATA byte contains the eight least-significant bits of the master
address.
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 16 of 64
NXP Semiconductors
The START byte 0000 0001 (01h) can precede the 10-bit addressing in the same way as for 7-bit addressing (see Section 3.1.15

3.1.12 Reserved addresses

Two groups of eight addresses (0000 XXX and 1111 XXX) are reserved for the purposes shown in Table 3
Table 3. Reserved addresses
X = don’t care; 1 = HIGH; 0 = LOW.
Slave address R/W bit Description
0000 000 0 general call address 0000 000 1 START byte 0000 001 X CBUS address 0000 010 X reserved for different bus format 0000 011 X reserved for future purposes 0000 1XX X Hs-mode master code 11111XX X reserved for future purposes 1111 0XX X 10-bit slave addressing
UM10204
I2C-bus specification and user manual
).
.
[1]
[2]
[3]
[4]
[1] The general call address is used for several functions including software reset. [2] No device is allowed to acknowledge at the reception of the START byte. [3] The CBUS address has been reserved to enable the inter-mixing of CBUS compatible and I
compatible devices in the same system. I reception of this address.
[4] The address reserved for a different bus format is included to enable I
2
C-bus compatible devices that can work with such formats and protocols are allowed to respond to
Only I this address.
Assignment of addresses within a local system is up to the system architect who must take into account the devices being used on the bus and any future interaction with other conventional I
2
C-buses. For example, a device with seven user-assignable address pins allows all 128 addresses to be assigned. If it is known that the reserved address is never going to be used for its intended purpose, a reserved addre ss can be used for a slave address.
2
C-bus committee coordinates allocation of I2C addresses. Further information can
The I be obtained from the NXP web site www.nxp.com/i2c

3.1.13 General call address

The general call address is for addressing every device connected to the I2C-bus at the same time. However, if a device does not need any of the data supplied within the general call structure, it can ignore this address by not issuing an acknowledgment. If a device does require data from a general call address, it acknowledges this address and behave as a slave-receiver. The master does not actually know how many devices acknowledged if one or more devices respond. The second and following bytes are acknowledged by every slave-receiver capable of handling this data. A slave who cannot process one of these bytes must ignore it by not-acknowledging. Again, if one or more slaves acknowledge, the not-acknowledge will not be seen by the master. The meaning of the general call address is always specified in the second byte (see Figure 16
2
2
C-bus compatible devices are not allowed to respond on
2
C and other protocols to be mixed.
C-bus
.
).
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 17 of 64
NXP Semiconductors
mbc623
LSB
second byte
0 0 0 0 0 0 0 0 A X X X X X X X BA
first byte
(general call address)
mbc624
general
call address
(B)
A A
second
byte
A A
(n bytes + ack.)
S 00000000 MASTER ADDRESS 1 PDATA DATA
Fig 16. General call address format
There are two cases to consider:
When the least significant bit B is a ‘zero’.
When the least significant bit B is a ‘one’.
When bit B is a ‘zero’, the second byte has the following definition:
0000 0110 (06h): Reset and write programmable part of slave address by
0000 0100 (04h): Write programmable part of slave address by hardware.
0000 0000 (00h): This code is not allowed to be used as the second byte.
UM10204
I2C-bus specification and user manual
hardware. On receiving this 2-byte sequence, all devices designed to respond to the
general call address reset and take in the programmable p art of their address. Precautions must be taken to ensure that a device is not pulling down the SDA or SCL line after applying the supply voltage, since these low levels would block the bus.
Behaves as above, but the device does not reset.
Sequences of programming procedur e are pu blished in the appropriate device data sheets. The remaining codes have not been fixed and devices must ignore them.
When bit B is a ‘one’, the 2-byte sequence is a ‘hardware general call’. This means that the sequence is transmitted by a hardware master device, such as a keyboard scanner, which can be programmed to transmit a desired slave address. Since a hardware master does not know in advance to which device the message has to be transferred, it can only generate this hardware general call and its own addre ss — ide ntifying itself to the system (see Figure 17
Fig 17. Data transfer from a hardware master-transmitter
).
The seven bits remaining in the second byte contain the address of the hardware ma ste r. This address is recognized by an intelligent device (for example, a microcontroller) connected to the bus which then accepts the information fr om the hardware master. If the hardware master can also act as a slave, the slave address is identical to the master address.
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 18 of 64
NXP Semiconductors
002aac885
write
A
AR/WS PSLAVE ADDR. H/W MASTER DUMP ADDR. FOR H/W MASTER X
002aac886
R/W
write
A
A
(n bytes + ack.)
A/A
S PDUMP ADDR. FROM H/W MASTER DATA DATA
In some systems, an alternative could be that the hardware master transmitter is set in the slave-receiver mode after the system reset. In this way, a system configuring master can tell the hardware master-transmitter (which is now in slave-receiver mo de) to which address data must be sent (see Figure 18 hardware master remains in the master-transmitter mode.
Fig 18. Data transfer by a hardware-transmitter capable of dumping data directly to slave
UM10204
I2C-bus specification and user manual
). After this programming procedure, the
a. Configuring master sends dump address to hardware master
b. Hardware master dumps data to selected slave
devices

3.1.14 Software reset

Following a General Call, (0000 0000), sending 0000 0110 (06h) as the second byte causes a software reset. This feature is optional and not all devices respond to this command. On receiving this 2-byte sequence, all devices designed to respond to the general call address reset and take in the programmable part of their address. Precautions must be taken to ensure that a device is not pulling down the SDA or SCL line after applying the supply voltage, since these low levels would block the bus.

3.1.15 START byte

Microcontrollers can be connected to the I2C-bus in two ways. A microcontroller with an on-chip hardware I from the bus. When the device does not have such an interface, it must constantly monitor the bus via software. Obviously, the more times the microcontroller monitors, or polls the bus, the less time it can spend carrying out its intended function.
There is therefore a speed dif ference between fast hardware devices and a relatively slow microcontroller which relies on software polling.
In this case, data transfer can be preceded by a start procedure wh ich is much longer than normal (see Figure 19
A START condition (S)
A START byte (0000 0001)
An acknowledge clock pulse (ACK)
A repeated START condition (Sr).
2
C-bus interface can be programmed to be only interrupted by r equests
). The start procedure consists of:
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 19 of 64
NXP Semiconductors
UM10204
I2C-bus specification and user manual
Fig 19. START byte procedure
After the ST AR T condition S has been transmitted by a master which requires bus access, the ST AR T byte (0 000 0001) is transmitted. Another microcontroller can therefor e sample the SDA line at a low sampling rate until one of the seven zeros in the START byte is detected. After detection of this LOW level on the SDA line, the microcontroller can switch to a higher sampling rate to find the repeated START condition Sr which is then used for synchronization.
A hardware receiver resets upon receipt of the repeated START condition Sr and therefore ignores the START byte.
An acknowledge-related clock pulse is generated after the START byte. This is present only to conform with the byte handling format used on the bus. No device is allowed to acknowledge the START byte.

3.1.16 Bus clear

SDA
SCL
dummy
acknowledge
(HIGH)
7
S
START byte 0000 0001
9821
NACK
Sr
002aac997
In the unlikely event where the clock (SCL) is stuck LOW, the preferential procedure is to reset the bus using the HW reset signal if your I
2
I
C devices do not have HW reset inputs, cycle power to the devices to activate the
mandatory internal Power-On Reset (POR) circuit. If the data line (SDA) is stuck LOW , the master should send nine cloc k pulses. The device
that held the bus LOW should release it sometime within those nine clocks. If not, then use the HW reset or cycle power to clear the bus.

3.1.17 Device ID

The Device ID field (see Figure 20) is an optional 3-byte read-only (24 bits) word giving the following information:
Twelve bit s with the manufacturer na me, unique per m anu factu rer ( for exam ple, NXP)
Nine bits with the part identification, assigned by manufacturer (for example,
PCA9698)
Three bits with the die revision, assigned by manufacturer (for example, RevX)
2
C devices have HW reset inputs. If the
UM10204 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2012. All rights reserved.
User manual Rev. 4 — 13 February 2012 20 of 64
Loading...
+ 44 hidden pages