Black God

Debugging eZ430 Chronos with MSPDebug tool in Ubuntu Linux

Following my post on Configuring ez430 Chronos Wireless Development Tool in Ubuntu Linux, which talks about control center, this post brings you a way to debug eZ430 Chronos from Ubuntu Linux using MSPDebug tool. This tool provides source level debugging capability. Basically tt 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 USB Emulator cum Debugger available with eZ430 Chronos kit.

Watch can be disassembled and connected with USB debugger as shown in User Guide (“~/Texas Instruments/eZ430-Chronos/Documentation/SLAU292a.pdf”) installed while setting up eZ430 Chronos. Here is my setup.

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

$ lsusb
………
Bus 006 Device 003: ID 0451:f432 Texas Instruments, Inc. eZ430 Development Tool
$ dmesg
……….
[ 7042.656150] usb 6-1: new full speed USB device using uhci_hcd and address 4
[ 7042.868455] cdc_acm 6-1:1.0: This device cannot do calls on its own. It is not a modem.
[ 7042.868465] cdc_acm 6-1:1.0: No union descriptor, testing for castrated device
[ 7042.868551] cdc_acm 6-1:1.0: ttyACM0: USB ACM device
$ 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 005
rf2500: warning: can’t detach kernel driver: No data available
Initializing FET…
FET protocol version is 30001000
Configured for Spy-Bi-Wire
Sending initial reset…
Set Vcc: 3000 mV
Device ID: 0x6137
Device: CC430F6137
Code memory starts at 0x8000
Number of breakpoints: 3
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!

4 comments for “Debugging eZ430 Chronos with MSPDebug tool in Ubuntu Linux

  1. trandi
    September 4, 2011 at 11:42 am

    Nice post !
    Here’s another quick but slightly advanced Hello World example, that deals with how to display some scrolling text on the watch itself:
    http://trandi.wordpress.com/2011/09/03/ti-ez430-watch-unbox-hworld/

    Dan

  2. November 23, 2010 at 4:50 am

    Can you suggest a place where I can find examples of assembly language programs
    for the msp430, including assembler directives and header files. I’m familiar with machine languages and the assembly process, but I can find next to no documentation on the msp430 “flavor” of mspgcc assembler. What assembler coding styles are accepted? What other quirks, like colon or tab after a label, semicolon before a comment, and so forth? What assembler directives? What is a minimal set of header files?

    Even a single well-documented representative program would be extremely useful.

    Incidentally, I’m producing some professional-grade documentation for what I’m learning
    about the use of the mspgcc chain and mspdebug. Ask me if you are interested.

    Many thanks,

Leave a Reply

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