TI LaunchPad on Windows
... or "Launchpad development - the hard way".

The LaunchPad, still in the box
The MSP430 LaunchPad is a small, low-cost development board for MSP430 microcontrollers. The board itself
is both a programmer and a breakout board for the microcontroller. It comes with two small microcontrollers,
a crystal, an USB cable, a manual and two stickers.
This tutorial describes how to install and configure mspgcc, msp430-gdbproxy and Eclipse to program and debug
MSP430 microcontrollers on Windows. The tutorial contains pictures, but do not only look at the pictures,
you also need to read the text. It's not a comic book ;-).
The LaunchPad comes with two microcontrollers: the MSP430G2231 and the MSP430G2211. They are almost the same; 2kB flash,
128 bytes RAM, a timer, 1.8-3.6V and a clockspeed up to 16MHz. The differences are that the '2211 only has a
comparator while the '2231 has a real analog/digital converter. Also the '2231 has a Universal Serial Interface (USI), which the '2211 does not have. The USI can
do hardware I
2C and SPI communication (no real UART unfortunately).
Since December 2011 there is a new version of the Launchpad, revision 1.5. The price is the same but the microcontrollers
that come with the launchpad have been replaced with two much better ones: the MSP430G2452 and the MSP430G2553. Important improvements are:
- Much more flash memory for your program: the '2452 has 8kB, the '2553 16kB.
- More RAM: instead of 128 bytes you get 256B in the '2452 and 512B in the '2553
- 6 More I/O pins
- Capacitive touch I/O (read more, how does it work?)
- An extra timer on the '2553
- A real UART on the '2553
What I like less is that the pinheaders are now pre-soldered so you can't choose which side of the board you want them on nor whether
you want the male or female one on the board. It's not impossible to remove them, but it is not easy either.
See also
this news article on 43oh.com
Last update: june 2012. The article was updated to include information about revision 1.5 of the LaunchPad, a more extensive comparison with the Arduino was added and some download locations were updated.
Contents
It looks like an Arduino!

The LaunchPad, box contents
Yes, maybe a little; the form-factor is the same, but it contains an MSP430 from Texas Instruments instead of
a ATmega from Atmel. So far: different manufacturer but more or less the same, right? No. Well, I used to say so
about the 1.4 revision of the Launchpad. But the MSP430G2553 that comes with the revision 1.5 Launchpad comes quite close.
When comparing the MSP430G2231 from revision 1.4 with a LaunchPad the Arduino is more powerful and more extensive:
- less peripherals, for example no UART, only one timer
- less i/o-pins
- only 2kB flash (it's more like an ATtiny2313)
- no easy software library
But when we look at the MSP430G2553 the Arduino and Launchpad are much closer:
| | MSP430G2553 | Arduino Uno with ATmega328P |
| Flash | 16kB | 32kB |
| RAM | 1kB | 2kB |
| EEPROM * | 512B | 1kB |
| I/O | 16 | 20 |
| Analog inputs | 8 channels, 10-bits resolution | 6 channels, 10-bits resolution(8 channels for the SMD version) |
| Timers | 2x16bit each with 3 capture/compare registers | 2x8bit with 2 compare units & 1x16bit with 2 compare and 1 capture unit |
| Architecture | 16-bit | 8-bit |
| Other features | Lower and better tuneable power consumption | Larger voltage range (1.8-5.5V instead of 1.8-3.6V) |
| | Cheaper | Larger userbase |
| | Von Neumann architecture (all kinds of memory are in the same addressrange) |
Modified Harvard architecture (RAM and Flashare strictly separate, special instructions are requiered to read or write the flash memory) |
| | Unbrickable** | Easy-to-use software library |
| | On-chip-debugging without extra tools*** |
The software works out of the box and is the same on Windows, Linux and MacOS |
| | The LaunchPad can be used to program and debug larger MSP430 chips as long as they support Spy-bi-wire. |
The Arduino can be used to program other AVR's using ArduinoISP and can even be used to program other
brands of microcontrollers like the PIC18F. |
* About the EEPROM: in the MSP430 this is called "information memory" but serves the same function. In both controllers it is possible to also use the program memory area as EEPROM, albeit a little less convenient because the pagesizes are larger.
** With 'unbrickable' I mean that you can not break the chip by programming wrong fuses or something like that. All configuration is done in software; when you make a
mistake: change the code and program again.
*** The ATmega's support on-chip-debugging but that requires an AVR Dragon.
They are quite close. The ATmega328P has more memory; in that the MSP430G2553 is more like the older Arduino with the ATmega168. The feature set is
more or less the same; for example, the timers: 2x16 bit versus 2x8 bit and one 16 bit timer: they both give you 8 PWM channels; in case of the
MSP430G2553 you have more precise timers, in case of the ATmega328P you have three separate timers; it just depends on your application which one is more useful.
The Arduino is more geared towards beginners and new users (which does not mean that more experienced users should not use them) and the MSP430 can be tuned to much
lower power consumption, which is nice for battery powered applications.
My advice: if you're a beginner and have little or no experience with microcontrollers: get an Arduino. If you have some experience and want to try something different
you could try a Launchpad.
I have a MSP-FET430UIF/eZ430-RF2500/eZ430-F2013/eZ430-Chronos/eZ430-<something>
Don't worry, you can also use this tutorial for these tools, the microcontroller is different, but the
programmers act mostly the same. I have used the MSP-FET430UIF, the eZ430-RF2500 and the LaunchPad. If there
are differences I will tell you.
Open source tools? Why? TI has free tools!
Yes, but Code Composer Studio limits you to 16kB and IAR to 4kB. That's not a problem with these small microcontrollers
but when you move on you will have to pay. That's 'free' like in 'free beer', but only for the first glass.
For me the most important reason is that I like the spirit of freedom that Open Source software breathes,
no crippling, no artificial limits.
So why Windows?
I like Linux and use it a lot, but there is already a nice tutorial on using the LaunchPad on Linux, see
http://hackaday.com/2010/08/11/how-to-launchpad-programming-with-linux/.
Many use Windows and may have reasons to stay with it so there should be a tutorial for them too.
Let's get started...
Go to
http://www.eclipse.org/downloads and download the
Eclipse IDE for C/C++ Developers. You may need to download a Java runtime environment as well. The version used in this
tutorial is the current version at the moment of writing: Helios SR1.

Go to
http://sourceforge.net/projects/mspgcc/files/Windows/mingw32/ and
download the most recent version (don't believe the next screendump; it's not 2010 anymore :-) ):

