273
8331B–AVR–03/12
Atmel AVR XMEGA AU
received. Data, repeated START, or STOP can be received after this. If NACK is sent, the slave
will wait for a new START condition and address match.
21.6.1.3
Case S3: Collision
If the slave is not able to send a high level or NACK, the collision flag is set, and it will disable the
data and acknowledge output from the slave logic. The clock hold is released. A START or
repeated START condition will be accepted.
21.6.1.4
Case S4: STOP condition received.
When the STOP condition is received, the slave address/stop flag will be set, indicating that a
STOP condition, and not an address match, occurred.
21.6.2
Receiving Data Packets
The slave will know when an address packet with R/W direction bit cleared has been success-
fully received. After acknowledging this, the slave must be ready to receive data. When a data
packet is received, the data interrupt flag is set and the slave must indicate ACK or NACK. After
indicating a NACK, the slave must expect a STOP or repeated START condition.
21.6.3
Transmitting Data Packets
The slave will know when an address packet with R/W direction bit set has been successfully
received. It can then start sending data by writing to the slave data register. When a data packet
transmission is completed, the data interrupt flag is set. If the master indicates NACK, the slave
must stop transmitting data and expect a STOP or repeated START condition.
21.7
Enabling External Driver Interface
An external driver interface can be enabled. When this is done, the internal TWI drivers with
input filtering and slew rate control are bypassed. The normal I/O pin function is used, and the
direction must be configured by the user software. When this mode is enabled, an external TWI
compliant tri-state driver is needed for connecting to a TWI bus.
By default, port pins 0 (Pn0) and 1 (Pn1) are used for SDA and SCL. The external driver inter-
face uses port pins 0 to 3 for the SDA_IN, SCL_IN, SDA_OUT, and SCL_OUT signals.