Program TI Launchpad with Raspberry Pi

Posted on January 19, 2012

I decided I wanted to play with my new toy: my Raspberry Pi. Sadly you need a level converter to control relays and such with it. That’s where the TI Launchpad comes in handy. It can control relays and such easily. The Launchpad works flawlessly with the Raspberry Pi, you only need to follow a few steps to program your Ti Launchpad.

Raspberry Pi and TI Launchpad

First you need to install the toolchain:

sudo apt-get install binutils-msp430 gcc-msp430 msp430mcu mspdebug msp430-libc  

Then check if everything is working. Plug in you Launchpad in the Raspberry Pi and execute the following command:

sudo mspdebug rf2500  

If there are no errors you are OK! Exit mspdebug by typing exit. Now on to create your first program:
Make a new directory and move to it:

mkdir msp430  
cd msp430  

Edit your program file (you can substitute nano for vim if you like):

nano led.c  

Enter the following in the file:

#include <msp430x16x.h>  
main(void) {  
P1DIR = 0xff;  
P1OUT = 0xff;  

Save the file (ctrl-X in nano).

To compile the file you enter the following command:

msp430-gcc -mmcu=msp430g2553 -g -o LED led.c  

Now upload it to your Launchpad and run:

sudo mspdebug rf2500  
prog LED  

You should now see that the LEDs on your Launchpad are lit.
To exit the program type:


To get your LED to blink replace the content of the led.c file with this

This tutorial is based on the article found here

blog comments powered by Disqus