
The I2C connection and timing
TIdevice
I2C
I2C
EPROM
I2C
controller
TIdevice
I2C
V
DD
Pull-up
resistors
Serialdata(SDA)
Serialclock(SCL)
www.ti.com
Peripheral Architecture
2 Peripheral Architecture
The I2C peripheral consists of the following primary blocks:
• A serial interface: one data pin (SDA) and one clock pin (SCL).
• Data registers to temporarily hold receive data and transmit data traveling between the SDA pin and
the CPU or the DMA2 controller.
• Control and status registers.
• A peripheral data bus interface to enable the CPU and the DMA2 controller to access the I2C
peripheral registers.
• A clock synchronizer to synchronize the I2C input clock (from the processor clock generator) and the
clock on the SCL pin, and to synchronize data transfers with masters of different clock speeds.
• A prescaler to divide down the input clock that is driven to the I2C peripheral.
• A noise filter on each of the two pins, SDA and SCL.
• An arbitrator to handle arbitration between the I2C peripheral (when it is a master) and another master.
• Interrupt generation logic, so that an interrupt can be sent to the CPU.
• DMA event generation logic, so that activity in the DMA2 controller can be synchronized to data
reception and data transmission in the I2C peripheral.
Figure 1 shows the four registers used for transmission and reception. The CPU or the DMA controller
writes data for transmission to ICDXR and reads received data from ICDRR. When the I2C peripheral is
configured as a transmitter, data written to ICDXR is copied to ICXSR and shifted out on the SDA pin one
bit at a time. When the I2C peripheral is configured as a receiver, received data is shifted into ICRSR and
then copied to ICDRR.
2.1 Bus Structure
Figure 1 shows how the I2C peripheral is connected to the I2C bus. The I2C bus is a multi-master bus
that supports a multi-master mode. This allows more than one device capable of controlling the bus that is
connected to it. A unique address recognizes each I2C device. Each I2C device can operate as either
transmitter or receiver, depending on the function of the device. Devices that are connected to the I2C bus
can be considered a master or slave when performing data transfers, in addition to being a transmitter or
receiver.
NOTE: A master device is the device that initiates a data transfer on the bus and generates the
clock signals to permit that transfer. Any device that is addressed by this master is
considered a slave during this transfer.
An example of multiple I2C modules that are connected for a two-way transfer from one device to other
devices is shown in Figure 2.
Figure 2. Multiple I2C Modules Connected
11
SPRUFO1A–September 2009 Inter-Integrated Circuit (I2C) Peripheral
Submit Documentation Feedback
Copyright © 2009, Texas Instruments Incorporated
SDA
SCL
MSB
Acknowledgement
bitfromslave
(No-)Acknowledgement
bitfromreceiver
1 2 7 8
R/W
9
ACK
1 2 8 9
ACK
Slaveaddress
START
condition(S)
STOP
condition(P)
Data
S Slaveaddress R/W ACK
Data
ACK
Data
ACK P
7
n n
1 1 1 1 1 1
www.ti.com
Peripheral Architecture
2.6 Serial Data Formats
Figure 7 shows an example of a data transfer on the I2C-bus. The I2C peripheral supports 2-bit to 8-bit
data values. Figure 7 shows a typical I2C data transfer using (BC = 000 in ICMDR). Each bit put on the
SDA line is equivalent to one pulse on the SCL line. The data is always transferred with the
most-significant bit (MSB) first. The number of data values that can be transmitted or received is
unrestricted; however, in most systems, the transmitter and receiver have agreed upon the number of data
values to transfer before transfer begins.
The I2C peripheral supports the following data formats:
• 7-bit addressing mode.
• 10-bit addressing mode.
• Free data format mode.
Figure 7. I2C Peripheral Data Transfer
2.6.1 7-Bit Addressing Format
In the 7-bit addressing format (Figure 8), the first byte after a START condition (S) consists of a 7-bit slave
address followed by a R/W bit. The R/W bit determines the direction of the data.
• R/W = 0: The master writes (transmits) data to the addressed slave.
• R/W = 1: The master reads (receives) data from the slave.
An extra clock cycle dedicated for acknowledgment (ACK) is inserted after the R/W bit. If the slave inserts
the ACK bit, n bits of data from the transmitter (master or slave, depending on the R/W bit) follow it. n is a
number from 2 to 8 that the bit count (BC) bits of ICMDR determine. The receiver inserts an ACK bit after
the data bits have been transferred.
Write a 0 to the expanded address enable (XA) bit of ICMDR to select the 7-bit addressing format.
Figure 8. I2C Peripheral 7-Bit Addressing Format (FDF = 0, XA = 0 in ICMDR)
n = The number of data bits (from 2 to 8) specified by the bit count (BC) field of ICM DR.
2.6.2 10-Bit Addressing Format
The 10-bit addressing format (Figure 9) is like the 7-bit addressing format, but the master sends the slave
address in two separate byte transfers. The first byte consists of 11110b, the two MSBs of the 10-bit slave
address, and R/W = 0 (write). The second byte is the remaining 8 bits of the 10-bit slave address. The
slave must send acknowledgment (ACK) after each of the two byte transfers. Once the master has written
the second byte to the slave, the master can either write data or use a repeated START condition to
change the data direction. (For more information about using 10-bit addressing, see the Philips
Semiconductors I2C-bus specification.)
Write 1 to the XA bit of ICMDR to select the 10-bit addressing format.
15
SPRUFO1A–September 2009 Inter-Integrated Circuit (I2C) Peripheral
Submit Documentation Feedback
Copyright © 2009, Texas Instruments Incorporated
From TI’s SPRUFO1A.
EECS 452 – Fall 2014 Lecture 5 – Page 124/143 Tuesday – September 16, 2014
Commenti su questo manuale