TI LaunchBread



description

this is a tryout project based on the ti MSP430G2211. the project objective is to gain understanding on the basic io of this new mcu, tries out the toolchain under linux, etc.

the launchpad i got looks like this.


TI launchpad info link here

i acquired a ti lauchpad one week after it was launched. since i work solely on a linux environment, it is natural to try and make it work under linix. unfortunately the launchpad has a different UIF firmware and mspdebug has not yet to support it (as of july 7th). after combing through the datasheets it appears the mcu is very close to the F2013, in that they appears to share the same memory map and register layouts.

after visiting the losinggeneration site and trying, i realized that the launchpad had been working right out of the box with mspdebug all along, i was not able to get it working was due to usb driver problems. still after connecting the launchpad, i can only run one mspdebug session. if i want to connect again i need to detach / re-attach launchpad. but the flash uploading, debugging via sbw all works fine now.

so i did the natural thing and create this "launchbread" (like breadboard arduino / breaduino) and use the ez430 usb dongle for programming and debuging.

in this setup i assembly the project w/ the extra G2211 mcu from the launchpad kit, i tried the G2231 and it works as well.

the ez430 doggle i got has the 4-pin 0.05in pitch connector and from studying the schematics we have;

pin1 as VCC, (header P1)
pin2 as SBWCLK, (header P11)
pin3 as SBWTDIO, (header P10) RST
pin4 as GND, (header P14)

we can directly hook this up on a breadboard setting. as the 0.05in pitched headers are hard to find, i sacrificed daughter F2012 board (3 for $10, i prey away the mcu and added 0.1in headers) so that i can have a solid 0.1in header connection. the provided header on the F2012 board has pin layout exactly as the targe G2xx device

the following shows an original F2012 daughter board and the one that had the MCU ripped off with 2x7 male header installed.


the whole hookup look like this with the EZ430-FET and jumper wires;


TI EZ430-F2013 info link here


toolchain setup

my environment is ubuntu 10.04 lucid. we will need msp430-gcc4 and mspdebug. there is already a tutorial covering this which i had followed and worked well. the mylightswitch.com tutorial can be found here


mspdebug session

with the header / jumpers ready, i fired up mspdebug and got the followng;

chrisc@t61:~/ti/ez430/rgb> mspdebug -d /dev/ttyUSB0 uif
MSPDebug version 0.9 - debugging tool for MSP430 MCUs
Copyright (C) 2009, 2010 Daniel Beer <daniel@tortek.co.nz>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Trying to open UIF on /dev/ttyUSB0...
Initializing FET...
FET protocol version is 10000000
Configured for Spy-Bi-Wire
Set Vcc: 3000 mV
Device: MSP430F20x1
Code memory starts at 0xf800

so afterall it is recognized as a MSP430F20x1 device. but does it programs? i then wrote a simple sketch (source code below) to try out basic ios and the timer. programming worked fine, step worked, run worked.

mspdebug -d /dev/ttyUSB0 uif "prog $PRG.elf"
.
.
.
Erasing...
Writing 128 bytes to f800...
Writing 128 bytes to f880...
Writing  48 bytes to f900...
Writing  32 bytes to ffe0...

(mspdebug) step
    ( PC: f804)  ( R4: 0ddf)  ( R8: 2fff)  (R12: 0005)  
    ( SP: 0280)  ( R5: ffde)  ( R9: 3f7f)  (R13: ffdf)  
    ( SR: 0000)  ( R6: f7fb)  (R10: 3efb)  (R14: 0001)  
    ( R3: 0000)  ( R7: fbf9)  (R11: efff)  (R15: 0000)  
    f804: b2 40 80 5a 20 01   MOV     #0x5a80,         &0x0120
    f80a: 3f 40 00 00         CLR     R15
    f80e: 0f 93               TST     R15
    f810: 05 24               JZ      0xf81c
    f812: 2f 83               DECD    R15
(mspdebug) run
Running. Press Ctrl+C to interrupt...



rgb led source

  • use timer to implement software pwm @ 25% duty (save resistors)
  • layout button and led so that i don't need jumpers (save jumpers)
  • press button to cycle thru the rgb combinations (8 of them)
  • compensate individual color led brightness by turning them off at different rates (doesn't seem to work)

//******************************************************************************
//  MSP430F20xx Demo - RGB LED
//
//  Description; RGB LED via P1.0-3, Tactile Button via P2.7
//  ACLK = n/a, MCLK = SMCLK = default DCO
//
//                MSP430F20xx
//             -----------------
//         /|\|              XIN|-
//          | |                 |
//          --|RST          P2.7|-->Button-->Gnd
//            |                 |
//            |             P1.0|-->LED-G
//            |             P1.1|-->LED-B
//            |             P1.2|-->LED-Common
//            |             P1.3|-->LED-R
//
//  CChung
//  Giftware, no license, no warranty
//  July 2010
//  Built with msp430-gcc, flash via mspdebug
//******************************************************************************

#include "signal.h"
#include  <msp430x20x3.h>

volatile unsigned int clicks=0;
volatile unsigned int ticks=0;
volatile unsigned int outp=0x00;

void main(void) {
    WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
    P1DIR |= 0x0f;                            // P1.0 output
    CCTL0 = CCIE;                             // CCR0 interrupt enabled
    CCR0 = 100;
    TACTL = TASSEL_2 + MC_1;                  // SMCLK, upmode

    P2SEL = 0x00;
    P2REN = 0xc0;

    unsigned int rgb=0x00;
    unsigned int button=0;

    _BIS_SR(GIE);
    while (1) {
        if (P2IN&0x80) {
            if (button > 5) {        // button released
                rgb++;
                outp = ((rgb&0x04)<<1) | rgb&0x03;
            }//if
            button = 0;
        }//if
        else {
            button++;
        }//else
    }//while
}

// Timer A0 interrupt service routine
interrupt(TIMERA0_VECTOR) Timer_A(void) {
    clicks++;
    if (clicks&0x03) {
        P1OUT = 0x00;
    }//if
    else {
        unsigned int usep = outp;
        //_________ trying to compsensate for individual color brightness
        if ((usep&0x08)&&!(ticks%3))  usep &= ~0x08;
        if ((usep&0x02)&&!(ticks%9))  usep &= ~0x02;
        if ((usep&0x01)&&!(ticks%5))  usep &= ~0x01;
        P1OUT = usep;
        ticks++;
    }//else
}

the above sketch is built with

/opt/msp430-gcc-4.4.3/bin/msp430-gcc -Os -mmcu=msp430x2012 -o rgb.elf rgb.c

and uploaded with

mspdebug -d /dev/ttyUSB0 uif "prog rgb.elf"


breadboard layout


if you run it off battery, make sure your RST line is connected to VCC


schematic


note again the following pin mappings;
pin1 as VCC, (header P1)
pin2 as SBWCLK, (header P11)
pin3 as SBWTDIO, (header P10) RST
pin4 as GND, (header P14)



physical hookup


again, if you run it off battery, make sure your RST line is connected to VCC




troubleshooting

  • can't find any yet.


notes

if it as TI claims these devices costs < $0.50 per pop it would be a great general purpose hobby device. DIP packaging allows for low startup cost for entry level hobbyist. wipad shieldth mspdebug and msp430-gcc, it is fairly easy to start simple projects.

the MSP430GXX1s compares well with AVR tinys, the 16 bit architecture will simplify most applications and does not cost flash space. this is from my very limit exposure though. i had tried out a few projects on both AVRTiny2313 and the MSP430GXX1s that shared similar or same code base.

Comments