![GigaDevice Semiconductor GD32A50 Series Скачать руководство пользователя страница 524](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32a50-series/gd32a50-series_user-manual_2225782524.webp)
GD32A50x User Manual
524
If data of BYTENUM[7:0] bytes have been transferred and RELOAD=0, the AUTOEND
bit in I2C_CTL1 can be set to generate a STOP signalautomatically. When AUTOEND is
0, the TC bit in I2C_STAT register will be set and the SCL is stretched. In this case, the
master can generate a STOP signalby setting the STOP bit in the I2C_CTL1 register. Or
generate a RESTART signalto start a new transfer. The TC bit is cleared when the START
/ STOP bit is set.
If a NACK is received, a STOP signalis automatically generated, the NACK is set in
I2C_STAT register, if the NACKIE bit is set, an interrupt will be generated.
Note:
When the RELOAD bit is 1, the AUTOEND has no effect.
Figure 20-18. Programming model for master transmitting (N<=255)
IDLE
Master generates START
condition
Master sends Address
Slave sends Acknowledge
Wait for ACK from slave
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, clear TC
Software initialization
Set TI
Set TI
Set TI
Write DATA(1) to I2C_TDATA
Write DATA(x) to I2C_TDATA
Set TI
Write DATA(2) to I2C_TDATA
Write DATA(3) to I2C_TDATA
Write DATA(N) to I2C_TDATA
Master sends DATA(N-1)
Slave sends Acknowledge
Set TI
Set STOP
I2C Line State
Hardware Action
Software Flow
Set START
AUTOEND=0
BYTENUM[7:0]=N
Set TC