eUSCI_B Operation – I
2
C Mode
975
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
Enhanced Universal Serial Communication Interface (eUSCI) – I
2
C Mode
26.3.9 Using the eUSCI_B Module in I
2
C Mode With Low-Power Modes
The eUSCI module is not functional when the device is in LPM3, LPM4, or LPMx.5 modes of operation.
However, the application can make use of the FORCE_LPM_ENTRY bit in the PCMCTL1 register to
determine whether the entry to low-power mode should be aborted if the eUSCI is active, or if the device
can continue low power entry regardless. The latter option is useful if the eUSCI is transmitting and
receiving data at a very slow rate, and the application can tolerate entry to low-power mode at the
expense of a packet of data being lost. Refer to the
Power Control Manager (PCM)
chapter for more
details.
26.3.10 eUSCI_B Interrupts in I
2
C Mode
The eUSCI_B has only one interrupt vector that is shared for transmission, reception, and the state
change.
Each interrupt flag has its own interrupt enable bit. When an interrupt is enabled, the interrupt flag
generates an interrupt request. DMA transfers are controlled by the UCTXIFGx and UCRXIFGx flags on
devices with a DMA controller. It is possible to react on each slave address with an individual DMA
channel.
All interrupt flags are not cleared automatically, but they need to be cleared together by user interactions
(for example, reading the UCRXBUF clears UCRXIFGx). If the user wants to use an interrupt flag he
needs to ensure that the flag has the correct state before the corresponding interrupt is enabled.
26.3.10.1 I
2
C Transmit Interrupt Operation
The UCTXIFG0 interrupt flag is set whenever the transmitter is able to accept a new byte. When operating
as a slave with multiple slave addresses, the UCTXIFGx flags are set corresponding to which address
was received before. If, for example, the slave address specified in register UCBxI2COA3 did match the
address seen on the bus, the UCTXIFG3 indicates that the UCBxTXBUF is ready to accept a new byte.
When operating in master mode with automatic STOP generation (UCASTPx = 10), the UCTXIFG0 is set
as many times as defined in UCBxTBCNT.
An interrupt request is generated if UCTXIEx is set. UCTXIFGx is automatically reset if a write to
UCBxTXBUF occurs or if the UCALIFG is cleared. UCTXIFGx is set when:
•
Master mode: UCTXSTT was set by the user
•
Slave mode: own address was received(UCETXINT = 0) or START was received (UCETXINT = 1)
UCTXIEx is reset after a Hard Reset or when UCSWRST = 1.
26.3.10.2 Early I
2
C Transmit Interrupt
Setting the UCETXINT causes UCTXIFG0 to be sent out automatically when a START condition is sent
and the eUSCI_B is configured as slave. In this case, it is not allowed to enable the other slave addresses
UCBxI2COA1 to UCBxI2COA3. This allows the software more time to handle the UCTXIFG0 compared to
the normal situation, when UCTXIFG0 is sent out after the slave address match was detected. Situations
where the UCTXIFG0 was set and afterward no slave address match occurred need to be handled in
software. TI recommends using the byte counter to handle this.
26.3.10.3 I
2
C Receive Interrupt Operation
The UCRXIFG0 interrupt flag is set when a character is received and loaded into UCBxRXBUF. When
operating as a slave with multiple slave addresses, the UCRXIFGx flag is set corresponding to which
address was received before.
An interrupt request is generated if UCRXIEx is set. UCRXIFGx and UCRXIEx are reset after a Hard
Reset signal or when UCSWRST = 1. UCRXIFGx is automatically reset when UCxRXBUF is read.
26.3.10.4 I
2
C State Change Interrupt Operation
describes the I
2
C state change interrupt flags.