Now we need msp430-gdbproxy: go to
http://sourceforge.net/projects/mspgcc/files/Outdated/msp430-gdbproxy/2006-11-14/ and download
msp430-gdbproxy.exe:

Note: at the moment of writing this tutorial msp430-gdbproxy was state of the art technology,
nowadays
MSPdebug is the way to go.
Follow the instructions on the mspdebug website on how to compile mspdebug. You can also use mspdebug with the Texas Instruments DLL if you have a MSP-FET430UIF.
You now need the driver for the usb-serial converter of the programmer and two DLL files that msp430-gdbproxy
uses to communicate with the programmer: MSP430.dll and HIL.dll. Do not download them from the same place as
MSP430-gdbproxy because they are old.
There are two options: the easiest way is to download IAR KickStart from the Texas Instruments website:
http://www.ti.com/lit/zip/slac050 and install it. It's just a
standard installer, click setup, wait, wait again, accept, next, next, next, next, install, wait, get coffee,
wait, finish. It's a waste of your bandwidth, but don't worry, you can always recycle unused bits and bytes
by throwing it in the recycle bin when you're finished ;-).
The second option is to download the driver from
http://focus.ti.com/docs/toolsw/folders/print/tusbwinvcp.html
(registration required) and the dlls from here:
http://processors.wiki.ti.com/index.php/MSP430_JTAG_Interface_USB_Driver.
Since March 2011 the most recent version is a 27 Megabyte "developer package". To download the package register with my.TI and fill in the form to declare that you're not from the dark side. Install the package and grab the dlls from C:\Program Files\Texas Instruments\MSP430.DLL Developer package <version>.
Installation
Now that we have downloaded everything, it's time to install. Open the zip-file containing Eclipse and copy the eclipse
folder from the zip-file to an easy-to-reach place. I use the root of my C-drive, such that the Eclipse executable is in
C:\eclipse\eclipse.exe.
Open the zipfile of mspgcc and unzip the contents to C:\mspgcc .
Copy the msp430-gdbproxy.exe file to c:\mspgcc\bin .
If you chose to install IAR, copy the MSP430.dll and the HIL.dll file from C:\Program Files\IAR Systems\Embedded Workbench 6.0 Kickstart\430\bin to c:\mspgcc\bin.
Otherwise, copy the dll files from the zip file you downloaded to c:\mspgcc\bin.
Put one of the microcontrollers in the socket on the LaunchPad if it's not already there, plug in your LaunchPad
and let Windows do it's driver installing magic. If you installed IAR, Windows installs the serial port driver automatically.
If you downloaded the driver or if it does not work automatically, you need to direct Windows to the right place.
In the case of IAR you can find it under C:\Program Files\IAR Systems\Embedded Workbench 6.0 Kickstart\430\drivers\TIUSBFET.
Check if windows recognises your LaunchPad in the device manager. Under Ports (COM & LPT) you should have an
item named
MSP430 Application UART. If Windows does not see your LaunchPad fix this first before continuing!
Testing msp430-gdbproxy
Start a Command Prompt:

