MSP430 Development with Linux

Using Linux and the TI MSP430 processor to create blinking LEDs is a learning exercise, not just a way to make cheap Sci-Fi movie panels.

Linux embedded development doesn't only mean embedding Linux in a product, it also means using Linux as a development platform for embedded microprocessors. The majority of computer processors are not on the desktop or in Beowulf clusters, they are embedded in the millions of devices that you use every day: your alarm clock, microwave, thermostat, car, cell phone and so on. Linux can be used to develop software for embedded projects using microprocessors like the Microchip PIC, Atmel AVR, Philips LPC ARM and TI MSP430 devices.

You don't need to be a professional developer to have fun with these tiny computer devices. The development tools are inexpensive, and the hardware required is minimal. Soldering skills and some experience writing in C are really all you need to get started creating a controller for your next Sumo Bot, remote controlled helicopter or digital lock.

The Texas Instruments (TI) MSP430 family of microprocessors have a wide range of features:

  • Power consumption as low as 0.1uA in off mode.

  • Multiple 16-bit timers with capture/compare.

  • PWM outputs, which are very useful for robotics.

  • A/D converters for monitoring sensors.

  • SPI and Asynchronous UARTs for communications.

  • Integrated LCD display controllers.

  • Onboard oscillators.

  • Multiple clock sources for low-power sleep modes.

The '430 family includes more than 80 devices in four major groups. Flash, where the program is stored, ranges from a paltry 1KB to an extravagant 60KB. The available RAM is as large as 5KB or as small as 128 bytes.

Of course, 128 bytes isn't much RAM, but it is enough to get the job done for small projects. Many of my embedded projects are written in assembly code to conserve space, but with the MSP430, I have found myself using C as the primary language. Instead of using a commercial compiler or IDE, I have chosen to use the GNU GCC toolchain, which has had MSP430 support added to it. The GCC compiler does a pretty good job of generating code, and C is certainly the better choice if the the code is going to be maintained over a number of years. There's nothing worse than returning to heavily optimized assembly project five years later and trying to make adjustments without the whole system crumbling to its knees.

With the Microchip PIC processors that I wrote about in 1998, the development process was a bit tedious. I would write some code, compile it, flash the PIC, wonder why it didn't work and then repeat. I used a couple of I/O lines and LEDs as debugging tools, but there's only so much information that you can grok from two flashing LEDs. I really had no way to know exactly what was going on inside the processor when things went wrong. One solution could have been to buy an In Circuit Emulator (ICE). An In Circuit Emulator is a device you plug in to the socket where the processor normally goes. It emulates the CPU and lets you examine every instruction, memory locations and much more. But the $1,200+ US price for an ICE was out of my reach.

Today, things are much easier for both the the hobbyist and professional. Many of the newer processors include built in real-time debugging support using the IEEE Std 1149.1 JTAG specification. This six-wire interface allows real-time debugging of the software running on the target device. You can step through your code, watch registers and memory locations change, insert breakpoints and modify RAM on the fly. This is a dramatic improvement over the old 1- or 2-bit diagnostic line.

Instead of dropping a dozen c-notes on expensive debugging tools, you can get a parallel port JTAG adapter from Olimex for the amazing price of $15 US. This allows people to debug their code with interactive debuggers like gdb instead of relying on blinking LEDs and serial ports.

Setting Up MSP430 Software Development

MSP430 support was added to GCC by a group headed by Dimitry Diky and Chris Lichti. Their project includes the gcc compiler, linker, libraries, gdb debugger and a closed-source interface to the parallel JTAG adapter. The main emphasis of the mspgcc project has been on the Windows. Getting it working on Linux is a bit of a struggle, involving compiling the alternate toolchain, libraries and so on. Maybe I'm getting old, lazy or just used to .deb and .rpm packages, but these days, I prefer not to fight with the software I'm installing. Running rpm -Uhv <package> saves my energy for debugging my MSP430 code.

Thanks to Stephan Linz and his Cross Development Kit for MSP430, I don't need to spend more than five minutes installing development tools. He has done all the hard work getting mspgcc compiled and packaged as RPMs. Stephen also has created Cross Development Kits for the AVR processor and the Altera soft core NIOS, if you are interested in those target processors. If I ever need to write code for the AVR, I know where to go.

