NXP I2Cbus Elements SASE
NXP I2Cbus Elements SASE
Alix Maldonado -Technical Marketing Manager Product Line System Management Business Line Interface Products
Agenda
I2C-bus Protocol Electrical Characteristics Measurements with an Oscilloscope Resources Questions
I2C - Protocol
IIC - Inter-Integrated Circuit g
Logic
I2C-bus
VCC
This means: Decreased number of wires (reduced PCB area) Reduced number of chip p p pins Remove glue logic Clip many devices on to the bus Modular design: Time-to-Market
Invented by NXP! (Philips Semiconductors) I2C-bus developed in the late 1970s for Philips consumer products (e.g. TVs) Worldwide industry standard and used by all major IC manufacturers
3
I2C - Protocol
Hardware architecture
VDD
Pull up resistors SDA SCL
Clock out
Data out
Clock out
Data out
Clock in Device 1
Data in
Clock in Device 2
Data in
2 wire bus: SDA: Serial Data Line SCL: Serial Clock Line Open-drain or open-collector output stages: wired-AND function
I2C - Protocol
Hardware architecture (2)
Master2 Slave2
VDD
SDA SCL
Master1
Slave1
Multiple master Multiple slave Bi-directional Master-transmitter Master-receiver Slave-transmitter Slave-receiver Data collision is taken care off
5
I2C - Protocol
Addressing / device selection
Each device is addressed individually by software New devices or functions can be easily clipped" on to an existing bus! 112 different addresses max with the 7-bit format (others reserved); additional 1024 with ( ) 10-bit format Address allocation coordinated by the I2C-bus committee Programmable pins means that several of the same devices can share the same bus Unique address per device: f fully fixed or with a programmable part through hardware f pin's) 10-bit format use a 2 byte message: 1111 0A9A8R/W + A7A6A5A4A3A2A1A0
VDD
SDA SCL
Master1 Slave1 Address register A6 A5 A4 A3 A2 A1 A0
VDD
I2C - Protocol
Communication
Communication must start with: START condition Start bit is always followed by slave address Slave address is followed by a READ or NOT WRITE bit Sl dd i f ll db NOT-WRITE
The receiving device (either master or slave) must send an ACKNOWLEDGE bit Communication must start with: STOP condition
START SLAVE ADDRESS[7] R/W ACK DATA[8] ACK STOP
Receive (1 = Read)
START SLAVE ADDRESS[7] 1 ACK DATA[8] ACK DATA[8] ACK STOP
I2C - Protocol
START & STOP conditions
Start condition - a HIGH to LOW transition on the SDA line while SCL is HIGH Stop condition - a LOW to HIGH transition on the SDA line while SCL is HIGH
START
Slave Address
R/W
ACK
DATA
ACK
DATA
START
Slave Address
R/W
ACK
DATA
ACK
DATA
10
START
Slave Address
R/W
ACK
DATA
ACK
DATA
11
I2C - Protocol
Bit transfer
During data transfer, SDA must be stable when SCL is High
12
I2C - Protocol
Data transfer
Each byte has to be followed by an acknowledge bit Number of data bytes transmitted per transfer is unrestricted If a slave cant receive or transmit another complete byte of data, it can hold the clock line SCL LOW (clock stretching) to force the master into a wait state
13
I2C - Protocol
Acknowledge / NOT-Acknowledge
I2C specification: Data transfer with acknowledge is obligatory. The receiver must pull down the SDA line during the acknowledge clock pulse so that it remains stable LOW during the d i th HIGH period of thi clock pulse. i d f this l k l Scenarios with a NOT-acknowledge (NACK) (SDA staying HIGH): 1. A receiver with the address is not present in the I2C bus. 2. 2 The receiver is performing real-time tasks and it cannot process the received I2C real time information. 3. The receiver is the master and wants to take control of SDA line again in order to generate a STOP command. The slave transmitter MUST then release the SDA line when it sees the NACK so the master can send the STOP command command.
14
I2C - Protocol
Arbitration procedure p
VDD
SDA
Two or more masters may generate a START condition at the same time Arbitration is done on SDA while SCL is HIGH Slaves are not i Sl involved l d
Summary: The master that first sends a 1 while the other sends a 0 loses control (arbitration)
15
I2C - Protocol
Clock synchronization during the arbitration procedure y g p
VDD
SCL
Internal counters of masters count the LOW and HIGH times (TL1, TH1) and (TL2, TH2)
CLK2 SCL Master 2
TL1
TH1
Wired-AND SCL connection: TL= longest TL= max (TL1, TL2 ,TLn) TH= shortest TH= min (TH1, TH2,THn) T
TL2
TH2
TL
TH
16
I2C - Protocol
Modes
Standard Mode Bitrate (kBit/s) Address (bits) Capacitive Bus Load (pF) Sink current (mA) 0 100 7 (10) 400 3
17
I2C - Protocol
Modes: Electrical specification
Standard Mode Bitrate (kBit/s) Address (bits) Capacitive Bus Load (pF) Sink current (mA) Trise: Rise time (ns) 0 100 7 (10) 400 3 1000 Fast Mode 0 400 7 (10) 400 3 300 Fast Mode Plus (FM+) 0 1000 7 (10) 4000 20 120 High Speed Mode 0 1700 7 (10) 400 3 160 0 3400 7 (10) 100 3 80
trise Vcc VIH Vbus (V) VIL VOL gnd t1 t2 0.4 V @ 3 mA sink current t (s) 0.3 0 3 * VDD
0.7 * VDD
18
I2C - Protocol
Summary y
START STOP HIGH to LOW transition on SDA while SCL is HIGH LOW to HIGH transition on SDA while SCL is HIGH 8-bit word, MSB first (Address, Control, Data): - Must be stable when SCL is HIGH - Can change only when SCL is LOW - Number of bytes transmitted is unrestricted Done on each 9th clock pulse d i th HIGH period h l k l during the i d -D - The transmitter releases the bus - SDA goes HIGH - The receiver pulls DOWN the bus line - SDA goes LOW - Generated by the Master(s) - Maximum speed: ( p (100, 400, 1000, 3400 kHz) but NO min ) - A receiver can hold SCL low when performing another function (transmitter in a Wait state) - A master can slow down the clock for slow devices - Master can start a transfer only if the bus is free - Several masters can start a transfer at the same time - A bit ti is d Arbitration i done on SDA li line - Master that lost the arbitration must stop sending data
DATA
ACKNOWLEDGE
CLOCK
ARBITRATION
19
20
Data Transfer
Data
Acknowledge
During data transfer SDA must be stable when SCL is High transfer, Each byte has to be followed by an acknowledge bit Number of bytes transmitted per transfer is unrestricted If a slave cant receive or transmit another complete byte of data, it can hold the clock line SCL LOW to force the master into a wait state
21
10-bit slave address may accommodate up to 210 = 1024 devices on the same bus Devices that supports either 7 bit or 10 bit address may co exist on the same 7-bit 10-bit address, co-exist bus
Reserved Addresses
START
Slave Address
R/W
ACK
DATA
ACK
DATA
ACK/
22
10100 1 1 1 0 1 0 A2A1A0R/W
Fixed Hardware Selectable
EEPROM
Each device is addressed individually by software Unique address per device: fully fi d or with a programmable part dd d i f ll fixed ith bl t U i through hardware pin(s) Programmable pins mean that several of the same devices can share the same bus Address allocation coordinated by the I2C-bus committee
112 different addresses max with the 7-bit format (others reserved) 10-bit format use a 2 byte message: 1111 0A9A8R/W + A7A6A5A4A3A2A1A0 10 bit
23
R/W bit is included result in: odd address is always the read address, even address is always the write address
1100000W
START Slave Address R/W ACK DATA ACK
DATA
ACK/
24
1 1 1 1 0 A9A8 0 ACKA7A6A5A4A3A2A1A0ACK C
Command Write Any 10-bit address slave devices may acknowledge Only the addressed slave device acknowledges
A read operation requires a two byte for write followed by a 1 byte read write,
25
First Clock
26
27
Rise Time
VDD VIH
0.7xVDD
0.3xVDD
28
29
Acknowledge (ACK)
Acknowledge bit occurs on the 9th SCL clock pulse The transmitter and receiver behave as follows:
1. Transmitter releases SDA line after the 8th clock pulse 2. Receiver acknowledges by pulling SDA low on the 9th clock pulse 3. Transfer is aborted if SDA does not go low ( ACK) g (no )
HIGH
No ACK
SDA SCL
8th SCL
ACK
LOW
9th SCL
30
Acknowledge Example
31
NACK
SDA SCL
8th SCL
ACK
LOW
9th SCL
32
33
Clock Stretch
A clock stretch is defined as the SCL line being pulled low stretched longer than its intended clock low period Why a device stretches the clock?
A master performs clock stretch when it needs to slow down the clock in order to accommodate a slower slave device A slave performs clock stretch when it needs to perform other function
SDA SCL
DONT CARE
Clock stretch
34
35
Master#2
Master#1
Slave Address#2
Slave Address#1
36
1 2
4 3
37
Start command
38
39
40
Vdd
Master 2
CLK 1 TL1, TH1
T1 TL1 TH1
T2
TL2 TH2
SCL TL, TH
Count Wait State TL1 TL2 still counting
Counting TL1 done
Count TH1
CLK1
0 Count TL2
Internal Counters count the Low and High times (TL1, TH1) and (TL2, TH2)
CLK2
0
Count TH2
3 2 4 4 1
Counting TH1 done Start Counting TL1 SCL goes Low TH = TH1
SCL
0
Counting TL2 done Start Counting TH2 SCL goes High Start Counting TH1
1
Counting TH1 done Start Counting TL1 SCL goes Low TL = TL2
DATA1
0
1 1
DATA2
0 0 0
SDA
SCL
0
START
SUMMARY: the master that sends a 1 while the other sends a 0 loses the arbitration
42
SCL
10 pF Max
44
Rise Time
VDD VIH
70%VDD
30%VDD
45
RPU
Master#2
RPU: RMIN: RMAX: CMAX 400 pF 400 pF 560 pF RMAX 2.96 k 885 252
VDDMAX: Maximum supply rail VOLMAX: Maximum output voltage low IOLMAX: Maximum sink current CMAX: tr: Maximum load capacitance Rise time
46
Maximum value
Determined by the IC-bus rise time requirements: I C bus V(t1) = 0.3*Vdd = Vdd (11/et1/RC); then t1 = 0.3566749*RC V(t2) = 0.7*Vdd = Vdd (11/et2/RC); then t2 = 1.2039729*RC t = t2t1 = 0.8472979*RC t2 t1 0 8472979*RC For standard-mode IC-bus: t = rise time = 1000ns (1 s) so RC = 1180.2 ns Example: at a bus load of 400 pF: Rmax = 2.95 k For fast-mode: pF: IC-bus rise time = 300 ns @ 400 p Rmax = 885
47
V(t1) = 0.3*VDD = VDD (11/et1/RC) V(t2) = 0.7*VDD = VDD (11/et2/RC) Subtract EQ1 from EQ2 R*C = 1 18*t rise time 1.18*t
Rise Time
V(t2) 70%VDD
30%VDD
Time
48
49
50
51
52
53
54
55
56
Scope 1 M
57
Probe P b 9M
Scope 50
Most modern passive probes have a probe sense pin that mates with a probe sense ring on the oscilloscope this automatically sets the correct coupling and attenuation factor
58
59
60
61
Exercise 1
Verify understanding of the IC bus p y g protocol
DIP Switch
Other Slave
VCC4
VCC5
VCC0 VCC2
Multiplexer& Switch Master Selector
C C
Temperature Sensor
Functions with I2C I2C Bus Architecture Devices Custom I2C hardware or software emulated Other hardware
VCC1
Bus Controller C
I2C
EEPROM LCD Driver
VCC3
Bridge
SPI UART
63
I2C Demoboards
Demo and Evaluation Boards
65
Kits include
Sample code: SPI and NXP I2C devices User Manual
Kits include
Sample code: I2C and NXP SPI devices User Manual
y Key Benefit
Easy interface to I2C/SPI host and IrDA, RS232/RS485, and GPIO devices. Selectable I2C or SPIbus interface
Key Benefit y
Easy interface to UART host and various I2C and GPIO devices. On-board I2C EEPROM and I2C LED Dimmer
Key Benefit y
Easy interface to SPI host and various I2C and GPIO devices. On-board I2C EEPROM and I2C LED Dimmer
Key Benefit y
Easy interface to I2C host and SPI and GPIO devices. Up to 4 SPI chip selects
Up to 5Mbps!
OM6270 SC16IS750 OM6273 SC16IS752
OM6271
OM6272
OM6274
Add Extra I/O Ports, Temperature Sensors, LED Drivers, Real-time Clock, IC Bus Switching S it hi USB Connection to trial version (only devices on board and that fixed address is operational) Graphics Interface for Windows PC/Laptop www.ics.nxp.com/support/boards/i2c20051/ p pp Target Board & USB based GUI (400 kHz) #OM6275
Get the color right with the single chip four color LED driver (R G B ?)
Individual and Global PWM to set your perfect color and brightness or blink IC interface for easy connection to Micro or Baseband IC Demo board with on board micro (LPC900) and FETs #OM6276 Stand alone demo Board #OM6282
www.ics.nxp.com/support/boards/pca9633/
Blink an LED without bit banging Dim and LED without burning a PWM on the MCU
Two PWMs to map across 2,4,8,16 outputs
25 mA per pin
IC interface for easy connection to Micro or Baseband IC Demo Board with on board micro #OM6279
PCA9533, PCA9531 On-board NXP MCU demonstrates capabilities www.ics.nxp.com/support/boards/leddemo
www.ics.nxp.com/support/boards/pca9698/
Easily drive a LCD Segment Display with a very small MCU and PCF8562
Good for a User Interface at the front panel of a system Scalable to match the complexity of the LCD display Simple code using industry-standard 8051 core Easily reprogram micro via USB adapter (#OM10083) http://www.teamfdi.com/products/lcddemo/lcddemo.shtml Demo Board with on board micro #OM10088
LCD Driver
COG is an option i ti
Access I2C Discussion Forum from > www.nxp.com/i2c CONTACT link on every Product Information Page www.nxp.com/support www nxp com/support Send e-mail directly to pp @ p [email protected]
75
I2C Device Data Sheets, IBIS models Application Notes and Other Information
Product family descriptions line cards cross reference data sheets
Link to app notes models user guides PLL design software datasheets
www.nxp.com/i2c or www.nxp.com/i2clogic
76
77
Questions?
78