AT32F425
Series Reference Manual
2022.03.30
Page 132
Ver 2.01
6.
Set transfer direction (by setting the DIR bit in the I2C_CTRL2 register)
―
DIR=0: Master reception
―
DIR=1: Master transmission
7.
Start data transfer
In case of GENSTART=1 in the I2C_CTRL2 register, the master starts sending a START condition
and slave address. After receiving the ACK from the slave, ADDRF=1 is asserted in the I2C_STS
register. The ADDRF flag can be cleared by setting ADDRC=1 in the I2C_CLR register, and then
data transfer starts.
8.
Master transmit
1.
I2C_TXDT data register is empty, the shift register is empty, TDIS=1 in the I2C_STS register
2.
Writing 1 to the TXDT register, and data is immediately moved to the shift register
3. TXDT
register becomes empty, TDIS=1 again
4.
Writing 2 to the TXDT register, TDIS is cleared
5.
Repeat step 2 and 3 until the specified data (N-1) is sent
6.
The master will automatically transmit the Nth data, that is, PEC.
9.
Master receive
1.
After the reception of data, RDBF=1, read the RXDT register will clear the RDBF automatically
2.
Repeat step 1 until the reception of the specified data (N). The Nth data is set as PEC. A NACK
is automatically sent after the recept of the Nth data (PEC) whatever the PEC result.
10. STOP condition
―
STOP condition generation:
ASTOPEN=0: TDC=1 in the I2C_STS register, set GENSTOP=1 to generate a STOP condition
ASTOPEN=1: A STOP condition is generated automatically
―
Wait for the generation of a STOP condition, when a STOP condition is generated, STOPF=1
is asserted in the I2C_STS register. The STOPF flag can be cleared by setting STOPC=1 in
the I2C_CLR register, and then transfer stops