Use Arduino Code on a TI Launchpad MSP430

45,735

57

19

Posted

Introduction: Use Arduino Code on a TI Launchpad MSP430

You can now use Arduino sketches to program your TI Launchpad MSP430.

The video show me programming an Arduino Mega 2560 and a TI Launchpad MSP430 with the same Arduino sketch.


The TI Launchpad MSP430 is a microprocessor development board from Texas Instruments.  It's very similar to the Atmel chips in the Arduino.  The MSP430 2553, which is the processor that ships with the Launchpad, has 14 I/O pins and 16K of program memory. Compare this to 20 I/O pins and 32K of program memory of the Atmel 328, the chip in the Arduino Uno, Nano, and several others.

The TI Launchpad MSP 430 only costs $4.30 from TI.  This includes two MSP430 chips, a USB cable, and a cool sticker.  The reason the TI Launchpad has not been more popular is they are very hard to program, especially if you are coming over from the Arduino.  You have to use a complex software package called Code Composer Studio and either program the MSP430 in Assembly code, or you can use C code that just as cryptic looking as the assembly code.  I've tried a few times, and always went back to ease of the Arduino.

Now you can use Energia to upload Arduino sketches to you TI MSP430 chips.  A lot of the more popular libraries like LCD Serial and Servo have already been ported over, and people are porting more code over all the time.

So the tip is:  use a low cost TI Launchpad in your next project instead of an Arduino, if the I/O requirements permit.  For simple applications, the TI chips may make more sense.  You can buy more chips from Mouser.com - the processors run anywhere from .50 cents to 2 dollars, and you don't have to have a bootloader like you do with the Atmels.  It's very easy to either program your chips in the Launchpad, then move it to your circuit, or you can use the Launchpad as an In System Programmer very easily.

At $4.30, you can just use the development boards in your projects if you want.  Compare that to the 20-30 dollar cost of Arduino boards...

Links:

Energia at Github

Energia forum at 43oh.com

TI MSP430 Launchpad at Texas Instruments

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • First Time Author Contest 2018

    First Time Author Contest 2018
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

19 Comments

Hi,

I was wonderingr if I could load a code using arduino (leonardo) board to a msp430 chip. The reason is that I don't have the board now and have the chip and I also have a Leonardo with me. So will it be possible?

I guess it depends on the code; I'm running some code as-is with no modifications - simply copy and paste into Energia and it compiles just fine. Other code needs minor modifications on the pin names but other than that the syntax seems identical between Arduino IDE and Energia IDE

Many sketches compile with no errors but simply do not work on the TI board. By that I mean the code doesn't do what it is supposed to do. What does work is the most simplest sketch such as hello world. So the behind the scene compiler is very different. Libraries, of course are least likely to work so if your Arduino sketch uses a non-stock library then the whole idea of cross compiling code on to the TI just isn't true...

Make sure the pins match the board your using, the arduino examples are setup with arduino normal pins, you may need to change them to 1.2 or etc depending on what pin you are using

Thanks skylerh4, I do account for the pin changes, my issue appears to be compiler bugs or the micro simply runs out of memory, all sketches that do NOT work properly on MSP430 DO WORK correctly on the more powerful Stellaris hence my suspicion that it's likely an issue of resources rather than compiler bugs.

interesting if you find out what the problem is please tell me, i would like to know

Hi after posting at various forums including Energia's boards there isn't concrete evidence to this day of why this happens; there's a probable cause which has to do with MSP430 smaller SRAM but that has to be coupled with bug in the Energia's compiler so that the issue isn't reported at compile or link time but only occurs during runtime. Many sketches do run just fine on all 3 boards yet few don't (3 boards being the original Duemilanove; Stellaris and MSP430)

I'd like to port Arduino's Print class to an IAR MSP430 compiler..

However, I'm getting errors:

'class Print' has virtual functions but non-virtual destructor : class Print

error: expected ',' or '...' before '&' token : size_t print(const String &);

ISO C++ forbids declaration of 'String' with no type : size_t print(const String &);

Perhaps related to the above Print errors, the BufferFiller class (which inherits from Print) also has an error:

'class BufferFiller' has virtual functions but non-virtual destructor

So if Print calls 'write' how do I resolve this for the MSP430? Or what would would be the bare minimum functions in the Print Class that are needed to compile?

So if i were to upload my code form arduino onto the launchpad, how would the pins correspond to those on the arduino?

You need to check the energia website for the ti pin out. pin mapping is on the right of the page
http://energia.nu