Jump to content
curtis63

To I2C or not to I2C, that is the question...

Recommended Posts

So, I've read the threads and have made things work once, but now, without seeming to have changed anything, I'm getting code that goes into never-never land..

 

In twi.c, around line 607 in Energia version 17, I get a lockup in the first while statement:

 

 

 

#if defined(__MSP430_HAS_USCI__) || defined(__MSP430_HAS_USCI_B0__) || defined(__MSP430_HAS_USCI_B1__)
/* Ensure stop/start condition got sent before we exit. */
if(sendStop)
{
while (UCBxCTL1 & UCTXSTP); // end with stop condition
} else {
while (UCBxCTL1 & UCTXSTT); // end with (re)start condition
}
#endif
 
 
I've been trying different recommended suggestions all over the place and had it working about 60 minutes ago, but then I tried and moved some code around and now I can't get it to work anymore...  I put all the code back the way it was, and NADA...  still not working...
 
Is it just a time of day thing or am I the only one who can't seem to have any consistency in the I2C behavior...?
 
By the way, I'm using an MSP430G2553 chip with 32 pins in the QFN configuration.  I really did have this working an hour ago and cannot for the life of me figure out why it stopped working.
 
Any hints would be GREAT..  By the way, the reason I'm not using Energia Version 18 is because it isn't supported in Code Composer Studio yet..  Anybody know when that support will appear?
 
Thanks for any help you might have to offer,
Curtis
 
 
Please see my Pins_energia.h file below:
 
/*  ************************************************************************  * pins_energia.h  *  * Energia core files for MSP430  * Copyright 

Share this post


Link to post
Share on other sites

Hello Curtis,

in my opinion, your pins file has a problem with the (hardware) i2c pins. In my opinion, the TWISDA should be == with TWISDA0 and TWISCL should be == with TWISCL0. In your file there are defined as:

static const uint8_t TWISDA  = 22;  /* P1.7 */
static const uint8_t TWISCL  = 21;  /* P1.6 */
static const uint8_t TWISDA0  = 23;  /* P1.7 */
static const uint8_t TWISCL0  = 22;  /* P1.6 */

I think they should be

static const uint8_t TWISDA  = 22;  /* P1.7 */
static const uint8_t TWISCL  = 21;  /* P1.6 */
static const uint8_t TWISDA0  = 22;  /* P1.7 */
static const uint8_t TWISCL0  = 21;  /* P1.6 */

Attached is the pins_energia.h file with the above correction and with some minor "visual" changes - made the correct footprint for the 32 pins chip, aligned the comments...

pins_energia.h

Share this post


Link to post
Share on other sites

It is times like this when I want to just bang my head against the wall about 3000 times...

 

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

THANK YOU THANK YOU THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!

 

That solved my problem.  I thought that I had corrected all those places, but I apparently missed one.  

 

Thanks so much.  It's 7:13am and I've been up all night trying everything I could think of.  Life is groovy now !!!

Share this post


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.

Guest
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...