GD32W51x User Manual
643
Figure 19-16. Programming model for slave receiving
IDLE
Master generates START
condition
Master sends Address
Slave sends Acknowledge
SCL stretched by slave
(only when SS=0)
Master sends DATA(1)
Slave sends Acknowledge
……
(
Data transmission
)
Master sends DATA(N)
Slave sends Acknowledge
Master generates STOP
condition
Set ADDSEND
read READDR and TR in
I2C_STAT, clear ADDSEND
Set RBNE
Set STPDET
Read DATA(x)
Set RBNE
Read DATA(1)
Read DATA(N)
Clear STPDET
I2C Line State
Hardware Action
Software Flow
Set RBNE
Software initialization
19.3.8.
I2C master mode
Initialization
The SCLH[7:0] and SCLL[7:0] in I2C_TIMING register should be configured when I2CEN is
0. In order to support multi-master communication and slave clock stretching, a clock
synchronization mechanism is implemented.
For clock synchronization, the low level of the clock is counted starting from the SCL low level
internal detection by the SCLL[7:0] counter, the high level of the clock is counted by the
SCLH[7:0] counter, starting from the SCL high level internal detection.
The I2C detects its SCL low level after a t
SYNC1
delay depending on the SCL falling edge, SCL
input analog and digital noise filter and SCL synchronization to the I2CCLK clock. If the
SCLL[7:0] value in I2C_TIMING register is reached by the the SCLL[7:0] counter, the I2C will
release the SCL clock.
The I2C detects its SCL high level after a t
SYNC2
delay depending on the SCL rising edge, SCL
input analog and digital noise filter and SCL synchronization to I2CCLK clock. If the SCLH[7:0]
value in I2C_TIMING register is reached by the the SCLH[7:0] counter, the I2C will stretch
the SCL clock.
So the master clock period is: t
SCL
= t
SYNC1
+ t
SYNC2
+ {[(SCLH[7:0]+1) + (SCLL[7:0]+1)] x