617
/
838
Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
In order to generate a NACK pulse after receiving the last byte, the software should clear the
I2C_CTRL1.ACKEN bit immediately after receiving the penultimate byte (N-1). In order to generate a
stop/restart condition, the software must set the I2C_CTRL1.STOPGEN bit or I2C_CTRL1.STARTGEN to 1
after reading the penultimate data byte. This process needs to be completed before the last byte is received to
ensure that the NACK is sent for the last byte.
7.
After the last byte is received, the I2C_STS1.RXDATNE bit is set to 1, and the software can read the last byte.
Since I2C_CTRL1.ACKEN has been cleared to 0 in the previous step, I2C no longer sends ACK for the last
byte, and generates a STOP bit after the last byte is sent.
Note: The above steps require the number of bytes N>1. If N=1, step 6 should be executed after step 4, and it needs
to be completed before the reception of byte is completed.
Figure 22-6 Master receiver transfer sequence diagram
Instructions:
1.
EV5: I2C_STS1.STARTBF=1, reading STS1 and then writing the address into the DAT register will clear this
event.
2.
EV6: I2C_STS1.ADDRF=1, reading STS1 and STS2 in sequence will clear this event. In the 10-bits master
receiving mode, the I2C_CTRL1.STARTGEN should be set to 1 after this event.
3.
EV6_1: There is no corresponding event flag, only suitable for receiving 1 byte. Just after EV6 (that is after
clearing I2C_STS1.ADDRF), the generation bits for acknowledge and stop condition should be cleared.
4.
EV7: I2C_STS1.RXDATNE=1, read the DAT register to clear this event.
5.
EV7_1: I2C_STS1.RXDATNE =1, read the DAT register to clear this event. Set I2C_CTRL1.ACKEN=0 and
I2C_CTRL1.STOPGEN=1.
6.
EV9: I2C_STS1.ADDR10F=1, reading STS1 and then writing to the DAT register will clear this event.
Note:
a)
If a single byte is received, it is NA.
Start
Address(R)
ACK
EV6
EV6-1
Data1
ACK
(1)
Data2
ACK
EV7
DataN
NACK Stop
EV7
ACK
Address
ACK
EV9
Data1
ACK
(1)
Start
Header(W)
Master
Tx
Master
Tx
Sl ave
Tx
Sl ave
Tx
Sl ave
Tx
Master
Tx
Master
Tx
Master
Tx
Master
Tx
Sl ave
Tx
Start
Header(R)
ACK
EV6
EV6-1
DataN
NACK Stop
EV7
Master
Tx
Master
Tx
Sl ave
Tx
EV7
EV7
Master
Tx
Master
Tx
Sl ave
Tx
Master
Tx
Sl ave
Tx
Master
Tx
Master
Tx
Master
Tx
Sl ave
Tx
Sl ave
Tx
10-bit address
7-bit address
EV5
EV7-1
EV5
EV6
EV5
Data2
ACK
EV7
Master
Tx
Sl ave
Tx
EV7-1