
M0A21/M0A23 Series
May 06, 2022
Page
586
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
I
2
C Interrupt in the “UI2C_PROTIEN” register.
8.
Set USCI address registers “UI2C_DEVADDR0 ~ UI2C_DEVADDR1”.
Random read operation is one of the methods of access EEPROM. The method allows the master to
access any address of EEPROM space. Figure 6.15-23 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
SDA
LINE
SLA+R
Figure 6.15-23 EEPROM Random Read
Figure 6.15-24 shows how to use I
2
C controller to implement the protocol of EEPROM random read.
S
TXDAT
(SLA+W)
ACK
Master to Slave
Slave to Master
TXDAT
(
ROM Address High Byte
)
ACK
Sr
TXDAT
(SLA+R)
ACK
P
STARIF = 1
(PTRG, STA, STO, AA) = (0, 1, 0, x)
Clear protocol status register
ACKIF = 1
TXDAT = SLA+W
(PTRG, STA, STO, AA)=(1, 0, 0, x)
Write 1 to STARIF
ACKIF = 1
TXDAT = ROM Address High Byte
((PTRG, STA, STO, AA)=(1, 0, 0, x)
Writing 1 to ACKIF
STARIF = 1
(PTRG, STA, STO, AA)=(1, 1, 0, x)
Clear protocol status register
STORIF = 1
(PTRG, STA, STO, AA)=(1, 0, 1, x)
Writing 1 to NACKIF
TXDAT = SLA+R
(PTRG, STA, STO, AA)=(1, 0, 0, x)
Write 1 to STARIF
ACKIF = 1
NAK
NACKIF = 1
TXDAT
(
ROM Address Low Byte
)
ACK
ACKIF = 1
TXDAT = ROM Address Low Byte
(PTRG, STA, STO, AA)=(1, 0, 0, x)
P
STORIF = 1
(PTRG, STA, STO, AA)=(1, 0, 1, x)
Writing 1 to NACKIF
NAK
NACKIF = 1
TXDAT
(Data)
NAK
NACKIF = 1
(PTRG, STA, STO, AA)=(1, 0, 0, 0)
Writing 1 to ACKIF
P
STORIF = 1
(PTRG, STA, STO, AA)=
(1, 0, 1, x)
Writing 1 to NACKIF
NAK
NACKIF = 1
P
STORIF = 1
(PTRG, STA, STO, AA)=(1, 0, 1, x)
Writing 1 to NACKIF
Figure 6.15-24 Protocol of EEPROM Random Read
The I
2
C controller, which is a master, sends START to bus. Then, it sends a SLA+W (Slave a
Write bit) to EERPOM followed by two bytes data address to set the EEPROM address to read. Finally,
a Repeat START followed by SLA+R is sent to read the data from EEPROM.