GD32F10x User Manual
462
Figure 17-10. Programming model for slave receiving (10-bit address mode)
IDLE
Master generates START
condition
Master sends Header
Slave sends Acknowledge
Master sends Address
Slave sends Acknowledge
SCL stretched by slave
Master sends DATA(1)
Slave sends Acknowledge
……
(
Data transmission
)
Master sends DATA(N)
Slave sends Acknowledge
Master generates STOP
condition
Set ADDSEND
2) Clear ADDSEND
Set RBNE
Set STPDET
4) Read DATA(x)
Set RBNE
3) Read DATA(1)
5) Read DATA(N)
6) Clear STPDET
I2C Line State
Hardware Action
Software Flow
Set RBNE
1) Software initialization
Programming model in master transmitting mode
As it shows in
Figure 17-11. Programming model for master transmitting mode (10-bit
, the following software procedure should be followed if users wish to make
transaction in master transmitter mode:
1.
First of all, enable I2C peripheral clock as well as configure clock related registers in
I2C_CTL1 to make sure correct I2C timing. After enabled and configured, I2C operates
in its default slave state and waits for START signal followed by address on I2C bus.
2.
Software sets START bit requesting I2C to generate a START signal on I2C bus.
3.
After sending a START signal, the I2C hardware sets the SBSEND bit in I2C_STAT0
register and enters master mode. Now software should clear the SBSEND bit by reading
I2C_STAT0 and then writing a 7-bit address or header of a 10-bit address to I2C_DATA.
I2C begins to send address or header to I2C bus as soon as SBSEND bit is cleared. If
the address which has been sent is header of a 10-bit address, the hardware sets
ADD10SEND bit after sending the header and software should clear the ADD10SEND
bit by reading I2C_STAT0 and writing 10-bit lower address to I2C_DATA.
4.
After the 7-bit or 10-bit address has been sent, the I2C hardware sets the ADDSEND bit
and software should clear the ADDSEND bit by reading I2C_STAT0 and then I2C_STAT1.
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 ...