brelliott18 2 Posted February 15, 2017 Share Posted February 15, 2017 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 Quote Link to post Share on other sites
brelliott18 2 Posted February 15, 2017 Author Share Posted February 15, 2017 PS I have removed GREEN LED P1.6 link ! Quote Link to post Share on other sites
LiviuM 43 Posted February 15, 2017 Share Posted February 15, 2017 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 hemangjoshi37a and brelliott18 2 Quote Link to post Share on other sites
LIJsselstein 9 Posted February 15, 2017 Share Posted February 15, 2017 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. Quote Link to post Share on other sites
brelliott18 2 Posted February 15, 2017 Author Share Posted February 15, 2017 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. Quote Link to post Share on other sites
chicken 630 Posted February 15, 2017 Share Posted February 15, 2017 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 1 Quote Link to post Share on other sites
energia 485 Posted February 15, 2017 Share Posted February 15, 2017 As @@chicken mentioned make sure you have a ground connection between the 2 LaunchPads. Could you also post the 2 Sketch so that we can have a look at that as well? hemangjoshi37a 1 Quote Link to post Share on other sites
brelliott18 2 Posted March 19, 2017 Author Share Posted March 19, 2017 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 ? Quote Link to post Share on other sites
Rei Vilo 695 Posted March 19, 2017 Share Posted March 19, 2017 @brelliott18 Have you gone through the reference at http://energia.nu/reference/wire/? Quote Link to post Share on other sites
brelliott18 2 Posted March 19, 2017 Author Share Posted March 19, 2017 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. Quote Link to post Share on other sites
LiviuM 43 Posted March 20, 2017 Share Posted March 20, 2017 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 1 Quote Link to post Share on other sites
brelliott18 2 Posted March 20, 2017 Author Share Posted March 20, 2017 Not yet - will give it a try - THANKS !!! Quote Link to post Share on other sites
brelliott18 2 Posted March 20, 2017 Author Share Posted March 20, 2017 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 Quote Link to post Share on other sites
B@tto 51 Posted March 21, 2017 Share Posted March 21, 2017 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 : Quote Link to post Share on other sites
brelliott18 2 Posted March 23, 2017 Author Share Posted March 23, 2017 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 ; Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.