Jump to content
43oh

I2C - MSP430 to MSP430 problems


Recommended Posts

Trying to use I2C to connect 2 X MSP430.

 

Using Wire.write ('H') and 'L ' char to send to Slave via 4K7 pull-ups to turn on / off slave led.

 

 Using Wire.onReceive(receiveEvent) , void receiveEvent ( int howMany )   etc.

 

Have added delays at various places.

 

Have programmed then removed PC connections, use separate PSU

 

ReceiveEvent appears not to work.

 

Have old analogue scope - clock /data signals appear to be ' very dirty ' and ' noisy '

 

Change to 10K pull ups ?  Any suggestions ?  Thanks

Link to post
Share on other sites

Hi @@brelliott18,

 

There are some known problems with i2c on 2553 Launchpads, mentioned in various posts over this forum.

One of them is mentioned in http://forum.43oh.com/topic/2641-i2c-lcd/page-2#entry75927; in this post is also a link to a solution http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/529036/1924562#1924562

 

Have you already seen this posts? Have you tried the solutions presented in them?

 

Regards,

Liviu

Link to post
Share on other sites

Hi @@brelliott18,

 

There are some known problems with i2c on 2553 Launchpads, mentioned in various posts over this forum.

One of them is mentioned in http://forum.43oh.com/topic/2641-i2c-lcd/page-2#entry75927; in this post is also a link to a solution http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/529036/1924562#1924562

 

Have you already seen this posts? Have you tried the solutions presented in them?

 

Regards,

Liviu

 

Thanks for the advice. Have inserted ' Wire.setModule(0) as suggested - This just seems to prevent begin and end transmission loops working altogether. One problem seems to be waveforms coming from SDA / SCL - either not present or very noisy.

Link to post
Share on other sites
  • 1 month later...

Latest : Have used exactly the same code with ARDUINOs  UNO and NANO instead of 2 X  MSP430 2553  [ used Version 17 of Energia for MSP devices  ].......

..............The code WORKS on these ARDUINO  devices !!!

  [  I simply send 'H' and ' L' chars to turn LED on / off using Wire.begin then Wire.beginTransmission then Wire.endTransmission plus delays for MASTER .

For SLAVE ( another MSP430 2553 ) I use  Wire.onReceive( receiveEvent) then VOID receiveEvent ( int howMany) then ' while Wire.available  and Wire.Read '  etc. ]

Use 4K7 pull ups on p1.7 , P1.6 plus   Common Ground.

I assume, perhaps, that  the Registers are not being Set up properly ? - Have also noticed that there are NO examples on YouTube as opposed to the ARDUINO.

Has anyone ever managed to connect 2 MSP430 via I2C , I wonder ?

 

 

 

 

 

 

 

 

 

 

Link to post
Share on other sites

Thanks for the reply

Yes, I have. The point is that identical code on the Arduinos works but not on MSP430s

 

So either the delays need changing ?  - I'm using 3 seconds on the MASTER between begin and end transmissions and about 0.5 second on the SLAVE - I have changed these but it doesn't seem to a make any difference.

 OR  :  Perhaps  the Registers are  not being set up correctly but that's a pure guess.

 

PS I can't the C language - I'd like to do everything in Forth in possible.

Link to post
Share on other sites

Replaced files  - Makes no difference.

Ran your program to return addresses of serial devices - after removing ' Wire.setModule(0) ' line which crashes it.

The program returned a continuous stream of addresses from 0 to 127 -  Is this a sign that the MSP430 itself cannot act as slave because it doesn't recognise any addresses ( not even ' 0 ' ) , perhaps   ?

 

Regards

Link to post
Share on other sites

It appears the latest twi.c file from GITHUB  does NOT appear to  incorporate B@TTO modifications:- 

 

This is my understanding of the mods required noted by  //********************

 

Is this correct ? 

 

[ If so , it would seem a good idea for ENERGIA to update this file, surely ?? - How does one get this to happen ? ]

 

[ The other code needed is  to insert Wire.setModule(0)  before Wire.begin ,   so I'm told ]

 

 

****************LATEST  TWI.C   [  FROM LINE 839 ] ****************************

 

/* Slave transmit mode (twi_state = TWI_STX) */

 }

else {                  // ***** REPLACE WITH  else if  ( twi_state == TWI_STX ) {

 // copy data to output register

 UCBxTXBUF = twi_txBuffer[twi_txBufferIndex++];

 // if there is more to send, ack, otherwise nack

if(twi_txBufferIndex < twi_txBufferLength){

 } else {

UCBxCTL1 |= UCTXNACK; // Generate NACK condition }

 

}

// ************************PLUS ****************

} else {

 

if (twi_sendStop) {

 

/* All done. Generate STOP condition and IDLE */

 

UCBxCTL1 |= UCTXSTP;

// *********************  ADD UCxIFG &=  ~ UCB0TXIFG ;

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