You are on page 1of 7

MSP430 LaunchPad

Energia development
on Linux
The launchpad board
Update: at the beginning of March 0! T" rai#ed the price of LaunchPad
board to !0 $ #hipping included%
The launchpad board is a low-cost (less than 5 shipping included) development
board based on Texas Instruments MSP430 family microcontrollers, it ships in a
nice retail box with two different !"s, an "#$ cable and a tiny %&'() smd crystal
ready to be soldered onto the board (you don*t normally need it for the basic
operations), the software stac+ is a gcc bac+end and a clone of the ,rduino I-. and
libraries/ This stac+ ma+es the switch from ,rduino environment very easy/
The ,rduino-li+e libraries are named .nergia and can be downloaded as
pre-pac+aged binaries from http011energia/nu1download1 or from the 2it(ub
repository0 https011github/com1energia1.nergia
The community is still smaller than the huge ,rduino community but it is growing
fast, you can find a couple of useful lin+s at the end of this article/
#ome 3shields4 compatible with 5aunch6ad are also available on TI store,
particularly interesting the capacitive and audio shields, that add a touch interface
and 6% recording1playbac+ capabilities to the device/ 7or an overview of the
available 5aunch6ads,
see http011www/ti/com1ww1en1launchpad1overview8head/html
&ompari#on 'ith (rduino
The intent of TI when they launched their development board was clearly to follow
and exploit the huge success of ,rduino, this paragraph will attempt to shed some
light on similarities and differences of ,rduino and 5aunch6ad9.nergia/
The 5aunchpad board is shipped with two different !"#s0 MSP430*++3 and
MSP430*4+, they are both &: pin devices but the ;5& has half the flash and
<, of the 55&%/
!omparing #6;%: and ,tmega%&=6 is >ust li+e comparing apples and oranges but
we can try to summari)e tha main differences0
M&U feature#
=bit ? <I#! ?
@Abit ? <I#! ? Bon
6ower supply (typ/) 5B %/%B
7lash %&'$ @A'$
6ICs &= &:
Timers & &
6D pins A %
<, &'$ 5@&$
= () int/ or @A
() ext/
@A () int/ 9 optional low
speed ext/
.evelopment board feature#
on board 5.-s connected to !"
@ &
on board pushbuttons connected
to !" pins
@ (reset) & (reset 9 one spare)
on board debugger 9 emulator no yes
on board programmer no0 bootloader only yes
Dhat we can tell for sure it that (tmega3-P beats MSP430*++3 in 7lash and
<, si)e, but where MSP430 is clearly superior is0
when used in low power modes
!6" speed than+s to @Abit architecture
!" price0 it costs about one third of the ,tmega%&=6
development board price0 E 5 F vs/ E &5 F of an ,rduino "CG
Gn the contrary, ,rduino compatible shields, community and software libraries are
far ahead of #6;%:1.nergia/
"n#talling the #oft'are
7irst you need to install the compiler pac+ages0
1. binutils-msp430 - Binary utilities supporting TI's MSP430 targets
2. gcc-msp430 - !" # compiler $cross compiler %or MSP430&
3. g'b-msp430 - T(e !" 'ebugger %or MSP430
4. msp430-libc - Stan'ar' # library %or TI MSP430 'e)elopment
*. msp430mcu - Spec %iles+ (ea'ers an' lin,er scripts %or TI's MSP430
-. msp'ebug - 'ebugging tool %or MSP430 microcontrollers
If you plan to use the .nergia libraries which provide an ,rduino-li+e environment,
you should download the pac+age from http011energia/nu1download1 and install
them in a subfolder of your home directory, I installed them in a folder named
To hold my s+etches and libraries, I also created a folder named
To summari)e the steps0
. su'o apt-get install binutils-msp430 gcc-msp430 g'b-msp430
msp430-libc msp430mcu msp'ebug
. c'
. m,'ir energia/s,etc(boo,
. 0get -1 energia.tg2 (ttp344energia.nu4'o0nloa'4'o0nloa')3.p(p5
. tar -82)% energia.tg2. m) energia-010170012 energia
to access the serial port, you also need to add some udev rules0
1. su'o )i 4etc4u'e)4rules.'4-0-tilaunc(pa'.rules
2. 9 T(is %ile allo0s access to TI launc(pa'
3. 9 See u'e)$:& %or synta8.
4. 9
and then restart udev by0
1.4etc4init.'4u'e) restart
,n additional step is reHuired if you are on a A;bit architecture0
1. . c' energia4lib
2. . m)
3. . ln -s
,fter doing this, you should be able to launch the .nergia I-. with
1. . c'
2. . energia4energia
.evelopment u#ing a Ma/efile
I*m the +ind of programmer that hates complicated I-.s, moreover I can*t suffer
Iava(T), for this reason I tend to use a+efiles to compile !" code and the first
thing I did was to setup a development environment using a a+efile to do all the
compilation, lin+ing and upload stuff/
This a+efile is freely adapted from the good >ob done by Tim arston at0
Jou can download the latest version of the a+efile from my repository0
1. . c'
2. . c' energia/s,etc(boo,
3. . 0get
The a+efile must be launched from within the directory containing the s+etch you
want to compile, the name of the directory must be the same name of the main
s+etch file which has the ,rduino 3/ino4 file extension/
, couple of environment variables are used to instruct the a+efile where the
libraries are located and to build code for the correct !" (for a complete list of
config vars, please refer to the a+efile itself, they are described in details in the
header), you can set them once for all using /bashrc0
1. . ec(o 'e8port 7!7>I=B1=>B6lpmsp430g2**3' CC D4.bas(rc
2. . ec(o 'e8port 7!7>I=BI>64(ome4your/username4energia' CC D4.bas(rc
3. . . D4.bas(rc
)ello 'orld0
Jou are now ready to test your new 5aunchpad, the 3(ello Dorld4 program for !"s
is the classic $lin+ program, which >ust blin+s one of the two leds available on the
board, you can >ust copy the example provided with the .nergia I-.0
@/ F cd
&/ F cd energia8s+etchboo+
%/ F cp -r //1energia1examples1@/$asics1$lin+ /
;/ F cd $lin+F ma+e -f //1a+efile target
Jou now need to connect the board to your 6! with the provided "#$ cable/
@/ F ma+e -f //1a+efile upload
If everything went fine, you will see a nice blin+ing led at @() on your 5aunchpad
The #erial nightmare
The board has onboard "#$-to-serial logic, but I had a really hard time before I
could use it, and it*s still somewhat unstable/
UP.(TE0 there is now a nice method to fix the serial
problem0 https011github/com1capnm15aunch6ad
T" MSP430 LanunchPad cdc1acm
/ernel module fix
The serial connection to #6;%: 5aunch6ad is really screwed up/
<unning 'mesg shows lines li+e0 tty/port/close/start3 tty-Ccount 6 1 port
count 6 0
7or +ernels v%/: // v%/&9 (e/g/ "buntu 5T# @&/:;)
1. .git clone git344git(ub.com4capnm4Eaunc(Pa'.git
2. .c' Eaunc(Pa'4c'c-acm4%i8-msp430lp-serial
3. ..4install.s(
udev rule#
1. .c' etc-rules-u'e).'
2. ..4install.s(
add 5aunch6ad users to the Kaccess external storage devicesK group
1. .su'o usermo' -a - plug'e) "S7>!=M7
$asically, there are some problems with the acm3cdc driver provided with latest
"buntu +ernels, I could ma+e it wor+ following the instructions on
ore info in this post (and previous pages)0
Jou will need to compile a patched +ernel module named cdcacm (the stoc+ module
is called cdc8acm), and you mileage may vary, after compiling and loading the
patched module I was able to read from serial >ust doing0
1. . cat 4'e)4tty=#M1
#ometimes I still need to unload and reload the module with0
@/ F sudo rmmod cdc8acm
&/ F sudo modprobe cdcacm
,rduino and .nergia differs too much, but I thin+ they are both interesting devices,
given the very low price of #6;%: and the ,rduino-li+e development environment I
feel that I will be using this !"s wherever I can as long as I don*t need much flash
and <,/
7lash, <,, community, libraries and examples are what ma+e ,rduino great, let*s
see if .nergia community will grow fast and if TI will release more powerful !"s
for this interesting development board/
U#eful lin/#
(appy hac+ingO
#ee also my new article about #6;%:0

6osted by ,lessandro 6asotti at @@/5P am ; !omments
&:@%-:%-:@ Q !ategory0 5inux , #6;%: !" , 6rogramma)ione