![NXP Semiconductors QN902 Series Скачать руководство пользователя страница 61](http://html1.mh-extra.com/html/nxp-semiconductors/qn902-series/qn902-series_user-manual_1722213061.webp)
NXP Semiconductors
QN902x
User Manual of QN902x
UM10996
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2018. All rights reserved.
User Manual
Rev 1.3
— 05 November 2018
61 of 128
a TX_INT interrupt is generated to the processor to trigger the processing.
S
Slave Address (7-bit)
R/W
A
DATA (8-bit)
A
DATA (8-bit)
A/A
P
From master to slave
From slave to master
A = acknowledge (SDA LOW)
A = not acknowledge (SDA HIGH)
S = START condition
P = STOP condition
0=write
TX_INT
TX_INT
TX_INT
When the I2C controller (master mode) wants to send data to the slave, following steps
take place:
1.
Read BUSY to see if the I2C bus is free. Wait until it is free.
2.
Set MTSR_EN=1, and SCL_RATIO to the expected clock speed.
3.
Write formatted slave address into TXD, and R/nW(=0) bit. Then write START bit to
initiate a transfer.
4.
Wait for TX_INT interrupt, which is generated by the controller when ACK is received
from slave after master sent START condition, slave address and R/nW bit.
5.
TX_INT interrupt processing: if ACK_RECV=0, write new data into TXD, and set
WR_EN. If ACK_RECV=1, stop the data transfer or re-start by setting STOP or START
bit. After the register is set, clear TX_INT interrupt, and controller will clock out the
waveform you have configured.
6.
Repeat 5 and 6, if more data has to be sent.
7.
Set STOP to send stop signal to finish the transfer.
7.3.2
Master-receive
If the master wants to read data from the slave, the R/nW should be high. After the data
byte is received, the master should send the ACK/NACK bit to the slave. The ACK/NACK
bit should be pre-programmed to ACK_SEND. Once the ACK is sent, a RX_INT signal is
generated to the processor to read the data and trigger further processing.
S
Slave Address (7-bit)
R/W
A
DATA
A
DATA
A
P
1=read
TX_INT
RX_INT
RX_INT
When the I2C controller (master mode) wants to read data from the slave, following steps
take place:
1.
Read BUSY to see if the I2C bus is free. Wait until it is free.
2.
Set MTSR_EN=1, and SCL_RATIO to the expected clock speed.
3.
Write formatted slave address into TXD, and R/nW(=1) bit. Then write START bit to
initiate a transfer.
4.
Wait for TX_INT interrupt, which is generated by the controller when ACK is received
from the slave after the master sent START condition, slave address and R/nW bit.