eUSCI_B Operation – I
2
C Mode
839
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
Enhanced Universal Serial Communication Interface (eUSCI) – I
2
C Mode
The UCCLTOIFG interrupt allows the software to react if the clock is low longer than a defined time. It is possible to detect the situation, when a
clock is stretched by a master or slave for a too long time. The user can then, for example, reset the eUSCI_B module by using the UCSWRST bit.
The clock low time-out feature is enabled using the UCCLTO bits. It is possible to select one of three predefined times for the clock low time-out. If
the clock has been low longer than the time defined with the UCCLTO bits and the eUSCI_B was actively receiving or transmitting, the
UCCLTOIFG is set and an interrupt request is generated if UCCLTOIE and GIE are set as well. The UCCLTOIFG is set only once, even if the
clock is stretched a multiple of the time defined in UCCLTO.
32.3.8 Byte Counter
The eUSCI_B module supports hardware counting of the bytes received or transmitted. The counter is automatically active and counts up for each
byte seen on the bus in both master and slave mode.
The byte counter is incremented at the second bit position of each byte independently of the following ACK or NACK. A START or RESTART
condition resets the counter value to zero. Address bytes do not increment the counter. The byte counter is also incremented at the second bit
position, if an arbitration lost occurs during the first bit of data.
32.3.8.1 Byte Counter Interrupt
If UCASTPx = 01 or 10 the UCBCNTIFG is set when the byte counter threshold value UCBxTBCNT is reached in both master- and slave-mode.
Writing zero to UCBxTBCNT does not generate an interrupt.
Because the UCBCNTIFG has a lower interrupt priority than the UCBTXIFG and UCBRXIFG, TI recommends using it only for protocol control
together with the DMA handling the received and transmitted bytes. Otherwise, the application must have enough processor bandwidth to ensure
that the UCBCNT interrupt routine is executed in time to generate for example a RESTART.
32.3.8.2 Automatic STOP Generation
When the eUSCI_B module is configured as a master, the byte counter can be used for automatic STOP generation by setting the UCASTPx = 10.
Before starting the transmission using UCTXSTT, the byte counter threshold UCBxTBCNT must be set to the number of bytes that are to be
transmitted or received. After the number of bytes that are configured in UCBxTBCNT have been transmitted, the eUSCI_B automatically
generates a STOP condition.
UCBxTBCNT cannot be used if the user wants to transmit the slave address only without any data. In this case, TI recommends setting UCTXSTT
and UCTXSTP at the same time.
32.3.9 Multiple Slave Addresses
The eUSCI_B module supports two different ways of implementing multiple slave addresses at the same time:
•
Hardware support for up to 4 different slave addresses, each with its own interrupt flag and DMA trigger
•
Software support for up to 2
10
different slave addresses all sharing one interrupt