GD32F10x User Manual
467
the address which has been sent is a header of 10-bit address, the hardware sets
ADD10SEND bit after sending 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.
If the address is in 10-bit format, software should then set START bit again to generate
a repeated START signal on I2C bus and SBSEND is set after the repeated START is
sent out. Software should clear the SBSEND bit by reading I2C_STAT0 and writing
header to I2C_DATA. Then the header is sent out to I2C bus, and ADDSEND is set again.
Software should again clear ADDSEND by reading I2C_STAT0 and then I2C_STAT1.
5.
As soon as the first byte is received, RBNE is set by hardware. Software now can read
the first byte from I2C_DATA and RBNE is cleared as well.
6.
Any time RBNE is set, software can read a byte from I2C_DATA until the master receives
N-3 bytes.
As shown in
Figure 17-13. Programming model for master receiving mode using
solution B (10-bit address mode)
, the N-2 byte is not read out by software, so after the N-
1 byte is received, both BTC and RBNE are asserted. The bus is stretched by master to
prevent the reception of the last byte. Then software should clear ACKEN bit.
7.
Software reads out N-2 byte, clearing BTC. After this, the N-1 byte is moved from shift
register to I2C_DATA and bus is released and begins to receive the last byte. Master
doesn’t send an ACK for the last byte because ACKEN is already cleared.
8.
After the last byte is received, both BTC and RBNE are set again, and SCL is stretched
low. Software sets STOP bit and master sends out a STOP signal on bus.
9.
Software reads the N-1 byte, clearing BTC. After this the last byte is moved from shift
register to I2C_DATA.
10.
Software reads the last byte, clearing RBNE.
The above steps require that byte number N>2. N=1 and N=2 are similar:
N=1
In Step4, software should reset ACKEN bit before clearing ADDSEND bit and set STOP bit
after clearing ADDSEND bit. Step 5 is the last step when N=1.
N=2
In Step 2, software should set POAP bit before setting START bit. In Step 4, software should
reset ACKEN bit before clearing ADDSEND bit. In Step 5, software should wait until BTC is
set and then set STOP bit and read I2C_DATA twice.
Figure 17-13. Programming model for master receiving mode using solution B (10-bit
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 ...