
DR
AFT
DR
AFT
DRAFT
DR
D
RAFT
DRAFT
DRA
FT DRAF
D
RAFT DRAFT DRAFT DRAFT DRAFT D
DRAFT
D
RAFT DRA
FT DRAFT DRAFT DRAFT DRA
UM10360_0
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 00.06 — 5 June 2009
437 of 808
NXP Semiconductors
UM10360
Chapter 19: LPC17xx I2C0/1/2 interface
9.7 I
2
C state service routines
This section provides examples of operations that must be performed by various I
2
C state
service routines. This includes:
•
Initialization of the I
2
C block after a Reset.
•
I
2
C Interrupt Service
•
The 26 state service routines providing support for all four I
2
C operating modes.
9.7.1 Initialization
In the initialization example, the I
2
C block is enabled for both master and slave modes.
For each mode, a buffer is used for transmission and reception. The initialization routine
performs the following functions:
•
I2ADR is loaded with the part’s own slave address and the General Call bit (GC)
•
The I
2
C interrupt enable and interrupt priority bits are set
•
The slave mode is enabled by simultaneously setting the I2EN and AA bits in I2CON
and the serial clock frequency (for master modes) is defined by loading the
I2SCLH
and I2SCLL registers.
The master routines must be started in the main program.
Fig 96. Forced access to a busy I
2
C-bus
(1) Unsuccessful attempt to send a START condition.
(2) SDA line is released.
(3) Successful attempt to send a START condition. State 08H is entered.
Fig 97. Recovering from a bus obstruction caused by a LOW level on SDA
SDA line
SCL line
STA flag
STO flag
time limit
start
condition
SDA line
SCL line
(1)
(2)
(1)
(3)
STA flag
start
condition