Program TI Launchpad with Raspberry Pi

Posted on January 19, 2012
Tags:

I de­cided I wanted to play with my new toy: my Rasp­berry Pi. Sadly you need a level con­verter to con­trol re­lays and such with it. That’s where the TI Launchpad comes in handy. It can con­trol re­lays and such eas­ily. The Launchpad works flaw­lessly with the Rasp­berry Pi, you only need to follow a few steps to pro­gram your Ti Launch­pad.

Raspberry Pi and TI Launchpad

First you need to in­stall the tool­chain:

sudo ap­t-get in­stall binu­til­s-m­sp430 gc­c-m­sp430 msp430mcu mspdebug msp430-libc  

Then check if every­thing is work­ing. Plug in you Launchpad in the Rasp­berry Pi and ex­e­cute the fol­lowing com­mand:

sudo mspdebug rf2500  

If there are no er­rors you are OK! Exit mspdebug by typing exit. Now on to create your first pro­gram:
Make a new di­rec­tory and move to it:

mkdir msp430  
cd msp430  

Edit your pro­gram file (you can sub­sti­tute nano for vim if you like):

nano led.c  

Enter the fol­lowing in the file:

#in­clude <m­sp430x16x.h>  
main(void) {  
P1DIR = 0xff;  
P1OUT = 0xff;  
}  

Save the file (c­trl-X in nano).

To com­pile the file you enter the fol­lowing com­mand:

msp430-gcc -mm­cu=m­sp430g2553 -g -o LED led.c  

Now up­load it to your Launchpad and run:

sudo mspdebug rf2500  
prog LED  
run  

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

exit  

To get your LED to blink re­place the con­tent of the led.c file with this

This tu­to­rial is based on the ar­ticle found here

blog comments powered by Disqus