Exploring the TI MSP430 platform with Energia Arduino-compatible IDE

Introduction

Over the last year or so Texas Instruments have been literally pushing their MSP430 development platform hard by offering an inexpensive development kit – their LaunchPad. For around ten dollars (not everyone could get it for $4.30) it includes a development board with flash emulation tool and USB interface, two of their microcontrollers, crystal, USB cable and some headers. It was (is?) a bargain and tens of thousands of LaunchPads were sold. Happy days.


However after the courier arrived and the parcel was opened, getting started with the LaunchPad was an issue for some people. Not everyone has been exposed to complex IDEs or university-level subjects on this topic. And to get started you needed to use a version of Code Composer Studio or IAR Embedded Workbench IDEs, which scared a few people off. So those LaunchPads went in the cupboard and gathered dust.

Well now it’s time to pull them out, as there’s a new way to program the MSP430 using a fork of the Arduino IDE – Energia. Put simply, it’s the Arduino IDE modified to compile and upload code to the LaunchPad, which makes this platform suddenly much more approachable.

Getting Started

You’ll need to download and install the appropriate USB drivers, then the IDE itself from here. To install the IDE you just download and extract it to your preferred location, in the same manner as the Arduino IDE. Then plug your LaunchPad into the USB. Finally,  load the IDE. Everything is familiar to the Arduino user, except the only surprise is the colour (red as a nod to TI perhaps…):

ide

Looking good so far. All the menu options are familiar, the files have the .ino extension, and the preferences dialogue box is how we expect it. Don’t forget to select the correct port using the Tools > Serial port… menu. You will also need to select the type of MSP430 in your LaunchPad. At the time of writing there is support for three types listed below (and the first two are included with the LaunchPad v1.5):

  • MSP430G2553 - <=16 MHz, 16KB flash, 512b SRAM, 24 GPIO, two 16-bit timers, UART, SPI, I2C, 8 ADC channels at 10-bit, etc. Cost around Au$3.80 each**
  • MSP430G2452 - <=16 MHz, 8KB flash, 256b SRAM, 16 GPIO, one 16-bit timer, UART, I2C, 8 ADC channels, etc. Cost around Au$2.48 each**
  • MSP430G2231 - <=16 MHz, 2KB flash, 128b SRAM, 10 GPIO, one 16-bit timer, SPI, I2C, 8 ADC channels, etc. Cost around Au$3.36 each**

** One-off ex-GST pricing from element14 Australia. In some markets it would be cheaper to buy another LaunchPad. TI must really be keen to get these in use.

There are some hardware<>sketch differences you need to be aware of. For example, how to refer to the I/O pins in Energia? A map has been provided for each MSP430 at the Energia wiki, for example the G2553:

g2553pinouts

As you can imagine, MSP430s are different to an AVR, so a lot of hardware-specific code doesn’t port over from the world of Arduino. One of the first things to remember is that MSP430s are 3.3V devices. Code may or may not be interchangeable, so a little research will be needed to match up the I/O pins and rewrite the sketch accordingly. You can refer to pins using the hardware designator on the LaunchPad (e.g. P1_6) or the physical pin number. For example – consider the following sketch:

You could have used 2 (for physical pin 2) instead of P1_0 and 14 (physical pin … 14!) instead of P1_6. It’s up to you. Another quick example is this one – when the button is pressed, the LEDs blink a few times:

Due to the wiring of the LaunchPad, when you press the button, P1_3 is pulled LOW. For the non-believers, here it is in action:

So where to from here? There are many examples in the Energia IDE example menu, including some examples for the Energia libraries. At the time of writing there is: Servo, LiquidCrystal, IRremote, SPI, wire, MSPflash and Stepper. And as the Energia project moves forward more may become available. For help and discussion, head over to the 4-3-Oh forum and of course the Energia website. And of course there’s the TI MSP430 website.

Conclusion

Well that was interesting to say the least. If you have a project which needs to be low-cost, fits within the specifications of the MSP430, has a library, you’re not hung up on brand preference, and you just want to get it done – this is a viable option. Hopefully after time some of you will want to work at a deeper level, and explore the full IDEs and MSP430 hardware available from TI. But for the price, don’t take my word for it – try it yourself. 

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The following two tabs change content below.

John Boxall

Founder, owner and managing editor of tronixstuff.com.

17 Responses to “Exploring the TI MSP430 platform with Energia Arduino-compatible IDE”

  1. Coaxen says:

    Wow! Thanks for the post! I had no idea someone created a better IDE for the launchpad. Up until now the only way of programming I could stand was the online msp430 compiler and their tiny downloader application. This is great news, now the code can be made even more prototype-friendly.

  2. Golan Gabay says:

    Hey there!
    Does shiftOut function also works?

  3. Golan Gabay says:

    Sorry, but still didn’t find the time to sit on this but something is on my mind…
    Does anybody know if interrupts are working on all the pins that originally supposed to support interrupts on the Launchpad?

    • Ac says:

      Small audience for that question here.. Try the 43oh forum, but feel free to update your question here with a link to the answer. :)

    • DigiGram says:

      The guys on 43oh says so. I know it’s a late reply, but incase you haven’t gotten around to it yet

  4. Alphonsos Pangas says:

    The USD 4.30 (including postage) offer is still good from the TI site (https://estore.ti.com/MSP-EXP430G2-MSP430-LaunchPad-Value-Line-Development-kit-P2031.aspx). They also have a promotional offer for Arm cortex M4F-based launchpads for USD 4.99 (https://estore.ti.com/Stellaris-LaunchPad.aspx) which is even more interesting (80 MHz Arm Cortex M4F, 256KB Flash, 32 KB Ram etc). Unfortunately, it seems that this is a limited time offer, and you can order a maximum of 2 pieces, where with the MSP 430 Launchpad you can order up to 300.

    • John Boxall says:

      Indeed. We’ve ordered some Stellaris LaunchPads as well and will examine them in due course.

      • Michael Bataragoa says:

        Nice review, just ordering my own MSP430 Launchpad to TI’s estore after read this review (unbelievable, $4.3 incl shipping to indonesia) and was arrive yesterday and i obviously starting to upload hello world blink code using Energia. Wating for your stellaris or c2000 review, cheers

      • John Boxall says:

        I’ve got the Stellaris Launchpad but it isn’t a priority right now.

  5. varun says:

    can i have the code for black line follower using energia for msp?

  6. fatality says:

    do u have any tutorials related to msp420f5529 and cc3000 regarding wifi?

Trackbacks/Pingbacks


Leave a Reply

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: