![ARTERY AT32F435 Series Скачать руководство пользователя страница 189](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592189.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 189
Rev 2.03
The ADDRF flag can be cleared by setting ADDRC=1 in the I2C_CLR register, and then data
transfer starts.
5.
Data transfer (slave transmission, clock stretching enabled, STRETCH=0)
After address matching:
1.
I2C_TXDT data register becomes empty, the shift register becomes empty, and TDIS=1 in the
I2C_STS register
2.
Data is then transferred to the shift register after writing 1 to the TXDT register
3.
The TXDT register then becomes empty, and the TDIS is set again
4.
TDIS is cleared by writing 2 to the TXDT register
5.
Repeat step 3 and 4 until data (N-1) is sent
6.
The slave will automatically transmit the Nth data, that is, PEC
7.
Wait for the generation of an NACK signal. Once received, the ACKFAILF is set in the I2C_STS
register. The ACKFAILF flag is cleared by writing 1 to the ACKFAILC
8.
Wait for the generation of a STOP condition. Once received, the STOPF is set in the I2C_STS
register. At the end of data transfer, the STOPF is cleared by writing 1 to the STOPC,
transmission ends.
6.
Data transfer (slave receive, clock stretching enabled, STRETCH=0)
After address matching:
1.
I2C_RXDT register becomes empty, the shift register becomes empty, and RDBF=0 in the
I2C_STS register
2.
Upon the receipt of one-byte data, RDBF=1 and TCRLD=1, then the SCL is pulled low by the
slave
3.
The RDBF is cleared by read operation to the RXDT register
4.
NACKEN bit of the I2C_CTRL register can be configured to generate an ACK or NACK,
if needed
If a NACK is detected, it indicates the completion of communication
If an ACK is detected, communication continues. Writing CNT=1 will automatically clear the
TCRLD flag by hardware, and the SCL is released by the slave for the reception of the next
data
5.
Repeat step 2/3/4 until the completion of data reception (N-1)
6.
Set RLDEN=0 of the I2C_CTRL2 register to disable reload mode. Set CNT=1 to repeat step
2/3 to receive a PEC. The PECERR bit will be set if a PEC error occurs
7.
Wait for the generation of a STOP condition. Once received, the STOPF is set in the I2C_STS
register. The STOPF can be cleared by writing 1 to the STOPC bit in the I2C_CLR register,
transfer ends.