Black God

Debugging Texas Instruments MSP-EXP430G2 Launchpad with MSPDebug tool in Ubuntu Linux

This post brings you a way to debug Texas Instruments MSP-EXP430G2 Launchpad Development tool from Ubuntu Linux using MSPDebug tool. This tool provides source level debugging capability. Basically it supports MSP430 MCUs  with JTAG and Spy Bi-Wire interface. It also supports simulation mode, which allows MSP430 code to be debugged without hardware. Another worth noted feature is reverse engineering support.

Hardware setup

The below shown is the MSP-EXP430G2 Launchpad.

The below commands and outputs shows how this USB debugger detected in Linux.

$ dmesg
………………………………………..
[ 4203.780954] usb 6-1: new full speed USB device using uhci_hcd and address 2
[ 4204.204352] cdc_acm 6-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 4204.204358] cdc_acm 6-1:1.0: No union descriptor, testing for castrated device
[ 4204.204422] cdc_acm 6-1:1.0: ttyACM0: USB ACM device
[ 4204.206642] usbcore: registered new interface driver cdc_acm
[ 4204.206645] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
[ 4204.263177] usbcore: registered new interface driver hiddev
[ 4214.335699] /build/buildd/linux-2.6.35/drivers/hid/usbhid/hid-core.c: usb_submit_urb(ctrl) failed
[ 4214.335735] generic-usb 0003:0451:F432.0001: timeout initializing reports
[ 4214.336169] generic-usb 0003:0451:F432.0001: hiddev96,hidraw0: USB HID v1.01 Device [Texas Instruments Texas Instruments MSP-FET430UIF] on usb-0000:00:1d.1-1/input1
[ 4214.336235] usbcore: registered new interface driver usbhid
[ 4214.336240] usbhid: USB HID core driver
$ lsusb
………………………….
Bus 006 Device 002: ID 0451:f432 Texas Instruments, Inc. eZ430 Development Tool
………………………….
$ lsmod | grep acm
cdc_acm                14979  0

So the device node can be noted down as /dev/ttyACM0 from the above message.

Software installation and usage

Now it is time to install MSPDebug tool. Visit http://mspdebug.sourceforge.net/download.html to download the source code file in .tar.gz format.

Here is my console session to explain how I extracted, compiled and installed in Ubuntu Linux 10.10.

$ tar zxvf mspdebug-0.11.tar.g

$ cd mspdebug-0.11

$ make clean

$ make WITHOUT_READLINE=1

$ sudo make install
The debugger can be invoked in two different ways. One is to pass USB debugger’s Bus and Device IDs noted down from lsusb command. Another one is to let the tool to automatically detect it. Refer output of mspdebug –help command. Both works fine for me.
I observed the following error message when I run “mspdebug rf2500″ command, which is supposed to be right command to get connected with USB debugger.
$ mspdebug rf2500
Trying to open interface 1 on 007
rf2500: warning: can’t detach kernel driver: Operation not permitted
rf2500: can’t claim interface: Operation not permitted

But this command succeeded when run as root user. To fix this issue, the normal user (blackgod in my case) needs permission to use USB bus. So I created a udev rule for this device, which permists users belong to plugdev group to use this USB device. So ensure that your normal user is added to plugdev group (/etc/group).

Create a udev rule file called “/etc/udev/rules.d/71-persistent-msp430.rules” with following content. You need root permission to do this.
ATTRS{idVendor}==”0451″, ATTRS{idProduct}==”f432″, MODE=”0660″, GROUP=”plugdev”
Ensure that idVendor and idProduct values matches with what you observe in lsusb command.
Then restart udev service:
$ sudo restart udev  (or) $ sudo /etc/init.d/udev restart
Now unplug your USB debugger if it is connected and plug it again. Run “mspdebug rf2500″ command as shown below to get connected to debugger. Your device should be identified properly and you should get (mspdebug) prompt.
$ mspdebug rf2500
Trying to open interface 1 on 002
Initializing FET…
FET protocol version is 30066536
Configured for Spy-Bi-Wire
Sending initial reset…
Set Vcc: 3000 mV
Device ID: 0xf201
Device: MSP430F2013
Code memory starts at 0xf800
Number of breakpoints: 1
Available commands:
=         dis       hexout    opt       reset     step
break     erase     isearch   prog      run       sym
cgraph    gdb       md        read      set
delbreak  help      mw        regs      setbreak
Available options:
color     gdb_loop  quiet
Type “help <topic>” for more information.
Press Ctrl+D to quit.
(mspdebug)
For complete instruction on build environment and debugging with gdb, refer my post here:
Happy debugging hours!

1 comment for “Debugging Texas Instruments MSP-EXP430G2 Launchpad with MSPDebug tool in Ubuntu Linux

  1. December 1, 2010 at 3:48 pm

    hai karups,
    i want to buy a MSPEXP430G2 launch pad…
    in tamilnadu…frm where i can purchase that…
    pls…..

    urs
    elango

Leave a Reply

Your email address will not be published. Required fields are marked *