Figure 34-10. I
2
C Slave Behavioral Diagram (SCLSM=1)
S
S3
ADDRESS
S2
R
W
DATA
A/A
DATA
P
S2
Sr
S3
P
S2
Sr
S3
S
W
S
W
S
W
A/A
S
W
Interrupt on STOP
Condition Enabled
S1
S
W
Software interaction
The master provides data
on the bus
Addressed slave provides
data on the bus
A/A
A/A
PREC INTERRUPT
AMATCH INTERRUPT
(+
DRDY INTERRUPT
in Master Read mode)
DRDY INTERRUPT
Receiving Address Packets (SCLSM=0)
When CTRLA.SCLSM=0, the I2C slave stretches the SCL line according to
2
C
slave is properly configured, it will wait for a start condition.
When a start condition is detected, the successive address packet will be received and checked by the
address match logic. If the received address is not a match, the packet will be rejected, and the I
2
C slave
will wait for a new start condition. If the received address is a match, the Address Match bit in the
Interrupt Flag register (INTFLAG.AMATCH) will be set.
SCL will be stretched until the I
2
C slave clears INTFLAG.AMATCH. As the I
2
C slave 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 will be updated only when a valid address packet is received.
If the Transmit Collision bit in the Status register (STATUS.COLL) is set, this indicates that the last packet
addressed to the I
2
C slave had a packet collision. A collision causes the SDA and SCL lines to be
released without any notification to software. Therefore, the next AMATCH interrupt is the first indication
of the previous packet’s collision. Collisions are intended to follow the SMBus Address Resolution
Protocol (ARP).
After the address packet has been received from the I
2
C master, one of two cases will arise based on
transfer direction.
Case 1: Address packet accepted – Read flag set
The STATUS.DIR bit is ‘1’, indicating an I
2
C master read operation. The SCL line is forced low, stretching
the bus clock. If an ACK is sent, I
2
C slave hardware will set the Data Ready bit in the Interrupt Flag
register (INTFLAG.DRDY), indicating data are needed for transmit. If a NACK is sent, the I
2
C slave will
wait for a new start condition and address match.
Typically, software will immediately acknowledge the address packet by sending an ACK/NACK bit. The
I
2
C slave Command bit field in the Control B register (CTRLB.CMD) can be written to '0x3' for both read
Atmel SAM L22G / L22J / L22N [DATASHEET]
Atmel-42402E-SAM L22G / L22J / L22N_Datasheet_Complete-07/2016
692