User manual
...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 427
www.energymicro.com
16.3.9.1 Slave State Machine
The slave state machine is shown in Figure 16.11 (p. 427) . The dotted lines show where I
2
C-specific
interrupt flags are set. The full-drawn circles show places where interaction may be required by software
to let the transmission proceed.
Figure 16.11. I
2
C Slave State Machine
73 D5
DD
0
41
S ADDR R A
N
ADDR W
A
N
DATA P
Sr
Arb. lost 1
71 B1
0
41
A
N
A
N
DATA P
Sr
Slave transmitter
Slave receiver
X Arb. lost 1
Idle/busy
0/1
Bus state/event
Transmitted by self
Received from m aster
Bus state (STATE)
Interrupt flag set
Interaction required. Clock-
stretching applied until
manual or autom atic
interaction has been
perform ed
Go to state
16.3.9.2 Address Recognition
The I
2
C module provides automatic address recognition for 7-bit addresses. 10-bit address recognition is
not fully automatic, but can be assisted by the 7-bit address comparator as shown in Section 16.3.11 (p.
431) . Address recognition is supported in all energy modes (except EM4).
The slave address, i.e. the address which the I
2
C module should be addressed with, is defined in
the I2Cn_SADDR register. In addition to the address, a mask must be specified, telling the address
comparator which bits of an incoming address to compare with the address defined in I2Cn_SADDR.
The mask is defined in I2Cn_SADDRMASK, and for every zero in the mask, the corresponding bit in
the slave address is treated as a don’t-care.
An incoming address that fails address recognition is automatically replied to with a NACK. Since only
the bits defined by the mask are checked, a mask with a value 0x00 will result in all addresses being
accepted. A mask with a value 0x7F will only match the exact address defined in I2Cn_SADDR, while
a mask 0x70 will match all addresses where the three most significant bits in I2Cn_SADDR and the
incoming address are equal.
If GCAMEN in I2Cn_CTRL is set, the general call address is always accepted regardless of the result
of the address recognition. The start-byte, i.e. the general call address with the R/W bit set is ignored
unless it is included in the defined slave address.
When an address is accepted by the address comparator, the decision of whether to ACK or NACK the
address is passed to software.
16.3.9.3 Slave Transmitter
When SLAVE in I2Cn_CTRL is set, the RSTART interrupt flag in I2Cn_IF will be set when repeated
START conditions are detected. No interaction is required on this event however.