GD32F10x User Manual
460
5.
After the transmission of the first byte, the TBE bit will be set, the software can write the
third byte to the I2C_DATA register and TBE is cleared. After this, any time TBE is set,
software can write a byte to I2C_DATA as long as there is still data to be transmitted.
6.
During the transmission of the second last byte, software writes the last data to
I2C_DATA to clear the TBE flag and doesn’t care TBE anymore. So TBE will be set after
the byte’s transmission and not cleared until a STOP signal.
I2C master doesn’t acknowledge to the last byte according to the I2C protocol, so after
sending the last byte, I2C slave will wait for the STOP signal on I2C bus and sets AERR
(Acknowledge Error) bit to notify software that the transmission completes. Software
clears AERR bit by writing 0 to it.
Figure 17-9. Programming model for slave transmitting mode (10-bit address mode)
IDLE
Master generates START
condition
Master sends Address
Slave sends Acknowledge
Master generates repeated
START condition
Master sends header
Slave sends Acknowledge
SCL stretched by slave
Slave sends DATA(1)
Master sends Acknowledge
……
(
Data transmission
)
Slave sends DATA(N-2)
Master sends Acknowledge
Slave sends DATA(N)
Master DON'T send Ack
Master generates STOP
condition
1) Software initialization
Set ADDSEND
2) Clear ADDSEND
Set ADDSEND
2) Clear ADDSEND
Set TBE
Set TBE
Set TBE
Set AERR
Clear TBE
3) Write DATA(1) to TRB
Write DATA(x) to TRB
Set TBE
4) Write DATA(2) to TRB
5) Write DATA(3) to TRB
6)Write DATA(N) to TRB
Slave sends DATA(N-1)
Master sends Acknowledge
Set TBE
7) Clear AERR
I2C Line State
Hardware Action
Software Flow
Master sends Header
Slave sends Acknowledge
Summary of Contents for GD32F10 Series
Page 63: ...GD32F10x User Manual 63 programmed during the chip production ...
Page 117: ...GD32F10x User Manual 117 010 1 0 011 0 9 ...
Page 416: ...GD32F10x User Manual 416 shadow register updates every update event ...
Page 427: ...GD32F10x User Manual 427 value ...
Page 518: ...GD32F10x User Manual 518 These bits are not used in SPI mode ...