219
8151H–AVR–02/11
ATmega128A
The slave receiver mode may also be entered if arbitration is lost while the TWI is in the master
mode (see states $68 and $78).
If the TWEA bit is reset during a transfer, the TWI will return a “Not Acknowledge” (“1”) to SDA
after the next received data byte. This can be used to indicate that the slave is not able to
receive any more bytes. While TWEA is zero, the TWI does not acknowledge its own slave
address. However, the Two-wire Serial Bus is still monitored and address recognition may
resume at any time by setting TWEA. This implies that the TWEA bit may be used to temporarily
isolate the TWI from the Two-wire Serial Bus.
In all sleep modes other than Idle mode, the clock system to the TWI is turned off. If the TWEA
bit is set, the interface can still acknowledge its own slave address or the general call address by
using the Two-wire Serial Bus clock as a clock source. The part will then wake up from sleep
and the TWI will hold the SCL clock low during the wake up and until the TWINT flag is cleared
(by writing it to one). Further data reception will be carried out as normal, with the AVR clocks
running as normal. Observe that if the AVR is set up with a long start-up time, the SCL line may
be held low for a long time, blocking other data transmissions.
Note that the Two-wire Serial Interface Data Register – TWDR does not reflect the last byte
present on the bus when waking up from these sleep modes.
Table 21-4.
Status Codes for Slave Receiver Mode
Status Code
(TWSR)
Prescaler Bits
are 0
Status of the Two-wire Serial Bus
and Two-wire Serial Interface
Hardware
Application Software Response
Next Action Taken by TWI Hardware
To/from TWDR
To TWCR
STA
STO
TWIN
T
TWE
A
$60
Own SLA+W has been received;
ACK has been returned
No TWDR action or
No TWDR action
X
0
1
0
1
Data byte will be received and NOT ACK will be
returned
Data byte will be received and ACK will be returned
$68
Arbitration lost in SLA+R/W as
master; own SLA+W has been
received; ACK has been returned
No TWDR action or
No TWDR action
X
0
1
0
1
Data byte will be received and NOT ACK will be
returned
Data byte will be received and ACK will be returned
$70
General call address has been
received; ACK has been returned
No TWDR action or
No TWDR action
X
0
1
0
1
Data byte will be received and NOT ACK will be
returned
Data byte will be received and ACK will be returned
$78
Arbitration lost in SLA+R/W as
master; General call address has
been received; ACK has been
returned
No TWDR action or
No TWDR action
X
0
1
0
1
Data byte will be received and NOT ACK will be
returned
Data byte will be received and ACK will be returned
$80
Previously addressed with own
SLA+W; data has been received;
ACK has been returned
Read data byte or
Read data byte
X
0
1
0
1
Data byte will be received and NOT ACK will be
returned
Data byte will be received and ACK will be returned
$88
Previously addressed with own
SLA+W; data has been received;
NOT ACK has been returned
Read data byte or
Read data byte
0
1
0
1
0
1
0
1
Switched to the not addressed slave mode;
no recognition of own SLA or GCA
Switched to the not addressed slave mode;
own SLA will be recognized;
GCA will be recognized if TWGCE = “1”
Switched to the not addressed slave mode;
no recognition of own SLA or GCA;
a START condition will be transmitted when the bus
becomes free
Switched to the not addressed slave mode;
own SLA will be recognized;
GCA will be recognized if TWGCE = “1”;
a START condition will be transmitted when the bus
becomes free