The cdk4msp project is available from SourceForge, and here is a minimal list of the packages that need to be installed from the cdk4msp SourceForge download page:

  • cdk-msp-base-0.2-20031111.i386.rpm

  • cdk-msp-binutils-2.14-20031106.i386.rpm

  • cdk-msp-examples-libc-20031101cvs-20031102.noarch.rpm

  • cdk-msp-examples-mspgcc-20031101cvs-20031102.noarch.rpm

  • cdk-msp-gcc-3.3.2-20031106.i386.rpm

  • cdk-msp-gdb-5.1.1-20031106.i386.rpm

  • cdk-msp-gdb-proxy-5.1.1-20031106.i386.rpm

  • cdk-msp-jtag-lib-20031101cvs-20031102.i386.rpm

  • cdk-msp-libc-20031101cvs-20031102.noarch.rpm

Additional document packages can be downloaded, depending on your preference for man pages, info files, PDF or HTML pages. I have successfully used these packages on Fedora Core releases 1 through 4, and although I haven't tried any other RPM-based distributions, I expect them to work just fine. These RPM packages function as a self-contained unit, and don't depend on any outside packages.

Install the packages in this order with the following commands:

rpm -Uhv cdk-msp-base-0.2-20031111.i386.rpm
rpm -Uhv cdk-msp-binutils-2.14-20031106.i386.rpm
rpm -Uhv cdk-msp-libc-20031101cvs-20031102.noarch.rpm
rpm -Uhv cdk-msp-gcc-3.3.2-20031106.i386.rpm
rpm -Uhv cdk-msp-gdb-5.1.1-20031106.i386.rpm
rpm -Uhv cdk-msp-jtag-lib-20031101cvs-20031102.i386.rpm
rpm -Uhv cdk-msp-gdb-proxy-5.1.1-20031106.i386.rpm
rpm -Uhv cdk-msp-examples-libc-20031101cvs-20031102.noarch.rpm
rpm -Uhv cdk-msp-examples-mspgcc-20031101cvs-20031102.noarch.rpm

The install places everything in the directory tree below /opt/cdk4msp. Take a look at the examples in /opt/cdk4msp/examples/mspgcc and the documents in /opt/cdk4msp/doc, info and man directories, depending on which style of documentation you installed.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

naken430asm msp430

Anon's picture

naken430asm msp430 assembler/disassembler:

naken430asm msp430

Anon's picture

naken430asm msp430 assembler/disassembler:


cihip's picture

MSP430 Development with Linux post for thanx.

MSP430 programmer

Dilip Shirke's picture

Dear sir/madam

I am student of electronic sc. I want to develope systems using MSP430 but I donot have development board for it I know technique for PCB fabrication If you provide me layout for it so I can start working on it.

Thank you

You should put this on TI's MSP430 site

Anonymous's picture

Go to They have tons of msp430 apps available for download!

MSP430 Dev just got a lot easier and cheaper

Doug LaRue's picture

Nice article Brian but I just wanted to let everyone know that TI has a MSP430F2013 dev setup for $20 and it works with the msp430-dgbproxy. It's call the EZ430 and you can even get 3 extra msp4302012 boards for $10, also from TI.

Now the real 'goody' is that you can get Eclipse using standard packaging software in Ubuntu/Kubuntu/Edubuntu along with the CDT but it's an older CDT so I had to get v3.1.1 in .deb format elsewhere. I was also able to build the mspgcc tools, get the gdbproxy 'seeing' the USB based EZ430 and coding/debugging from within Eclipse.

Pretty awesome. I'll be putting together some online pages to help anybody through this and will post the link ASAP.

Oh, supposedly, the MSP430-JTAG-UIF adapter works the same as the EZ430 adapter since they both have the same USB ID. The difference is the EZ430 uses the 4 wire spy-bi-wire interface and not the full JTAG interface. This does mean that a good number of other MSP430 chips can also be developed and debugged with the $20 EZ430 setup with the right wires/pins connected.

ez430 doc

Anonymous's picture

Hi there. Did you ever put up a tutorial for the ez430 and linux? im working in circles trying to get the two work together.


