31.4.2.3.1 Receiving Address Packets (SCLSM=0)
When CTRLA.SCLSM=‘0’, the I2C client stretches the SCL line as
described in Figure 31-9. When the I2C client is
properly configured, it waits for a Start condition.
When a start condition is detected, the subsequent address packet is received and checked by the address-match logic. If the received address does not match, the packet is rejected, and the I2C client waits for a new Start condition. If the received address matches, the Address Match bit in the Interrupt Flag register (INTFLAG.AMATCH) is set.
SCL is stretched until the I2C client clears INTFLAG.AMATCH. Because the I2C client holds the clock by forcing SCL low, the software has unlimited time to respond.
The direction of a transaction is determined by reading the Read/Write Direction bit in the STATUS register (STATUS.DIR). This bit is updated only when a valid address packet is received.
If the Transmit Collision bit in the STATUS register (STATUS.COLL) is set, it indicates that the last packet addressed to the I2C client experienced a packet collision. A collision causes the SDA and SCL lines to be released without notifying the software. Therefore, the next AMATCH interrupt provides the first indication of the previous packet’s collision. Collisions are intended to comply with the SMBus Address Resolution Protocol (ARP).
After the address packet is received from the I2C host, one of two cases arises, depending on the transfer direction.
Case 1: Address packet accepted – Read flag set
The STATUS.DIR bit is ‘1’, indicating an I2C host read operation. The
SCL line is forced low, stretching the bus clock. If an ACK is
sent, the I2C client hardware sets the Data Ready bit
in the Interrupt Flag register (INTFLAG.DRDY), indicating that
data are needed for transmit. If a NACK is sent, the
I2C client waits for a new start
condition and address match.
Typically, software immediately acknowledges the address packet by sending an ACK/NACK bit. The
I2C client Command bit field in the
Control B register (CTRLB.CMD) can be written to '0x3' for both
read and write operations because the command execution depends
on the STATUS.DIR bit. Writing ‘1’ to
INTFLAG.AMATCH also causes an ACK/NACK to be sent according to
the CTRLB.ACKACT bit.
Case 2: Address packet accepted – Write flag set
The STATUS.DIR bit is cleared, indicating an I2C host write operation. The SCL line is forced low, stretching the bus clock. If an ACK is sent, the I2C client waits for data to be received. Data, a repeated Start condition, or a Stop condition can then be received.
If a NACK is sent, the I2C client waits for a new Start condition and address match.
Typically, software immediately acknowledges the address packet
by sending an ACK/NACK. The I2C client command
CTRLB.CMD = 0x3 can be used for both read and
write operations as the command execution depends on
STATUS.DIR.
Writing ‘1’ to INTFLAG.AMATCH also causes an ACK/NACK to be sent according to
the CTRLB.ACKACT bit.
