GD32W51x User Manual
642
Figure 19-15. Programming model for slave transmitting when SS=1
IDLE
Master generates START
condition
Master sends Address
Slave sends Acknowledge
Slave sends DATA(2)
Master sends Acknowledge
……
(
Data transmission
)
Slave sends DATA(N-2)
Master sends Acknowledge
Slave sends DATA(N-1)
Master sends Acknowledge
Master generates STOP
condition
I2C initialization
Set ADDSEND
read READDR and TR in
I2C_STAT, clear ADDSEND
Set TI
Set TI
Write DATA(2) to I2C_TDATA
Write DATA(x) to I2C_TDATA
Set TI
Write DATA(3) to I2C_TDATA
Write DATA(4) to I2C_TDATA
Write DATA(N) to I2C_TDATA
Set TI
I2C Line State
Hardware Action
Software Flow
Slave sends DATA(1)
Master sends Acknowledge
Write DATA(N+1) to I2C_TDATA
DATA(N+1) will not be sent
Clear STPDET
Write DATA(1) to I2C_TDATA
Set TI
Slave sends DATA(N)
Master don't send ACK
Set TI, TBE and NACK
Clear NACK
Set TBE
Slave receiver
When the I2C_RDATA is not empty, the RBNE bit in I2C_STAT register is set, and if the
RBNEIE bit in I2C_CTL0 register is set, an interrupt will be generated. When a STOP is
received, STPDET will be set in I2C_STAT register. If the STPDETIE bit in I2C_CTL0 register
is set, and an interrupt will be generated.