GD32F20x User Manual
525
3.
As soon as the first byte is received, RBNE is set by hardware. Software can now read
the first byte from I2C_DATA and RBNE is cleared as well.
4.
Any time RBNE is set, software can read a byte from I2C_DATA.
5.
After last byte is received, RBNE is set. Software reads the last byte.
6.
STPDET bit is set when I2C detects a STOP condition on I2C bus and software reads
I2C_STAT0 and then write I2C_CTL0 to clear the STPDET bit.
Figure 20-10. Programming model for slave receiving
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
Figure 20-11. Programming model for master transmitting
, the following
software procedure should be followed if users wish to make transaction in master transmitter
mode:
1.
First of all, software should 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 condition followed by address
on I2C bus.
2.
Software set START bit requesting I2C to generate a START condition to I2C bus.
3.
After sending a START condition, the I2C hardware sets the SBSEND bit in I2C status
Содержание GD32F20 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F20x ARM Cortex M3 32 bit MCU User Manual Revision 2 2 Oct 2019 ...
Страница 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Страница 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Страница 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Страница 385: ...GD32F20x User Manual 385 ...
Страница 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...