Jump to content
Signaller

MSP430G2 no communication

Recommended Posts

Hello,

I'm trying to migrate my old project for MSP430G2452 from Energia 0101E0009 to the last version 1.8.7E21.

However I got a lot issues.

1. Controller starts to slow - as I understood the issue is in the enableXtal() function which tries to find clock crystal, which I don't use. I just commented it out in init_clock() directly in core and it helped.

2. Actuall frequency of MCU was incorrect (It is much slower) - found answer on forum here https://forum.43oh.com/topic/13473-blink-example-too-slow/. And now it works as expected.

3. Now I'm trying to use Serial. But it seems that it has some issue too. I'm using basic scetch from example - ASCIITable and connected my oscilloscope directly to UART ( P1.1, P1.2). But unfortunatelly there is no any movement on pins.  I added some basic digitalwrite command to scetch and see that program is executed, but no UART output. Of cause the same code compilled in old version of Energia works fine. What I can try else?

4. Also I use separate PCB for my project, therefore I need i2c on pins 14,15 as it was in old revisions ( default i2c was moved in to pin 9,10 as I see). But I couldn't make it work too.
I tried an advice from this comment https://github.com/energia/Energia/issues/486#issuecomment-200729667, but still see nothing on my oscilloscope.
I tried to download simple scetch like master-reader from examples, controller works but there are no data on SCL or SDA.
I belive there is some problem with configuration but without working serial, it is hard to debug i2c.

Sorry, if it is already solved in some topic, but after a day of googling and experimenting I gave up.

 

Share this post


Link to post
Share on other sites

You've described the problem, but supplied no information to allow remote diagnosis.  Without a schematic and related code, there's really no way to help, aside from the most general suggestions regarding jumpers, pins and I2C pullup resistors, all of which you've likely read (and hopefully applied).  Finally, you mention migrating an existing project; did you have that working, and if so, under what version of Energia? 

Re: UART - there may be no hardware UART on your chip.

"If your Launchpad is version 1.4 or earlier, the chips that it shipped with have no hardware UART and thus, no hardware configuration is necessary, but you must use the SoftwareSerial library included in Energia to communicate over the serial port."

You indicate you have an MSP430G2452, according to SLAU318G, there is only USI availble on that chip, the UART is on the G2553's USCI impementation.

Share this post


Link to post
Share on other sites

Thank you for answers. Sorry, if I missed some information. 

I use launchpad version 1.5. 

I didn't provide schematic because nothing is used except launchpad board and mcu in it. Also as I mentioned in start post I use oscilloscope, so we can exclude issues with drivers on pc, jumpers or schematic. And MCU clocking works as expected. 

As for now, if I compile ASCIITable which is default example in the IDE (I can provide code here, if necessary) in old energia 0101E0009 I see transmission on UART pin.

If I compile the same code in the newest version of IDE 1.8.7, there is no changes on pin at all. 

If I didn't miss something important, I  think that problem somewhere in the changes of code of the core. But I totally unfamiliar with msp430 registers' settings. So, I at least need an advice where to start. 

 

Share this post


Link to post
Share on other sites

To solve the UART issue go to the pins_energia.h file for the selected device MSP-EXP430G2452LP

and try to update / modify this lines:

static const uint8_t DEBUG_UARTRXD = 4;  /* Receive  Data (RXD) at P1.2 */
static const uint8_t DEBUG_UARTTXD = 3;  /* Transmit Data (TXD) at P1.1 */

This seems to be wrong in the current version but i have no idea why this worked before as i could not find an update where this has been changed.

 

 

To solve the issue with I2C you need to select the other I2C interface with

setModule(0);

The default mapping of the I2C interface to the pins 8 and 9 change a while ago but with the setModule you still can select the other I2C interface if available.

 

Share this post


Link to post
Share on other sites
7 hours ago, StefanSch said:

static const uint8_t DEBUG_UARTRXD = 4;  /* Receive  Data (RXD) at P1.2 */
static const uint8_t DEBUG_UARTTXD = 3;  /* Transmit Data (TXD) at P1.1 */

This seems to be wrong in the current version but i have no idea why this worked before as i could not find an update where this has been changed.

It didn't, it has been broken for years and years. It stopped working when 1.6 was released.

Share this post


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

and try to update / modify this lines:

static const uint8_t DEBUG_UARTRXD = 4;  /* Receive  Data (RXD) at P1.2 */
static const uint8_t DEBUG_UARTTXD = 3;  /* Transmit Data (TXD) at P1.1 */

To solve the issue with I2C you need to select the other I2C interface with

setModule(0);

The default mapping of the I2C interface to the pins 8 and 9 change a while ago but with the setModule you still can select the other I2C interface if available.

 

Thank you very much StefanSch I got UART working after this change. However setModule(0) didn't help. I still see no signal changes on I2C pin 14,15. I played around with it a little bit, but have found no solution. (BTW I2C on pins 9/10 works, but just because it uses twi_sw.c lib.)

At this point I remembered that another project for which I used second MCU from this kit can be G2553.(I thought that launchpad had two same microcontrolles). I disassembled that project and after few changes of code released that I can swap microcontrollers. So, now I have MSP430G2553 which I believe is more suitable for first project, because it has hardware UART.

And setModule(0) works as expected for G2553. 

So, as a conlusion I can say i2c on pins 14, 15 doesn't work  for MSP430G2452.  I hope it will be resolved in future.

 

 

Share this post


Link to post
Share on other sites
12 hours ago, StefanSch said:

To solve the UART issue go to the pins_energia.h file for the selected device MSP-EXP430G2452LP

and try to update / modify this lines:

static const uint8_t DEBUG_UARTRXD = 4;  /* Receive  Data (RXD) at P1.2 */
static const uint8_t DEBUG_UARTTXD = 3;  /* Transmit Data (TXD) at P1.1 */

This seems to be wrong in the current version but i have no idea why this worked before as i could not find an update where this has been changed.

This is the change in Oct of 2015 that broke it:

https://github.com/energia/Energia/commit/3a79177338cab6e9724144038947db820a70e4b1#diff-ef6c05942e53197e6f1507545468bf55

Share this post


Link to post
Share on other sites

Hi,

I2C should now also be solved. The fix is pushed the github.

But the master there has a lot of fixes and cleanup so that it is not easy to take the file in put it into the current release as fix.

The here attached version should do that but could not test it on the current release version so far. If you like to give it a try i would be happy on any feedback.

twi.c

Share this post


Link to post
Share on other sites

StefanSch, thank you.

If it is necessary just to replace existing file with attached above, I will test. I will inform you once I get any results. 

Share this post


Link to post
Share on other sites

Hi,

I've briefly checked code changes in twi.c and was sure that it would work.

So, no wonder that I obtained signal on SCL:

SDS00002.BMP

But I need to say, that I didn't use any real slave sensor (because I didn't want disassamle that device where I put G2553) just used another arduino as a slave sender. It was possible to obtain data from slave, so I think everything is ok.

StefanSch, thank you very much again.

Fun fact I started with MSP430 3-4 years ago and wasn't able to run TWI. Found patch here on forum. And now I came back with same issue, and once again got an answer.

Thank you all again.

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

×