brelliott18

I2C - MSP430 to MSP430 problems

17 posts in this topic

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

Share this post


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

brelliott18 and hemangjoshi37a like this

Share this post


Link to post
Share on other sites

If you see noise than that could be ringing caused by fast rise times of the digital I/O. You can try to add a ~50 Ohm resistor in series the SDA and SDL lines, place the resistor close to the transmitter.

Share this post


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.

Share this post


Link to post
Share on other sites

How long are the wires over which you want to do I2C?

Are the grounds connected?

Weaker (i.e. higher value) pull-ups will make noise issues worse.

energia likes this

Share this post


Link to post
Share on other sites

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 ?

 

 

 

 

 

 

 

 

 

 

Share this post


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.

Share this post


Link to post
Share on other sites

In the post I've linked above the solution was to replace the twi.c & twi_sw.c with new ones, found in the e2e forum. Have you also replaced them?

hemangjoshi37a likes this

Share this post


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

Share this post


Link to post
Share on other sites

Hi,

Last year I add a lot of troubles with i2c in Energia. I solved them but I don't know if Energia team included my corrections : 

 

Share this post


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 ;

Share this post


Link to post
Share on other sites

SUCCESS !

using Mods as above plus twi.c and twi.sw.c  from this link :-

http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/529036/1924562#1924562

plus adding :-

 

Wire.setModule (0)  before Wire.begin() in Void Setup() in both Master and Slave :-

I have managed to send two characters from the Master to turn off the Red Led in a loop on the Slave.

 BIG Thanks again to B@TTO.

Wouldn't it be perhaps a good idea if these files were updated and placed in the Energia GitHub Repository ?  How is this process carried out ?

 

 

 

 

 

 

bluehash and B@tto like this

Share this post


Link to post
Share on other sites
8 hours ago, brelliott18 said:

Wouldn't it be perhaps a good idea if these files were updated and placed in the Energia GitHub Repository ?  How is this process carried out ?

 

The "normal" process is to make a push on Energia's github, what I did not do (I was having hard times when this troubles came to me, and I'm not a good user of github at all, so I clearly didn't have the time to push this mods).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now