This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F2274: I2C Slave Code for UCB0 does not send expected data to an I2C Master

Part Number: MSP430F2274
Other Parts Discussed in Thread: MSP-TS430DA38

Have 2 cards with MSP430F2274’s, one using UCB0 as an I2C Master reading selected data from an identical card needing to be a Slave. Slave UCB0 code appears to respond, but does not return correct data. No other devices are involved on either card nor on the I2C bus.

 

Cards are custom, essentially a subset of TI’s MSP-TS430DA38 and have worked with no issues on several projects for over 5 yrs.

 

Both ‘-2274’s run with DCO = 8 MHz, SMCLK = 1 MHz and I2C clock = 100 KHz. I2C pullups of 10K are located on the Master, with the 2 cards connected by wires ~6” long.

 

The Master ‘430 works as expected when connected only to a representative I2C device (specifically a TCS34725 color sensor chip) where the Master sends a “command” byte identifying a target register, and the TCS34725 in response returns 2 bytes of data from the specified register(s). ‘scope plot of such a transaction:

Replacing the TCS34725 by my prototype ‘430 Slave, the same ‘430 Master instead sees the following; note I2C data bytes of 0x7F, 0xFF:

 

Tools are CCS v5.5.0.00077 with an MSP-FET430-UIF, and the 2-wire “SBW” connection to the -2274.

 

Slave Code is as follows (have tried several variations), and I must be missing some detail in the transition from Receive mode to Transmit mode:

Initialization, in “init_430” file, is:

with slave's Main being

Note that lines 29 & 33 of this Slave code tries to send data of 0x55 and 0xAA, while ‘scope shows 0x7F, 0xFF.

 

Help/explanations appreciated…

  • My submitted 'scope plots and "clips" of code do not show up - trying to fix that...

    'scope plot reading from TCS34725:

     :

    but reading from Slave '430 shows data of 0x7F 0xFF:

    Slave's initialization code:

    Slave's Main:

  • Hi,

    One thing to check: please try clearing the USCI SW reset before you enable interrupts.

    Additionally, please make sure that you do not need to make use of any USCI interrupts (your code currently doesn't include any). You can use the User's Guide and software examples on the product page for details. Specifically, please see example msp430x22x4_uscib0_i2c_05.c which is an I2C slave example.

    A guide on debugging common serial communication issues can be found here: www.ti.com/lit/an/slaa734/slaa734.pdf

    Regards,
    Nathan
  • Nathan, thx for the reply.
    I'm not presently using interrupts (the "enable interrupts" was leftover from when I had timer A blinking an LED as a "heartbeat") - I've now removed the enable as well... I was avoiding the added complexity of interrupts as the processor has nothing else to do and this is not a minimal-power application.
    I have also added a short delay at the end of the loop to keep UCB0 reset before resuming operation. Neither change affects the results.
    I had reviewed the example projects some time ago but didn't see one that matches my need for the "command" byte that (later) will tell the Slave which bytes from a small array that the Master wants to read. Looking at those examples now (...UCB0_I2C_05.c, _11.c and _13.c), I note they're using UCSTPIFG and UCSTTIFG flags, so I'll work down that path for a while.
    I am using the User Guide, and have reviewed SLAA734.pdf as well as the -274 errata document
    I'll keep at it as time permits (other moles keep popping up) and will repost if successful; in the meantime other input is appreciated.

**Attention** This is a public forum