AT32WB415
Series Reference Manual
2022.04.13
Page 121
Ver 2.00
10-bit address mode:
1.
Generate Start condition (GENSTART=1)
2.
EV1: Start condition is ready (STARTF=1). Read STS1 and write the address to DT register.
3.
EV5: 10-bit address head sequence is sent. Read STS1 and write to DT register can clear
the ADDRHF bit.
4.
EV2: Address is matched successfully (ADDR7F=1). Read STS1 and then STS2 will clear the
ADDR7F bit, and the master re-send Start condition (GENSTART=1).
5.
EV1: Start condition is ready (STARTF=1). Read STS1 and write the address to DT register.
6.
EV2: Address is matched successfully (ADDR7F=1). Read STS1 and then STS2 will clear the
ADDR7F bit. The master enters receive stage at this time.
7.
EV3: The RDBF bit is set 1 after receiving the byte, and it is cleared when the I2C_DT register is
read.
8.
EV4: The ACKEN bit is cleared and the GENSTOP is set as soon as the second-to-last byte is
received.
9.
EV3: The RDBF bit is set 1 after receiving the byte, and it is cleared when the I2C_DT register is
read.
10. End of communication.
2.
When I2C interrupt priority is not very high but the number of bytes to receive is grearter
than 2
The third-to-last byte (N-2) is not read when being received. It is read only after the ACKEN bit
in the I2C_CTRL1 register is cleared when the second-to-last byte (N-1) is received. Then the
second-to-last byte (N-1) is read after the GENSTOP bit in the I2C_CTRL1 register is set.
Afterwards, the bus starts to receive the last one byte.
Figure 11-7 Transfer sequence of master receiver when N>2
Address
S
1
A
Data1
A
SCL
Stretch
Data2
A
DataN
NA P
Master to Slave
Slave to Master
RS = Repeated Start
S = Start
A = Acknowledge
P = Stop
Example : I2C Master receive N bytes from I2C Slave .
EV1. I2C_STS1_STARTF=1, reading STS1 and write the address to I2C_DT will
clear the event.
EV2. I2C_STS1_ADDR7F = 1, reading STS1 and then STS2 will clear the event.
EV3. I2C_STS1_RDBF = 1
,
read the I2C_DT register to clear the event.
EV4. I2C_STS1_TDC = 1
,
The I2C_DT register data is DataN-2, the internal shift register data is DataN-1, set
I2C_CTRL1_ACKEN = 0, after the software reads the data DataN-2, set I2C_CTRL1_GENSTOP = 1, and
then read the data DataN-1.
EV5. I2C_STS1_ADDRHF= 1 ,reading STS1 and write I2C_DT register will clear the event.
EV2
EV3
EV4
...
RDBF
DataN-2
A
DataN-1
A
SCL
Stretch
Address Head
S
A
SCL
Stretch
Address
A
EV2
EV5
10-bit address
Address Head
RS
SCL
Stretch
A
Data1
A
Data2
A
DataN
NA P
EV3
EV4
...
DataN-2
A
DataN-1
A
SCL
Stretch
EV3
EV3
EV3
EV3
7-bit address
R/W
0
R/W
1
R/W
SCL
Stretch
EV1
SCL
Stretch
EV1
EV2
SCL
Stretch
EV1
SCL Stretch
7-bit address mode:
1.
Generate a Start condition (GENSTART=1)
2.
EV1: Start condition is ready (STARTF=1). Read STS1 and write the address to DT register.
3.
EV2: Address is matched successfully (ADDR7F=1). Read STS1 and then STS2 will clear
the ADDR7F bit, and the master enters receive stage.
4.
EV3: The RDBF bit is set 1 after receiving the byte, and it is cleared when the I2C_DT register
is read.
5.
EV4: TDC=1, the contens in the I2C_DT is N-2, and that of the shift register is N-1. The
ACKEN is set 0 by software and the data N-2 is read, afterwards, the GENSTOP=1, and data
N-1 is read.