
GD32F10x User Manual
464
Figure 17-11. Programming model for master transmitting mode (10-bit address mode)
IDLE
Master generates START
condition
Master sends Address
Slave sends ACK
Master sends Header
Slave sends ACK
SCL stretched by master
Master sends DATA(1)
Slave sends ACK
……
(
Data transmission
)
Master sends DATA(N-2)
Slave sends ACK
Master sends DATA(N)
Slave sends ACK
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 TRB
Write DATA(x) to TRB
Set TBE
6) Write DATA(2) to TRB
7) Write DATA(3) to TRB
8)Write DATA(N) to TRB
Master sends DATA(N-1)
Slave sends ACK
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
Programming model in master receiving mode
In master receiving mode, a master is responsible for generating NACK for the last byte
reception and then sending STOP a condition on I2C bus. So, special attention should be
paid to ensure the correct ending of data reception. Two solutions for master receiving are
provided here for applications: Solution A and B. Solution A requires the software’s quick
response to I2C events, while Solution B doesn’t.
Solution A
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.
Содержание GD32F10 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F10x Arm Cortex M3 32 bit MCU User Manual Revision 2 6 Jun 2022 ...
Страница 63: ...GD32F10x User Manual 63 programmed during the chip production ...
Страница 117: ...GD32F10x User Manual 117 010 1 0 011 0 9 ...
Страница 416: ...GD32F10x User Manual 416 shadow register updates every update event ...
Страница 427: ...GD32F10x User Manual 427 value ...
Страница 518: ...GD32F10x User Manual 518 These bits are not used in SPI mode ...