615
/
838
Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
8.
After the last byte is sent, because the shift register and the I2C_DAT register are empty at this time, the I2C
host sets the I2C_STS1.BSF bit (byte transmission end), and the I2C interface will keep SCL low before clearing
the I2C_STS1.BSF bit. After reading I2C_STS1, writing to the I2C_DAT register will clear the I2C_STS1.BSF
bit. The software sets the I2C_CTRL1.STOPGEN bit at this time to generate a stop condition, and then the I2C
interface will automatically return to the slave mode (I2C_STS2.MSMODE bit is cleared).
Figure 22-5 Master transmitter transfer sequence diagram
Instructions
:
1.
EV5: I2C_STS1.STARTBF = 1, reading STS1 and writing the address to the DAT register will clear the event.
2.
EV6: I2C_STS1.ADDRF = 1, read STS1 and then STS2 to clear the event.
3.
EV8_1: I2C_STS1.TXDATE = 1, shift register is empty, data register is empty, write DAT register.
4.
EV8: I2C_STS1.TXDATE = 1, shift register is not empty, data register is empty, write to DAT register will clear
the event.
5.
EV8_2: I2C_STS1.TXDATE = 1, I2C_STS1.BSF = 1, request to set stop bit. These two events are cleared by
the hardware when a stop condition is generated.
6.
EV9: I2C_STS1.ADDR10F = 1, read STS1 and then write to DAT register to clear the event.
Note: a) EV5, EV6, EV9, EV8_1 and EV8_2 event prolonged the low SCL time until the end of the corresponding
software sequence.
b) The software sequence of EV8 must be completed before the end of the current byte transfer.
c) When I2C_STS1.TXDATE or I2C_STS1.BSF bit is set, stop condition should be arranged when EV8_2 occurs.
I2C master receiving mode
In master mode, software receiving data from I2C bus should follow the following steps:
1.
First, enable the I2C peripheral clock and configure the clock-related registers in I2C_CTRL1, in order to ensure
that the correct I2C timing is output. After enabling and configuring, I2C runs in slave mode by default, waiting
Start
Address(W)
ACK
EV8-1
Data1
ACK
Data2
ACK
EV8
DataN
ACK
Stop
ACK
Address
ACK
Data1
ACK
Start
Header(W)
Master
Tx
Master
Tx
Sl ave
Tx
Master
Tx
Master
Tx
Sl ave
Tx
Sl ave
Tx
Sl ave
Tx
Master
Tx
Master
Tx
DataN
ACK
Stop
Sl ave
Tx
Master
Tx
Master
Tx
EV8
EV8
Master
Tx
Master
Tx
Sl ave
Tx
Master
Tx
Sl ave
Tx
Sl ave
Tx
Master
Tx
10-bit address
7-bit address
EV8-2
EV8-2
EV5
EV8
EV6
EV5
EV9
EV8-1
EV8
EV6