2019-03-24T22:58:10

MSP-EXP430G2ET && Debian Linux

Notes about getting MSP-EXP430G2ET programmed from Debian Linux. Long story short → upgrade the board firmware with Code Composer Studio under Windows first, then the mspdebug v0.25 (from GitHub) worked just fine.

`apt-get install gcc-msp430 msp430-libc msp430mcu mspdebug`

Followed the few steps of Building libmsp430.so on Linux. Had to also `apt-get install libusb-dev libreadline-dev`. Then took the blink test code:

#include <msp430.h>

void delay( unsigned int delay ) {
    unsigned int i;
    for ( i = 0; i < delay; i++) asm("nop");
}

int main() {
    WDTCTL = WDTPW + WDTHOLD;       // Stop WDT     
    P1DIR |= BIT0;

    while(1) {
            P1OUT ^= BIT0;
            delay( 50000 );
    }
    return 0;
}

Compiled and uploaded:

$ msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -c main.c \
    && msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -o main.elf main.o \
    && mspdebug tilib erase 'load main.elf' exit
MSPDebug version 0.22 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2013 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
Found FET: ttyACM0
MSP430_Initialize: ttyACM0
Firmware version is 4294967295
MSP430_VCC: 3000 mV
MSP430_OpenDevice
MSP430_GetFoundDevice
Device:  (id = 0x0000)
0 breakpoints available
MSP430_EEM_Init
Chip ID data: 05 00 55
Erasing...
Writing  112 bytes at c000 [section: .text]...
Writing   32 bytes at ffe0 [section: .vectors]...
Done, 144 bytes total
MSP430_Run
MSP430_Close

Despite successfully looking output nothing happened to the board, no change. Googled around forums and found only one report of such a behaviour → unresolved.

Re-read the "Building libmsp430.so on Linux" and noticed the last sentence there "Be sure to use a recent release of mspdebug". So I've clonet the mspdebug and tried the current master (d59fb64ac20e31c207c02e33b58d5e297c18e27b). It insisted on upgrading the firmware and then ended up with the same error over and over. Board did not blink with the pre-programmed code as before, so "something" happened:

$ ./mspdebug tilib --allow-fw-update
MSPDebug version 0.25 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2017 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.13.0.601 Copyright (C) 2013 TI, Inc.

Using new (SLAC460L+) API
MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
Found FET: ttyACM0
MSP430_Initialize: ttyACM0
FET firmware update is required.
Starting firmware update (this may take some time)...
Initializing bootloader...
Programming new firmware...
    16 percent done
    33 percent done
    33 percent done
    50 percent done
   100 percent done
tilib: MSP430_FET_FwUpdate: MSP-FET / eZ-FET core(communication layer) update failed (error = 74)
tilib: device initialization failed

$ ./mspdebug tilib --allow-fw-update
MSPDebug version 0.25 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2017 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.13.0.601 Copyright (C) 2013 TI, Inc.

Using new (SLAC460L+) API
MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
Found FET: HID_FET
MSP430_Initialize: HID_FET
FET firmware update is required.
Starting firmware update (this may take some time)...
tilib: MSP430_FET_FwUpdate: MSP-FET / eZ-FET recovery failed (error = 73)
tilib: device initialization failed

And so on over and over, board obviously "dead". So turned to the "official" way → installed Code Composer Studio. One of the installation steps informed me about unsupported boards, MSP-EXP430G2ET being one of them:

Anyway I've tried ;-) and indeed it reported firmware recovery needs and failed → so well yes it's unsupported under Linux.

Next try was to plug it to Windows installation under kvm virtualisation and try. Had to add `… -usb -usbdevice 2047:0203` to get the usb device present inside the virtual machine. Windows version of Code Composer did not complain, performed the firmware upgrade first time and then failed. It turned out that the USB device ID changed to 2047:0013. After making that one available to windows, there was a second firmware upgrade and afterwards the board was loaded with example blink software.

Since then the Linux mspdebug version 0.25 was able to flash the code:

msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -c main.c
msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -o main.elf main.o
mspdebug tilib erase 'load main.elf' exit
MSPDebug version 0.25 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2017 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.13.0.601 Copyright (C) 2013 TI, Inc.

Using new (SLAC460L+) API
MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
Found FET: ttyACM0
MSP430_Initialize: ttyACM0
Firmware version is 31300601
MSP430_VCC: 3000 mV
MSP430_OpenDevice
MSP430_GetFoundDevice
Device: MSP430G2xx3 (id = 0x0067)
2 breakpoints available
MSP430_EEM_Init
Chip ID data:
  ver_id:         5325
  ver_sub_id:     0000
  revision:       20
  fab:            a0
  self:           0000
  config:         00
  fuses:          00
Device: MSP430G2xx3
Erasing...
Writing  112 bytes at c000 [section: .text]...
Writing   32 bytes at ffe0 [section: .vectors]...
Done, 144 bytes total
MSP430_Run
MSP430_Close