cd to c:\mspgcc\bin:
c:
cd \mspgcc\bin

Enter:
msp430-gdbproxy msp430 --spy-bi-wire TIUSB
msp430-gdbproxy is the name of the program
msp430 parameter is required
--spy-bi-wire tells msp430-gdbproxy to use the Spy-bi-wire protocol instead of JTAG. This
is what you want when using a LaunchPad or a eZ430-<something>. If you use a MSP430 with JTAG and a MSP-FET430UIF
do not use this option.
TIUSB is the port the programmer is connected to. TIUSB means "I don't know, find out for
yourself". This usually works fine,
but when you have multiple programmers connected you can specify the COM-port your programmer is connected to.
Now you should see a message telling you that the target device is found and that it's a 'F20x2_G2x2x_G2x3x'
and a message that msp430-gdbproxy is waiting on port 2000:

Possible problems you could run into:
- your firewall asking for permission to allow port 2000: choose allow. You can change the port that msp430-gdbproxy
uses by adding
--port=1234 right after msp430-gdbproxy.
- "Could not find device (or device not supported)" followed by a range of errors: there is a connection problem
between the programmer and the microcontroller. The connection between the programmer and your PC is OK!
- "Could not initialize device interface (1)": there is a problem with the connection between your PC and the
programmer.
- a message about the USB FET being the wrong version: run
msp430-gdbproxy msp430 --update-usb-fet
TIUSB and try again.
Setting the Path variable for Eclipse
Eclipse doesn't know about your mspgcc installation and where to find the executables it will need later. To help Eclipse
we need to modify the PATH environment variable. You could do that via your system settings, but chances are that you
will probably mess up some other software on your system.
We will use a different method:
Getting to know Eclipse
Start Eclipse by double-clicking the new shortcut. You will get a black window and the Eclipse splash screen. You
can close the black window as soon as you see the splash screen.

Now Eclipse will ask you to choose a workspace location. I chose "C:\Users\Marc\workspace". Click OK.

Eclipse will start and show a welcome screen.

Click the little cross to close it.

You will now see Eclipse in its full glory. The screen is divided into different "views". On the left you have
the Project Explorer view, it lists all files in your projects. They all have a specific task and use. You can
move them around an place them anywhere by grabbing the title and dragging the view to another place.
When you accidentally close a view you can get it back via the
Window ->
Show view menu option.
Maybe you want to organise views differently when you are busy coding than when you are
hunting a bug. Well, Eclipse has something for that too: Perspectives. A perspective is just another way
of looking at your project. You can select which perspective to use at the top right. Now the
C/C++ perspective is selected.

At the moment there are no other buttons visible but you can click on the small button on the left of the
C/C++-button
to choose a different perspective. You don't need to think much about it, when we start debugging later, Eclipse
will ask if we want to switch to debug view.
Adding support for the compiler and GDB hardware debugging
We need a few features that are not included in the downloaded Eclipse package, so let's install these additional
features. Open the
Help menu and click
Install New Software:

In the
Work with textbox paste:
http://download.eclipse.org/tools/cdt/releases/helios
and press Enter.
Note: make sure that this url is for the right version; if you have Eclipse 3.6 Helios it's ok, but for 3.7 Indigo you need to replace "helios" with "indigo".

Wait for the list of available items to load. Expand
CDT Optional features and check
C/C++ GCC Cross Compiler Support
and
C/C++ GDB Hardware Debugging:

Click Next and get yourself a cup of coffee, and bring one for me please :-).
After a while you will be able to review the items to be installed. Click next, accept the license agreement and click finish.
Eclipse will now install the required components.

When Eclipse is finished installing the software, it will ask you if it has to restart. Click
Restart Now:

Open the same workspace as before.
Creating a new project
All files are organised in a project, so we need a project. Click the
File menu,
New,
C Project:

