
395
Atmel | SMART SAM D20 [DATASHEET]
Atmel-42129K–SAM-D20_datasheet–06/2014
Figure 26-6. I2C Master Behavioral Diagram
Transmitting Address Packets
The I2C master starts a bus transaction by writing ADDR.ADDR with the I2C slave address and the direction bit. If the bus
is busy, the I
2C master will wait until the bus becomes idle before continuing the operation. When the bus is idle, the I2C
master will issue a start condition on the bus. The I2C master will then transmit an address packet using the address
written to ADDR.ADDR.
After the address packet has been transmitted by the I2C master, one of four cases will arise, based on arbitration and
transfer direction.
Case 1: Arbitration lost or bus error during address packet transmission
If arbitration was lost during transmission of the address packet, the Master on Bus bit in the Interrupt Flag register
(INTFLAG.MB) and the Arbitration Lost bit in the Status register (STATUS.ARBLOST) are both set. Serial data output to
SDA is disabled, and the SCL is released, which disables clock stretching. In effect the I2C master is no longer allowed to
perform any operation on the bus until the bus is idle again. A bus error will behave similarly to the arbitration lost
condition. In this case, the MB interrupt flag and Master Bus Error bit in the Status register (STATUS.BUSERR) are both
set in addition to STATUS.ARBLOST.
The Master Received Not Acknowledge bit in the Status register (STATUS.RXNACK) will always contain the last
successfully received acknowledge or not acknowledge indication.
In this case, software will typically inform the application code of the condition and then clear the interrupt flag before
exiting the interrupt routine. No other flags have to be cleared at this point, because all flags will be cleared automatically
the next time the ADDR.ADDR register is written.
Case 2: Address packet transmit complete – No ACK received
If no I2C slave device responds to the address packet, then the INTFLAG.MB interrupt flag is set and STATUS.RXNACK
is set. The clock hold is active at this point, preventing further activity on the bus.
IDLE
S
BUSY
P
Sr
P
M3
M2
M1
R
DATA
ADDRESS
W
A/A
DATA
Wait for
IDLE
APPLICATION
S
W
S
W
Sr
P
M3
M2
BUSY
M4
A
S
W
A/A
M4
A
IDLE
MASTER READ INTERRUPT+ HOLD
MASTER WRITE INTERRUPT+ HOLD
S
W
S
W
S
W
BUSY
R/W
S
W
Software interaction
The master provides data
on the bus
Addressed slave provides
data on the bus
A
R/W
BUSY
M4