ez430 doc

Anonymous's picture

Hi Wernher,

please have a look at this resources:
(Thanks to Friedrich Lobenstock)

I 've got it work on a openSuse 10.2 (32Bit) System. If you use the, it should install from sources for another distribution too.
To avoid a lot of errors download the complete "downloads" dir to your install directory before you start. There are also a few problems with the pathes in - you should solve them.

Good luck,


help help help

Ankur shah's picture

neeed desperate help!
i am a first time user of gcc and am trying to work out things for a project. howeve a silly thing frustrates me. can anyone tell me how one can read or retrieve data from the keyboard using gcc?? i am finding it difficlut using scanf or even commands like getchar, which my system doesnt recognise? are there any other ways??

msp430 and Linux 10 64bit

Parseval's picture


I'am trying a solution of the cdk-msp under linux 10 64bit since 3 days now and it is making me crazy.

I cann't use the src.rpm (error: Legacy syntax is unsupported: copyright).

My problem is to get the connection to the JTAG Interface with the msp430-jtag or the msp430-dbgproxy.

Can someone help me plz.


64 Bit MSP

amattas's picture

Were you ever able to get 64Bit MSP430 to work?

Eagle, PCB Fabrication

Frank Chambers's picture

The Eagle website has links to several PCB suppliers that can and will work directly from Eagle .brd files. I have used these services for several years and have obtained very good results at a low cost. The company I have done the most with CustomPCB seeems to prefer working with the brd file and provides a rules file for design check prior to sending the file.

This saves the extra steps of converting to Gerber and then trying to see if it is correct.


excellent article

timborn's picture

I look forward to LJ every month, and with few exceptions read every article. The quality and caliber is uniformly high.

This particular article, however, got positively dog-eared from being re-read a half dozen times. It rekindled a lost love of micros and tinkering. I had flashbacks of when Ciarcia wrote Circuit Celler articles for BYTE many years back (yep, I know about Circuit Cellar Ink, but I'm basically a sotfware guy with a hardware itch, and most of those articles are lost on me).

I would love to see more articles along this line, perhaps expanding on the board layout & etching process eluded to at the tail end of the article. I have etched boards before at home; it's a pain. Clearly there are better ways available now.

Curious how one goes about installing surface mount chips, since it looks like the MSP430 are all surface mount - no bugs with legs for tinkerers!

I make a lot of my own PCBs

Leon Heller's picture

I make a lot of my own PCBs at home, and don't have any problems soldering chips like the MSP430 - plenty of light, magnification and a good soldering iron (I use Metcal equipment) are essential.


Using MSP-430 USB debug interface

Sameer's picture

Hi all,
I want to know whether we could work out programming and debugging msp430 using the MSP430-USB-Debug-Interface. I have MSPGCC's latest version. I tried download using msp430-jtag -e filename.elf but is don't seem to be working. I found very few explations about using USB interface for MSP430 on net.

Sameer S. Upasani
India, Pune

Using MSP430 - eZ430 on ubuntu / linux?

Arun's picture

I would like to know if there is way to use the eZ430 USB stick on linux specifically on ubuntu! Any info in this regard will be of great help :-)
Thanks and regards,

Ez430 Linux USB Driver FIX!

Anonymous's picture


