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.
Schematics and Custom PC Boards

Flashing LEDs get boring pretty quickly. Once you get the bugs worked out of your blinking LED, you probably are going to want to design a custom PC board with interfaces to the outside world. One of my projects is a one-wire lock controller with an RS232 interface that uses Dallas Semiconductor iButtons for access control.

For this project, I chose one of the smallest of the family, the MSP430F1101 with 1KB of Flash and 128 bytes of RAM. It uses a pair of transistors to switch a DC motor on and off and a MAX3221 for serial communications with a PC. The C code to control the lock just barely fits into the 1K Flash space of the '1101. A low dropout voltage regulator is used to power the board and provide a clean reset to the processor. I drew the schematic and designed the board using Eagle CAD Lite under Linux. Eagle has several versions of its schematic and PCB auto-router, including a free version for noncommercial use:

  • Free for noncommercial use.

  • Board size limited to 3.2"x4" and two layers.

  • One schematic sheet.

  • Lite version for $49 US with same limitations as the free version.

  • Standard version for $600 US.

  • Pro versions for $1,200 US.

  • Linux, Windows and Mac versions are available

Figure 4. Lock Project PC Board Layout from Eagle

Figure 5. Picture of the Prototype PC Board

Eagle CAD is easy to get started with, low cost and very powerful. A user scripting language allows you to add features and customize the program to fit your needs. User support for Eagle is very strong, and the Web site has an extensive collection of user-created libraries.

The Eagle auto-router supports advanced features like back-annotation, keepout areas, design rules checks and one of my favorites—flood fill with thermal relief. If you have ever tried to solder a pin surrounded by a large ground plane, you will appreciate the advantage of thermal relief on power pins. Without it the ground plane acts like a large heat-sink and solder won't stick. All levels of the PCB and Schematic editor support the concept of back (and forward) annotation. You can make changes on the PCB, and they will be reflected on the schematic and updates made to the schematic are reflected on the PCB.

After designing a PC board, you actually need to make one. You can etch your own, but it is difficult to match the quality of even the least-expensive board manufacturers. Some manufacturers will accept Eagle PCB files directly, which saves you the step of converting the design to the Gerber format. The Gerber format is a lot like an old pen plotter, it tells PCB etching equipment where to draw the trace and how large a line to draw. Most PCB manufacturers still require Gerber files, so Eagle includes a script to output the necessary Gerber files.

One difficulty in dealing with Gerber files is that although Eagle can export the PCB in the correct format, it has no way to view the output to verify it was converted correctly. Linux has needed a good Gerber viewer for years, but it has been available only with recent releases of the gerbv program. It isn't as intuitive as I would like, but it does function well enough to display the Gerber files so that you can check the final output before sending it off to have 1000 of your latest widget design created.

Figure 6. Picture of LinkWiFi PC Board

I have used four different PCB manufacturers myself. Their prices and features vary, but customer service and quality from all four have been excellent. Olimex and PCB Pool both accept Eagle CAD files directly, with no need for conversion to Gerber. Olimex is in Bulgaria, and turn-around time can be up to three weeks, but prices are excellent. PCB Pool is in Ireland and has quick turn-around or longer turn-around times, depending on price (as do most). I used PCB Pool for the one-wire Wi-Fi boards (Figure 6).

AP Circuits is in Canada and has very good prices and very fast turn-around. The bare one-wire lock boards were ordered on a Saturday, and I received them on Wednesday. I ordered them with no silkscreen or solder mask in order to keep the price low. For production, I used E-Teknet for my DT-1A temperature sensor boards with excellent results.

The MSP430 is a fun and easy-to-use processor; its wide range of features and access to free development tools and low-cost JTAG hardware make this processor a good choice for both the hobbyist and the professional developer. Using the GNU gcc toolchain reduces the learning curve and allows you to use the same tools for developing code on the MSP430 that you would use for Linux projects. My set of development tools includes make, gcc, gdb and joe.

Resources for this article: /article/8697.

Brian C. Lane lives in Port Orchard, Washington, with his wife and son, who is a huge Tux Racer fan. He serves as Webmaster For Life for the Kitsap Peninsula Linux User Group and writes Linux apps in his spare time.

______________________

Comments

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:
http://www.mikekohn.net/micro/naken430asm_msp430_assembler.php

naken430asm msp430

Anon's picture

naken430asm msp430 assembler/disassembler:
http://www.mikekohn.net/micro/naken430asm_msp430_assembler.php

thanx

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 www.designmsp430.com. 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.

thanks
wernher

ez430 doc

Anonymous's picture

Hi Wernher,

please have a look at this resources:

ftp://ftp.fl.priv.at/pub/msp430/
(Thanks to Friedrich Lobenstock)

I 've got it work on a openSuse 10.2 (32Bit) System. If you use the build.sh, 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 build.sh - you should solve them.

Good luck,

Wolfram

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

Hello,

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.

thx
Parseval

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 www.cadsoftusa.com 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.

Frank

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.

Leon

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

Sameer/Anyone,
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,
Arun

Ez430 Linux USB Driver FIX!

Anonymous's picture

Hello,

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;
> }
>
>
> --
>
>

http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg518...

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

Review

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

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState