User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 429
www.energymicro.com
Table 16.8. I
2
C Slave Transmitter
I2Cn_STATEDescription I2Cn_IF Required
interaction
Response
0x41 Repeated START
received
RSTART interrupt flag
(BUSHOLD interrupt
flag)
RXDATA Receive and compare address
ADDR interrupt flag ACK +
TXDATA
ACK will be sent, then DATA
RXDATA interrupt flag NACK NACK will be sent, slave goes idle
0x73 ADDR + R received
(BUSHOLD interrupt
flag)
NACK +
CONT +
TXDATA
NACK will be sent, then DATA.
- Data transmitted TXBL interrupt flag
(TXC interrupt flag)
None
0xD5 Data transmitted, ACK
received
ACK interrupt flag
(BUSHOLD interrupt
flag)
TXDATA DATA will be transmitted
NACK interrupt flag None The slave goes idle0xDD Data transmitted,
NACK received
(BUSHOLD interrupt
flag)
CONT +
TXDATA
DATA will be transmitted
None The slave goes idle- Stop received SSTOP interrupt flag
START START will be sent when bus becomes idle
None The slave goes idle- Arbitration lost ARBLOST interrupt
flag
START START will be sent when the bus becomes idle
16.3.9.4 Slave Receiver
A slave receiver operation is started in the same way as a slave transmitter operation, with the exception
that the address transmitted by the master has the R/W bit cleared (W), indicating that the master wishes
to write to the slave. The slave then goes into slave receiver mode.
To receive data from the master, the slave should respond to the address with an ACK and make sure
space is available in the receive buffer. Transmission will then continue, and the slave will receive a
byte from the master.
If a NACK is sent without a CONT, the transmission is ended for the slave, and it goes idle. If the slave
issues both the NACK and CONT commands and has space available in the receive buffer, it will be
open for continuing reception from the master.
When a byte has been received from the master, the slave must ACK or NACK the byte. The responses
here are the same as for the reception of the address byte.
The master ends the transmission by sending a STOP or a repeated START. The SSTOP interrupt flag
is set when the master transmits a STOP condition. If the transmission is ended with a repeated START,
then the SSTOP interrupt flag in I2Cn_IF is not set.
Note
The SSTOP interrupt flag in I2Cn_IF will be set regardless of whether the slave is
participating in the transmission or not, as long as SLAVE in I2Cn_CTRL is set and a STOP
condition is detected
If arbitration is lost at any time during transmission, the ARBLOST interrupt flag in I2Cn_IF is set, the
bus is released and the slave goes idle.