2013
02.09

Use EZ430-F2013 in Ubuntu

This note explains how to install the command-line tools in Ubuntu to compile, load and run images destined for the Texas Instrument EZ430-F2013.

The TI EZ430-F2013 is a USB development environment for small dongles that host a TI MSP430 micro-controller (MSP430-F2012 and MSP430-F2013).

This note relates to:

Install Packages

The packages required to work with the MSP430 are available from the main repositories.

Verify Drivers for EZ430-F2013

Insert the EZ430-F2013 in a USB port. Then, run “dmesg” to verify that it was detected correctly:

The output should end with a set of lines that looks as follows:

The report from “dmesg” shows that the development kit was mounted to /dev/ttyUSB0. For the remainder of the note, this value is assumed. However, you might need to adjust this value to fit your particular installation.

Writing a program for MSP430-F2013

Create a new source file.

Paste the following code:

The code above drives the LED found on the MSP430-F2013 to emit “SOS” in Morse code. A number of definitions are already declared in the file “msp430f2013.h”. Many header files relating to the MSP430 can be found in the directory /usr/msp430/include.

Compiling and Linking Program

Compiling and linking programs/images for the MSP430 is done by using “msp430-gcc”, which is a version of “gcc” that targets the MSP430 micro-controller. Most options available for “gcc” are also available for “msp430-gcc”.

Compiling using “msp430-gcc” yields object files, as with “gcc”. However, invoking the linker produces *.elf files, which can be loaded on the MSP430-F2013 via the development kit (EZ430-F2013).

Following the example started above, the two lines required to produce an object file from the source code, and then link into an image:

mspdebug

A command line utility called “mspdebug” is used to perform most operations that involves the EZ430-F2013 development kit.

First, insert the EZ430-F2013 in a USB port and verify that it is mounted to /dev/ttyUSB0 (see steps above).

When invoking “mspdebug”, one must specify the device that the EZ430-F2013 is mounted as.

This command opens a shell where a number of commands can be sent to the development kit. To leave the shell, press CTRL-D.

Loading Image on MSP430-F2013

Loading an image on an instance of MSP430-F2013 via the development kit is accomplished by using “mspdebug”:

where:

  • <device> refers to the device file name where the USB development kit is mounted
  • <elf-file> refers to the ELF file produce by the msp430-gcc linker

Following the example above:

Debugging MSP430

Via the EZ430-F2013, one can debug the program loaded in the MSP430, including single-step execution, via the “gdb” debugger provided by the MSP430 packages. The command-line utility “msp430-gdb” is similar to “gdb” but designed for the MSP430 micro-controller. However, “mspdebug” is needed to bridge “msp430-gdb” to the MSP430 via the EZ430-F2013 development kit.

The command “gdb” within the shell provided by “mspdebug” start a server that listens to commands from “msp430-gdb” and forwards them to the EZ430-F2013 development kit. When “msp430-gdb” connects to “mspdebug”, it provides a shell similar to the one provided by “gdb”.

The command required to start the server is:

In a different terminal, attach the debugger with the following command:

The commands available in “gdb” are also available in “msp430-gdb”:

  • To execute program: continue
  • To stop program: CTRL-C
  • To list stack variables: info locals
  • To list global variables: info variables

To continue the example started above:

Debug using X Debugger: ddd

If X is available, one can use “ddd”, which is a GUI application to simplify the use of gdb.

To use “msp430-gdb” via “ddd”, one must first start “mspdebug” and then invoke “ddd” by specifying “msp430-gdb”. To continue the example in this note:

Conclusion

Using the TI EZ430-F2013 development kit with an Ubuntu platform is a snap since all the tools required are readily available in the main repositories. Furthermore, anyone familiar with gcc and gdb can easily transition to the line of tools designed for the MSP430 since the commands and options are almost the same.

5 comments so far

Add Your Comment
  1. Jean-Pierre,

    I am running 12.04LTS with msp430-gcc version 4.6.3.
    I successfully installed the necessary msp430 packages as you describe in the first step. However, when I connect my EZ430-F2013, I get the following in dmesg:

    [ 181.377428] usb 1-1: new full-speed USB device number 3 using uhci_hcd
    [ 181.818837] usbcore: registered new interface driver usbserial
    [ 181.818873] USB Serial support registered for generic
    [ 181.820345] usbcore: registered new interface driver usbserial_generic
    [ 181.820348] usbserial: USB Serial Driver core
    [ 181.822807] USB Serial support registered for TI USB 3410 1 port adapter
    [ 181.825139] USB Serial support registered for TI USB 5052 2 port adapter
    [ 181.825776] ti_usb_3410_5052 1-1:2.0: TI USB 3410 1 port adapter converter detected
    [ 182.934044] usb 1-1: ti_download_firmware – error downloading firmware, -110
    [ 182.934059] ti_usb_3410_5052: probe of 1-1:2.0 failed with error -5
    [ 182.934083] usbcore: registered new interface driver ti_usb_3410_5052
    [ 182.934084] ti_usb_3410_5052: v0.10:TI USB 3410/5052 Serial Driver

    The device never mounts to /dev/ttyUSB* like it should.
    What is that “error downloading firmware, -110” ??
    So then I upgraded the package “linux-firmware” successfully, but I still get the same dmesg messages when connecting the EZ430.

    What am I missing? Any ideas?

    I used to be able to run mspdebug easily in Ubuntu 10.10. Now I am revisiting an old project, but things are not cooperating anymore..

    BTW, thank you so much for this post. It is exactly what I was looking for and very current!

  2. Hey JP,

    My fault, I should clarify that I’m trying to use mspdebug in a VMware Ubuntu 12.04 under Windows 7. Today I had a chance to try the same on an actual 12.04 box and it works just fine. It’s amazing how quickly I was able to get it running, it used to be such a hassle. Anyway, after some more digging, the VM issue is apparently a driver problem between VMware and Windows. It’s a shame that the one poster who described the same issue in a forum never mentions what exactly his solution was.
    Any thoughts?

    Again, great blog!

  3. Sorry, I do not have any thought about this issue. Thanks for letting me know the issue with VMware.

  4. Hi!
    Thanks for your nice description!
    But I’ve a little problem flashing the MSP430F2272 using the eZ430-F2013.
    MspDebug is starting well.
    But then I get the following error:

    Trying to open /dev/ttyUSB0 at 460800 bps…
    Initializing FET…
    FET protocol version is 10002000
    Set Vcc: 3000 mV
    Configured for Spy-Bi-Wire
    fet: FET returned error code 4 (Could not find device or device not supported)
    fet: identify failed
    Trying again…
    Initializing FET…
    FET protocol version is 10002000
    Set Vcc: 3000 mV
    Configured for Spy-Bi-Wire
    Sending reset…
    fet: FET returned error code 4 (Could not find device or device not supported)
    warning: fet: reset failed
    fet: FET returned error code 4 (Could not find device or device not supported)
    fet: identify failed

    Do you know what went wrong?
    Thanks.

  5. Jean-Pierre,

    I have been fighting the installation of MSP430 tools so that I can use the eZ430-F2013 USB development stick from my Mint 17.2 Linux laptop for a couple of weeks now. Your blog post was clear, concise, and WORKED! Thank you so much for the write-up.

    All of the tools that you listed (mspdebug, msp430-gdb, and ddd) work on my laptop.