
UM10850
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2016. All rights reserved.
User manual
Rev. 2.4 — 13 September 2016
303 of 464
NXP Semiconductors
UM10850
Chapter 23: LPC5410x I2C-bus interfaces (I2C0/1/2)
23.3 Pin description
The I
2
C pins are fixed-pin functions and enabled through IOCON. Refer to the IOCON
settings table for I
2
C modes in
23.4 Basic configuration
Configure I
2
C blocks using the following registers:
•
In the ASYNCAPBCLKCTRL register, set the appropriate bit(s) (see
enable clocks to the register interface.
•
Clear the I
2
C peripheral reset using the ASYNCPRESETCTRL register (
).
•
Enable/disable the related I
2
C interrupt slot in the NVIC.
•
Configure the I
2
C pin functions through IOCON.
•
The peripheral clock for the I
2
C is the asynchronous APB clock (see
).
23.4.1 I
2
C transmit/receive in master mode
In this example, I2C0 is configured as the master. The master sends 8 bits to the slave
and then receives 8 bits from the slave. The system clock is set to 30 MHz and the bit rate
is approximately 400 KHz. The I2C0_SCL and I2C0_SDA functions must be enabled on
pins PIO0_22 and PIO0_23 through IOCON. See
.
The pins should be configured as required for the I
2
C-bus mode that will be used (SM,
FM, FM+, HS) via the IOCON block. See
The transmission of the address and data bits is controlled by the state of the
MSTPENDING status bit. Whenever the status is Master pending, the master can read or
write to the MSTDAT register and go to the next step of the transmission protocol by
writing to the MSTCTL register.
Configure the I
2
C bit rate:
•
Divide the system clock (I2C_PCLK) by a factor of 19. See
Divider register (CLKDIV, offset 0x14) bit description”
•
Set the SCL high and low times to 2 clock cycles each. This is the default. See
Table 360 “Master Time register (MSTTIME, address offset 0x024) bit description”
.
The result is an SCL clock of (30 MHz / 19 / (2 + 2)) = 394.7 kHz.
Table 334. I
2
C-bus pin description
Function
Direction
Description
Connect to
I2C0_SCL
I/O
I2C0 serial clock.
P0_23
I2C0_SDA
I/O
I2C0 serial data.
P0_24
I2C1_SCL
I/O
I2C1 serial clock.
P0_25
I2C1_SDA
I/O
I2C1 serial data.
P0_26
I2C2_SCL
I/O
I2C2 serial clock.
P0_27
I2C2_SDA
I/O
I2C2 serial data.
P0_28