MSP430 - Setting Up LaunchPad Development Board with Ubuntu 16.10

Following up on previous post on MSP430 LaunchPad development kit. We'll proceed with setting the console-based development environment for MSP430 in Ubuntu 16.10. Once this is have been done, we will look into how to interact with MSP430 through MSPDebug via USB interface.

First, find all relevant packages for MSP430.
$ apt-cache search msp430
binutils-msp430 - Binary utilities supporting TI's MSP430 targets
gcc-msp430 - GNU C compiler (cross compiler for MSP430)
gdb-msp430 - The GNU debugger for MSP430
msp430-libc - Standard C library for TI MSP430 development
msp430mcu - Spec files, headers and linker scripts for TI's MSP430 targets
mspdebug - debugging tool for MSP430 microcontrollers

However, notice that the GNU toolchain for MSP430 in the repository is still using the old GCC version of 4.6.3. A newer version of the 5.x toolchain (maintained separately by different vendor) exists but you'll need to install it manually.
$ dpkg -L gcc-msp430 | grep bin | grep gcc-

Install all these packages.
$ apt-cache search msp430 | awk '{print $1}' | xargs sudo apt-get install -y -

Open your console and run `dmesg` command in tail mode.
$ dmesg -w

Plug in and power up the LaunchPad to your USB port. By default, MSP430G2553 will have a demo temperature measurement app installed. Once you've connected through USB, there still be a sequence of LED blinking between red and green color. To stop that, please the P1.3 button to start the Temperature Measurement mode (I've no idea what this, just follow the Quick Guide).

Output of `dmesg` as follows. Note I've removed the serial number for privacy reason.
[ 2407.555756] usb 2-1.2: new full-speed USB device number 6 using ehci-pci
[ 2407.687908] usb 2-1.2: New USB device found, idVendor=0451, idProduct=f432
[ 2407.687913] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2407.687917] usb 2-1.2: Product: Texas Instruments MSP-FET430UIF
[ 2407.687920] usb 2-1.2: Manufacturer: Texas Instruments
[ 2407.687922] usb 2-1.2: SerialNumber: 
[ 2407.695830] cdc_acm 2-1.2:1.0: No union descriptor, testing for castrated device
[ 2407.695858] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[ 2417.806759] hid-generic 0003:0451:F432.0004: usb_submit_urb(ctrl) failed: -1
[ 2417.806843] hid-generic 0003:0451:F432.0004: timeout initializing reports
[ 2417.807991] hid-generic 0003:0451:F432.0004: hiddev0,hidraw0: USB HID v1.01
Device [Texas Instruments Texas Instruments MSP-FET430UIF] on

The device, MSP-FET430UIF, is an external USB hardware debugging device but I'm not sure why the embedded USB interface was using the same serial number. Maybe it's using the same chipset? Also, you can probably ignore the error message in the log as we can connect to the board without issue.

You can also check the device id using `lsusb` command.
$ lsusb | grep Tool
Bus 002 Device 009: ID 0451:f432 Texas Instruments, Inc. eZ430 Development Tool

# More verbose details
$ lsusb -v -d 0451:f432

To connect to the board through the USB interface and MSPDebug program. Run this command and observe that the blinking LEDs have stop. Why we use `rf2500` driver? Turn out that the MSPDebug tool was originally written for EZ430-RF2500. The drive name was confirmed by showing the list of USB devices through MSPDebug. Again, serial number was removed for privacy concern. The bus:device number (002:011) may be different every time you plug in the USB cable.
$ mspdebug --usb-list | grep 2500
    002:011 0451:f432 eZ430-RF2500 [serial: ]

There are several ways to connect to MSP430. First way should be sufficient enough.
$ mspdebug rf2500

# Using bus:device id
$ mspdebug -U 002:011 rf2500

If there are no other errors, you should see below results.
MSPDebug version 0.22 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2013 Daniel Beer 
This is free software; see the source for copying conditions.  There is NO

Trying to open interface 1 on 007
rf2500: warning: can't detach kernel driver: No data available
Initializing FET...
FET protocol version is 30394216
Set Vcc: 3000 mV
Configured for Spy-Bi-Wire
fet: FET returned error code 4 (Could not find device or device not supported)
fet: command C_IDENT1 failed
Using Olimex identification procedure
Device ID: 0x2553
  Code start address: 0xc000
  Code size         : 16384 byte = 16 kb
  RAM  start address: 0x200
  RAM  end   address: 0x3ff
  RAM  size         : 512 byte = 0 kb
Device: MSP430G2xx3
Number of breakpoints: 2
fet: FET returned NAK
warning: device does not support power profiling
Chip ID data: 25 53

Available commands:
    =           erase       isearch     power       save_raw    simio       
    alias       exit        load        prog        set         step        
    break       fill        load_raw    read        setbreak    sym         
    cgraph      gdb         md          regs        setwatch    verify      
    delbreak    help        mw          reset       setwatch_r  verify_raw  
    dis         hexout      opt         run         setwatch_w  

Available options:
    color                       gdb_loop                    
    enable_bsl_access           gdbc_xfer_size              
    enable_locked_flash_access  iradix                      
    fet_block_size              quiet                       

Type "help " for more information.
Use the "opt" command ("help opt") to set options.
Press Ctrl+D to quit.

When you first execute the MSPDebug program, the temperature measurement app in the MSP430 will halt and waiting for your next command. To resume its execution, just type `run` command and the LEDs will start blinking. (provided you don't activate Temperature Measurement mode).
(mspdebug) run
Running. Press Ctrl+C to interrupt...

More to come as we will explore more and different usage with MSPDebug.

No comments:

Post a Comment