15.3.7.2 Interactions
Whenever the I
2
C module is waiting for interaction from software, it holds the bus clock SCL low, freezing all bus activities, and the
BUSHOLD interrupt flag in I2Cn_IF is set. The action(s) required by software depends on the current state the of the I
2
C module. This
state can be read from the I2Cn_STATE register.
As an example,
Table 15.3 I2C Master Transmitter on page 408
shows the different states the I
2
C goes through when operating as a
Master Transmitter, i.e., a master that transmits data to a slave. As seen in the table, when a start condition has been transmitted, a
requirement is that there is an address and an R/W bit in the transmit buffer. If the transmit buffer is empty, then the BUSHOLD interrupt
flag is set, and the bus is held until data becomes available in the buffer. While waiting for the address, I2Cn_STATE has a value 0x57,
which can be used to identify exactly what the I
2
C module is waiting for.
Note:
The bus would never stop at state 0x57 if the address was available in the transmit buffer.
The different interactions used by the I
2
C module are listed in
Table 15.2 I2C Interactions in Prioritized Order on page 406
tized order. If the I
2
C module is in such a state that multiple courses of action are possible, then the action chosen is the one that has
the highest priority. For example, after sending out a START, if an address is present in the buffer and a STOP is also pending, then the
I
2
C will send out the STOP since it has the higher priority.
Table 15.2. I2C Interactions in Prioritized Order
Interaction
Priority
Software action
Automatically continues if
STOP*
1
Set the STOP command bit in
I2Cn_CMD
PSTOP is set (STOP pending)
in I2Cn_STATUS
ABORT
2
Set the ABORT command bit in
I2Cn_CMD
Never, the transmission is abor-
ted
CONT*
3
Set the CONT command bit in
I2Cn_CMD
PCONT is set in I2Cn_STATUS
(CONT pending)
NACK*
4
Set the NACK command bit in
I2Cn_CMD
PNACK is set in I2Cn_STATUS
(NACK pending)
ACK*
5
Set the ACK command bit in
I2Cn_CMD
AUTOACK is set in I2Cn_CTRL
or PACK is set in I2Cn_STATUS
(ACK pending)
ADDR+W -> TXDATA
6
Write an address to the transmit
buffer with the R/W bit set
Address is available in transmit
buffer with R/W bit set
ADDR+R -> TXDATA
7
Write an address to the transmit
buffer with the R/W bit cleared
Address is available in transmit
buffer with R/W bit cleared
START*
8
Set the START command bit in
I2Cn_CMD
PSTART is set in I2Cn_STATUS
(START pending)
TXDATA/ TXDOUBLE
9
Write data to the transmit buffer Data is available in transmit buf-
fer
RXDATA/ RXDOUBLE
10
Read data from receive buffer
Space is available in receive
buffer
None
11
No interaction is required
The commands marked with a * in
Table 15.2 I2C Interactions in Prioritized Order on page 406
can be issued before an interaction is
required. When such a command is issued before it can be used/consumed by the I
2
C module, the command is 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 inter-
action, 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.
EFM32JG1 Reference Manual
I2C - Inter-Integrated Circuit Interface
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 406