
NuMicro® NUC029LEE/NUC029SEE
32-bit Arm
®
Cortex
®
-M0 Microcontroller
Aug, 2018
Page
403
of
497
Rev 1.00
N
U
MICRO
®
N
UC02
9L
E
E
/N
UC029
S
E
E
T
E
CHN
ICA
L R
E
F
E
R
E
NC
E
M
A
NU
A
L
6.14.6 Example for Random Read on EEPROM
The following steps are used to configure the I
2
C0 related registers when using I
2
C to read data
from EEPROM.
1.
Set the multi-
function pin in the “GPA_MFP” registers as I2C0_SCL and I2C0_SDA pins.
2.
Enable I
2
C APB clock by setting I2C0_EN(APBCLK[8]).
3.
Set I2C0_RST (IPRSTC2 [8]) = 1 to reset I
2
C controller then set I
2
C controller to normal
operation by setting I2C0_RST(IPRSTC2 [8]) = 0;
4.
Set ENS1(I2CON[6])=1 to enable I
2
C0 controller.
5.
Write a divided value by setting I2CLK register for I
2
C clock rate.
6.
Set SETENA(NVIC_ISER[31:0])
=0x00040000 in the “NVIC_ISER” register to set I
2
C0
IRQ.
7.
Set EI(I2CON[7])=1 to enable I
2
C0 Interrupt.
8.
Set I
2
C0
address registers which are “I2CADDR0~I2CADDR3”.
Random read operation is one of the methods of access EEPROM. The method allows the
master to access any address of EEPROM space. The following figure shows the EEPROM
random read operation
.
S
T
A
1 0 1 0
A
2
A
1
A
0
W
A
C
K
X X X
A
C
K
A
C
K
S
T
1 0 1 0
A
2
A
1
A
0
R
A
C
K
N
A
C
K
S
T
O
DATA BYTE
ROM ADDRRSS
LOW BYTE
ROM ADDRRSS
HIGH BYTE
SLA+W
I2Cn_SDA
SLA+R
Figure 6.14-17 EEPROM Random Read
The following figure shows how to use I
2
C controller to implement the protocol of EEPROM
random read.