![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 475](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794475.webp)
GD32E23x User Manual
475
I2C_STAT1.
5.
Now I2C enters data transmission stage and hardware sets TBE bit because both the
shift register and data register I2C_DATA are empty. Software now writes the first byte
data to I2C_DATA register, but the TBE will not be cleared because the byte written in
I2C_DATA is moved to internal shift register immediately. The I2C begins to transmit
data to I2C bus as soon as the shift register is not empty.
6.
During the transmission of the first byte, software can write the second byte to
I2C_DATA, and this time TBE is cleared because neither I2C_DATA nor shift register is
empty.
7.
Any time TBE is set, software can write a byte to I2C_DATA as long as there is still data
to be transmitted.
8.
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
asserted after the transmission of the byte and not be cleared until a STOP signal.
9.
After sending the last byte, I2C master sets BTC bit because both the shift register and
I2C_DATA are empty. Software should set the STOP bit to generate a STOP signal,
then the I2C clears both TBE and BTC flags.
Figure 17-11. Programming model for master transmitting (10-bit address mode)
IDLE
Master generates START
condition
Master sends Address
Slave sends Acknowledge
Master sends Header
Slave sends Acknowledge
SCL stretched by master
Master sends DATA(1)
Slave sends Acknowledge
(
Data transmission
)
Master sends DATA(N-2)
Slave sends Acknowledge
Master sends DATA(N)
Slave sends Acknowledge
Master generates STOP
condition
1) Software initialization
Set ADD10SEND
4) Clear ADD10SEND
Set ADDSEND
4) Clear ADDSEND
Set TBE
Set TBE
Set TBE
Set BTC
5) Write DATA(1) to Transfer
buffer register (I2C_DATA)
Write DATA(x) to Transfer
buffer register (I2C_DATA)
Set TBE
6) Write DATA(2) to Transfer
buffer register (I2C_DATA)
7) Write DATA(3) to Transfer
buffer register (I2C_DATA)
8)Write DATA(N) to Transfer
buffer register (I2C_DATA)
Master sends DATA(N-1)
Slave sends Acknowledge
Set TBE
9) Set STOP
I2C Line State
Hardware Action
Software Flow
2) Set START
Set SBSEND
SCL stretched by master
3) Clear SBSEND
SCL stretched by master
SCL stretched by master