Datasheet

www.ti.com
USCI Operation: I
2
C Mode
17.3.4.2.2 I
2
C Master Receiver Mode
After initialization, master receiver mode is initiated by writing the desired slave address to the
UCBxI2CSA register, selecting the size of the slave address with the UCSLA10 bit, clearing UCTR for
receiver mode, and setting UCTXSTT to generate a START condition.
The USCI module checks if the bus is available, generates the START condition, and transmits the slave
address. As soon as the slave acknowledges the address the UCTXSTT bit is cleared.
After the acknowledge of the address from the slave the first data byte from the slave is received and
acknowledged and the UCBxRXIFG flag is set. Data is received from the slave ss long as UCTXSTP or
UCTXSTT is not set. If UCBxRXBUF is not read the master holds the bus during reception of the last data
bit and until the UCBxRXBUF is read.
If the slave does not acknowledge the transmitted address the not-acknowledge interrupt flag
UCNACKIFG is set. The master must react with either a STOP condition or a repeated START condition.
Setting the UCTXSTP bit will generate a STOP condition. After setting UCTXSTP, a NACK followed by a
STOP condition is generated after reception of the data from the slave, or immediately if the USCI module
is currently waiting for UCBxRXBUF to be read.
If a master wants to receive a single byte only, the UCTXSTP bit must be set while the byte is being
received. For this case, the UCTXSTT may be polled to determine when it is cleared:
BIS.B #UCTXSTT,&UCBOCTL1 ;Transmit START cond.
POLL_STT BIT.B #UCTXSTT,&UCBOCTL1 ;Poll UCTXSTT bit
JC POLL_STT ;When cleared,
BIS.B #UCTXSTP,&UCB0CTL1 ;transmit STOP cond.
Setting UCTXSTT will generate a repeated START condition. In this case, UCTR may be set or cleared to
configure transmitter or receiver, and a different slave address may be written into UCBxI2CSA if desired.
Figure 17-13 shows the I
2
C master receiver operation.
NOTE: Consecutive Master Transactions Without Repeated Start
When performing multiple consecutive I
2
C master transactions without the repeated start
feature, the current transaction must be completed before the next one is initiated. This can
be done by ensuring that the transmit stop condition flag UCTXSTP is cleared before the
next I
2
C transaction is initiated with setting UCTXSTT = 1. Otherwise, the current transaction
might be affected.
461
SLAU144JDecember 2004Revised July 2013
Universal Serial Communication Interface, I
2
C Mode
Submit Documentation Feedback
Copyright © 2004–2013, Texas Instruments Incorporated