...the world's most energy friendly microcontrollers
2016-04-28 - Giant Gecko Family - d0053_Rev1.20
425
www.silabs.com
set in a pending state, which can be read from the STATUS register. A pending START command can
for instance be identified by PSTART having a high value.
Whenever the I
2
C module requires an interaction, it checks the pending commands. If one or a
combination of these can fulfill an interaction, they are consumed by the module and the transmission
continues without setting the BUSHOLD interrupt flag in I2Cn_IF to get an interaction from software.
The pending status of a command goes low when it is consumed.
When several interactions are possible from a set of pending commands, the interaction with the highest
priority, i.e. the interaction closest to the top of Table 16.4 (p. 424) is applied to the bus.
Pending commands can be cleared by setting the CLEARPC command bit in I2Cn_CMD.
16.3.7.2.1 Automatic ACK Interaction
When receiving addresses and data, an ACK command in I2Cn_CMD is normally required after each
received byte. When AUTOACK is set in I2Cn_CTRL, an ACK is always pending, and the ACK-pending
bit PACK in I2Cn_STATUS is thus always set, even after an ACK has been consumed. This can be used
to reduce the amount of software interaction required during a transfer.
16.3.7.3 Reset State
After a reset, the state of the I
2
C-bus is unknown. To avoid interrupting transfers on the I
2
C-bus after
a reset of the I
2
C module or the entire MCU, the I
2
C-bus is assumed to be busy when coming out of a
reset, and the BUSY flag in I2Cn_STATUS is thus set. To be able to carry through master operations
on the I
2
C-bus, the bus must be idle.
The bus goes idle when a STOP condition is detected on the bus, but on buses with little activity, the
time before the I
2
C module detects that the bus is idle can be significant. There are two ways of assuring
that the I
2
C module gets out of the busy state.
• Use the ABORT command in I2Cn_CMD. When the ABORT command is issued, the I
2
C module is
instructed that the bus is idle. The I
2
C module can then initiate master operations.
• Use the Bus Idle Timeout. When SCL has been high for a long period of time, it is very likely that the
bus is idle. Set BITO in I2Cn_CTRL to an appropriate timeout period and set GIBITO in I2Cn_CTRL.
If activity has not been detected on the bus within the timeout period, the bus is then automatically
assumed idle, and master operations can be initiated.
Note
If operating in slave mode, the above approach is not necessary.
16.3.7.4 Master Transmitter
To transmit data to a slave, the master must operate as a master transmitter. Table 16.5 (p. 426)
shows the states the I
2
C module goes through while acting as a master transmitter. Every state where
an interaction is required has the possible interactions listed, along with the result of the interactions.
The table also shows which interrupt flags are set in the different states. The interrupt flags enclosed
in parenthesis may be set. If the BUSHOLD interrupt in I2Cn_IF is set, the module is waiting for an
interaction, and the bus is frozen. The value of I2Cn_STATE will be equal to the values given in the table
when the BUSHOLD interrupt flag is set, and can be used to determine which interaction is required to
make the transmission continue.
The interrupt flag START in I2Cn_IF is set when the I
2
C module transmits the START.
A master operation is started by issuing a START command by setting START in I2Cn_CMD. ADDR
+W, i.e. the address of the slave to a the R/W bit is then required by the I
2
C module. If this
is not available in the transmit buffer, then the bus is held and the BUSHOLD interrupt flag is set. The
Summary of Contents for Giant Gecko EFM32GG
Page 842: ......