Jump to content

USCI i2c repeated start question

Recommended Posts

I'm relatively new to the MSP430 and microcontroller world.  I have a MSP430G2553 and am interfacing to a MMA8453Q accelerometer.  I have this working on a MSP430G2231 using USI and now want to move to a MSP430G2553 with USCI.  I took the samples from slaa382 for master and master with repeated start from TI and modified the basic master code to what I thought would provide me a repeated start option.  I'm just trying to read back the "whoami" register but I think something is wrong with my repeated start implementation, could someone advise me on this?  I've got 10k pull ups on the clock and data lines and was able to write to a DAC successfully so I am confident in my hardware setup.


See attached files, basically I added a repeated start flag to the i2c master.c file which gets set when the "TI_USCI_I2C_transmitre" function gets called, then added if statements in the vector section which strips out the stop when the flag is set.


Any help is appreciated,



Copy of main.cTI_USCI_I2C_master.hTI_USCI_I2C_master_edit.c

Link to post
Share on other sites

It looks like your flag_RPSTART gets cleared too soon.


The call to TI_USCI_I2C_transmitre(1, whoamireg) sets byteCtr to 1. When the USCI is ready for the first (and only) byte of the transmission it triggers USCIAB0TX_ISR which sets UCB0TXBUF to the value of whoamireg and decrements byteCtr. Unfortunately it also clears flag_RPSTART. Once the UCB0TXBUF is ready for the next byte the USCIAB0TX_ISR gets triggered again, but this time byteCtr == 0 and flag_RPSTART == 0, so the stop condition is sent.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...