After two days of searching the net, I finally found the fix we've been waiting for.
First, I made fetched ti_usb_3410_5052 v1.1 driver, hoping that would fix it (v0.9 is in the latest kernel for some reason.) After an hour of fixing it to compile with my ubuntu kernel, I was back to square one with this error (v1.1 just adds some product ids, doesn't seem to add any other functionality.)

[462913.996000] drivers/usb/serial/usb-serial.c: USB Serial support registered for TI USB 3410 1 port adapter
[462914.000000] drivers/usb/serial/usb-serial.c: USB Serial support registered for TI USB 5052 2 port adapter
[462914.000000] ti_usb_3410_5052 3-4:1.0: TI USB 3410 1 port adapter converter detected
[462914.000000] /home/tom/tars/ti_usb_2.6-1.1/src/ti_usb_3410_5052.c: ti_startup - product 0xF430, num configurations 1, configuration value 1
[462914.000000] /home/tom/tars/ti_usb_2.6-1.1/src/ti_usb_3410_5052.c: ti_startup - device type is 3410
[462914.000000] /home/tom/tars/ti_usb_2.6-1.1/src/ti_usb_3410_5052.c: ti_download_firmware - downloading firmware
[462914.532000] /home/tom/tars/ti_usb_2.6-1.1/src/ti_usb_3410_5052.c: ti_download_firmware - download successful
[462914.812000] usb 3-4: reset full speed USB device using ohci_hcd and address 58
[462915.020000] usb 3-4: device firmware changed
[462915.020000] usb 3-4: USB disconnect, address 58
[462915.020000] ti_usb_3410_5052: probe of 3-4:1.0 failed with error -5

That was the original error. Essentially, it is a bug in driver. After looking at 5+ patches, I ran across one by Oleg V.

It is also right here.

Quoting Oleg Verych <[EMAIL PROTECTED]>:

> pp-by: Oleg Verych
> ---
> i.e. no more uGLYdev with sysfs
> Alan, i'm looking forward to deal with this crutch :-E
> drivers/usb/serial/ti_usb_3410_5052.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> Index: linux-2.6.21-rc1/drivers/usb/serial/ti_usb_3410_5052.c
> ===================================================================
> --- linux-2.6.21-rc1.orig/drivers/usb/serial/ti_usb_3410_5052.c
> 2007-02-23
> 05:03:57.691537658 +0100
> +++ linux-2.6.21-rc1/drivers/usb/serial/ti_usb_3410_5052.c 2007-02-23
> 05:22:22.766512292 +0100
> @@ -389,13 +389,13 @@
> usb_reset_device(dev);
> }
> - status = -ENODEV;
> + status = 0x01E; /* positive status -- device to be reconfigured
> */
> goto free_tdev;
> }
> - /* the second configuration must be set (in sysfs by hotplug script) */
> if (dev->actconfig->desc.bConfigurationValue == TI_BOOT_CONFIG) {
> - status = -ENODEV;
> + (void) usb_driver_set_configuration(dev, TI_ACTIVE_CONFIG);
> + status = 0xA1B;
> goto free_tdev;
> }
> --

So all you have to do, is download your kernel sources, and apply this patch. Now if yoti_usb_3410_5052ur kernel version is < 2.6.16 or so, you will also have to add in the PRODUCT_ids for the Ez430 device. I suggest you upgrade your kernel, since the product id fix is in kernels >~ 2.6.16 or so.

I applied the patch by hand, to the /usr/src/linux-source---/drivers/usb/serial/ti_usb_3410_5052.c file.

recompile.... And viola, it works! if I modprobe it before or after the device is inserted, no hotplug script needed!

Here is the working dmesg dump

[464233.560000] drivers/usb/serial/usb-serial.c: USB Serial support registered for TI USB 3410 1 port adapter
[464233.560000] drivers/usb/serial/usb-serial.c: USB Serial support registered for TI USB 5052 2 port adapter
[464233.564000] usbcore: registered new interface driver ti_usb_3410_5052
[464233.564000] /home/tom/tars/ti_usb_2.6-1.1/src/ti_usb_3410_5052.c: TI USB 3410/5052 Serial Driver v1.1
[464241.468000] ti_usb_3410_5052 3-4:2.0: TI USB 3410 1 port adapter converter detected
[464241.468000] usb 3-4: TI USB 3410 1 port adapter converter now attached to ttyUSB0

So in conclusion, apply patch to a newer kernel, and enjoy. I'm glad I devoted my time into fixing this stupid problem once and for all.

--Tom Golubev

TI MSP-30 USB interface

Tommaso Toffoli's picture

Dear Sameer:

I'm very interested in that issue. I wonder whether you got any
responses to you enquiry, or in any event found some information on how to interface the MSP430 USB development kit to Linux. I would like to
drive the development (assembly/running/debugging from a Python environment.
Many thanks


Bodo Michalski's picture

By reviewing your articles I found out that the quality is very high. I take a lot of advantages from the articles for my work. Thank you to the linux-team and all the comments.
Bodo Michalski from Germany