Enter a name for the project, uncheck
Show project types and toolchains..., choose
Empty Project under
Executable as project type and
MinGW GCC as
Toolchain. Click Finish.
Note 1: You probably do not have the MinGW toolchain on your PC. That's not a problem, we just use Eclipse's
settings for MinGW GCC, because mspgcc is similar to MinGW GCC. Later you will see that Eclipse warns you that "the
configuration support is not installed". You can safely ignore that.
Note 2: You could also have chosen to create an Empty Makefile project with the
-- Other Toolchain --
toolchain and use the same Makefile that Hack-a-Day used in their LaunchPad with Linux tutorial (see:
https://github.com/Hack-a-Day/had_launchpad-blink).

Your new project appears in the Project Explorer view:
Configuring the project for MSPGCC
Right click on the project and choose Properties. Expand
C/C++ Build and click
Discovery Options.
Enter
msp430-gcc.exe in the
Compiler invocation command-textbox.

Open
Settings under
C/C++ Build. Select
GCC Assembler and change the command to
msp430-as.exe:

Select
General under
GCC Assembler.
If you are using the G2231 in the LaunchPad enter
-mmcu=msp430x2231 in the
Assembler flags-textbox
and if you are using the G2211 in the LaunchPad enter
-mmcu=msp430x2211. For the newer LaunchPads with the
G2452 and G2553 it's
-mmcu=msp430x2452 and
-mmcu=msp430x2553.
Click the add button to add an include path. Enter
c:\mspgcc\msp430\include (not "c:\mspgcc\include"!).

The
-mmcu=msp430x2231 tells the compiler which microcontroller you are using.
This used to be different when mspgcc did not yet support these microcontrollers but now it does.
Select
GCC C Compiler, enter
msp430-gcc.exe as command:

Select
Includes under
GCC C Compiler and add the include path again:

Select
Miscellaneous under
GCC C Compiler and add the
-mmcu=... option to the
Other flags:

Select
MinGW C Linker, enter
msp430-gcc.exe as command:

Under
MinGW C Linker select
Miscellaneous and add
-mmcu=... option to the
Linker flags:

Switch to the
Build Artifact tab and enter
elf as
Artifact extension:

Switch to the
Binary Parsers tab, disable the
PE Windows Parser and enable the
Elf Parser:
So, this was the most difficult part. Click OK and congratulate yourself: well done!
Adding source files to your project
Now the real deal, lets add some code!
Right click on the project in the Project Explorer view, select
New and click
Source File. If there
is no
Source File maybe you are not in the C/C++ perspective. You can switch to the right perspective or click Other.

Enter the name of the new file: "main.c":

Eclipse will create a new file for you and open it:

Now copy the following code in the file:
// Include the register definitions. Note that we do not
// use a device specific include file, the compiler handles
// that based on the -mmcu option
#include <io.h>
// stdbool.h, so we can use booleans and true/false as constants
#include <stdbool.h>
int main() { // The main function
volatile unsigned int i = 0;
/* Disable the watchdog. The watchdog is on by default on an
* MSP430, if we do not disable it it will reset the CPU after
* 32k cycles in the standard configuration.
*/
WDTCTL = WDTPW + WDTHOLD;
// set P1.0 as output
P1DIR = BIT0;
// do forever:
while (true) {
i++;
if (i == 0) {
/* Flip the value of P1.0's output register when i
* overflows to zero
*/
P1OUT ^= BIT0;
}
}
}
Save the file and press Ctrl-B. The title of the Console view on the bottom of the window becomes bold, meaning that something happened there. Open the console view:

If there are no error messages, everything is OK. If there are errors these could be the following:
- Eclipse cannot find msp430-gcc: you made an error in setting the path variable (in that .bat file). You could also try to change the system environment variables in the Windows control panel.
- gcc spits out a list of msp430 processors: you made an error in the -mmcu option
The text in the console view should contain a.o. these two lines:
msp430-gcc.exe -Ic:\mspgcc\msp430\include -O0 -g3 -Wall -c -fmessage-length=0 -mmcu=msp430x2231 -omain.o ..\main.c
msp430-gcc.exe -mmcu=msp430x2231 -oBlinky.elf main.o
If there is a part missing, check the project options.
If a source file is not changed Eclipse will not compile it again. Then, when pressing Ctrl-B you will get a line saying "Nothing
to build for ..." in the console view. If you want to build anyway you can click the
Project menu and choose the
Clean... option. Clean the project and build again.
Debugging
Building the code works; we are going to program it in the microcontroller and debug the code.
The way we debug with Eclipse consists of two parts; first we start the msp430-gdbproxy and then
via msp430-gdb we connect to the gdb-proxy.
Click in the toolbar on the
External Tools button and click
External Tools Configurations:

Select
Program in the left part of the window and click the New button:

Enter in the Name textbox: "GDB proxy"
Enter as Location:
c:\mspgcc\bin\msp430-gdbproxy.exe
Enter as Working Directory:
${workspace_loc:/Blinky} (click the
Browse
Workspace-button, select your project and click OK).
Enter as Arguments:
msp430 --spy-bi-wire TIUSB. If you are using a
MSP-FET430UIF and a MSP430 chip with JTAG and you want to use JTAG do not write the
--spy-bi-wire option.

Click
Apply and click
Run. msp430-gdbproxy starts and the output shows in the console view:

Make sure you get no errors.
Click in the toolbar on the
Debug button and click
Debug configurations:

Select
GDB hardware debugging and click the
New button:

Eclipse will automatically fill in the right file for the application and the right project on the
Main tab. Check and correct the values if necessary.

On the
Debugger tab change the GDB command to msp430-gdb and the port number to 2000:

Enter
monitor erase main in the textbox in the
Startup tab as shown and click apply (
Note: if you're using mspdebug you should enter
monitor erase):

Make sure that msp430-gdbproxy is still running and click
Debug.
Because Eclipse was in the C/C++ view and you started debugging Eclipse will ask if you want to switch to the debug perspective:

Click yes. The Debug view shows the running processes and that the current thread is suspended at the reset vector:

We could start the program by clicking the resume button or pressing F8, but let's first set a breakpoint.
Open main.c by clicking on its tab.
Scroll to the line containing the i++ statement and doubleclick on the blue bar on the left. A blue dot appears:

You have now set a breakpoint. Every time the microcontroller wants to execute this line it halts right here,
so you can inspect the values of variables, step manually trough the program etc.
There is a limit: depending on the type of microcontroller you can set only a limited number of breakpoints. The
G2211, G2231, G2452 and G2553 have a maximum of two.
If you set more than two, debugging will become very slow because gdb emulates your breakpoints by stepping through
the program line by line and for every line it will check if there is a breakpoint or not. Check the datasheet of
the microcontroller to know how many hardware breakpoints it has. It's quite well hidden: The functional block diagram
of the microcontroller contains a block "Emulation 2BP". 2BP means two breakpoints. Larger microcontrollers can usually
handle more breakpoints.
Now click the
Resume button:

The program will start and run until it hits the i++ line. Step through the program by pressing F5 a few times. When you
open the Variables view you will see that there is one variable named i, and every time i++ is executed the value is incremented by one.

If you want the program to continue and halt no longer, remove all the breakpoints (you can do that using the Breakpoints
view) and hit F8. If you want to pause again, press the suspend button right next to the resume button.
If you want to stop debugging because you changed the code and want to try again, click the red Terminate button. Wait until
msp430-gdb is finished and click the arrow next to the debug button and select
Blinky debug, or the name you chose when
you set up the debug configuration.
Do not press the debug button, because Eclipse thinks you're making a Windows program and it will create a new debug configuration
for that and will try to run that configuration, which will fail.
To change that behavior, open the Window menu, click Preferences, expand Run/Debug and select Launching. Under Launch
Operation select
Always launch previously launched application:

Now when you click the debug button everything will work as expected.
Conclusion
That's it! Now you have set up the complete environment for programming and debugging the LaunchPad using almost only
open source tools (the msp430-gdbproxy and dll's are closed source, but all the other tools are open source).
You can set breakpoints, step through your code and inspect the values of variables.
To learn more about programming the LaunchPad, read the documentation. The most important documents are
the
MSP430F2xx family user's guide and the device
datasheets of the microcontrollers:
MSP430G2211,
MSP430G2231,
MSP430G2452,
MSP430G2553.
Note for AVR and PIC users: while Atmel and Microchip put all information in one datasheet, Texas Instruments
does things different: all common information is in the user's guide and only the device specific things are
in separate datasheets. You will need both, but most of the information is in the user's guide.
That's it for now. Make something nice with your LaunchPad and have fun! If you have seen a mistake or just want
to comment, drop me a line. See the contact page for details.
The text and pictures in this tutorial are licensed under the terms of the
Creative Commons Attribution-ShareAlike 3.0 Unported license.
Thanks to Lukas Simma and Norbert Kleber, who wrote an
article
on mikrocontroller.net and inspired me to write this tutorial.