
UM10800
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2016. All rights reserved.
User manual
Rev. 1.2 — 5 October 2016
230 of 487
NXP Semiconductors
UM10800
Chapter 15: LPC82x I2C0/1/2/3
15.3.1 I2C transmit/receive in master mode
In this example, the I2C 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. You must enable the I2C0_SCL and I2C0_SDA functions on
pins PIO0_11 and PIO0_10 or assign the SCL and SDA functions for any of the other I2C
blocks to pins through the switch matrix. See
For a 400 kHz bit rate, the I2C0 pins can be configured in standard mode in the IOCON
block. See
Table 90 “PIO0_11 register (PIO0_11, address 0x4004 401C) bit description”
and
Table 91 “PIO0_10 register (PIO0_10, address 0x4004 4020) bit description”
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 I2C bit rate:
•
Divide the system clock (I2C_PCLK) by a factor of 2. See
.
•
Set the SCL high and low times to 2 clock cycles each. This is the default. See
. The result is
an SCL clock of 375 kHz.
Fig 30. I2C clocking
Clock divider
I2Cn
SYSCON
system clock
SYSAHBCLKCTRL[n]
(I2C clock enable)
I2Cn_PCLK
DIVVAL
CLKDIV
I2C function clock:
sampling,
time-out
Clock logic
MSTTIME
SCL
MSTSCLHIGH
MSTSCLLOW