Categories
electrónica

MSP430 LaunchPad in Ubuntu

There are a few sites with info about how to use the TI’s Launchpad platform in linux, but none of them worked for me, but mixing them I’ve got a functional development enviroment in my ubuntu box.

These are the steps I’ve done to compile and burn program into the microcontroller:

  1. Install required packages:

    sudo aptitude install git-core gcc-4.4 texinfo patch libncurses5-dev zlibc zlib1g-dev libx11-dev libusb-dev libreadline6-dev

  2. Download and compile mspgcc:

    git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4
    cd mspgcc4
    sudo sh buildgcc.sh

    Press enter to use the default answers when the scripts ask you. Only write yes when it ask “Do you want to start build right now? (y/n) [n] ” because the default is no.

  3. Download and compile mspdebug:

    wget -O mspdebug.tar.gz http://sourceforge.net/projects/mspdebug/files/latest
    tar -zxvf mspdebug.tar.gz
    cd mspdebug
    make
    sudo make install

  4. Create a udev rule to be able to use the usb debug shield

    sudo nano /etc/udev/rules.d/46-TI_launchpad.rules

    Now paste inside the following rule:

    ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0660", GROUP="plugdev"
    

    Restart the udev service:

    sudo restart udev

  5. Create a file named led.c and paste the following:
    /* Blink LED example */
    
    #include <msp430g2231.h>
    
    /** Delay function. **/
    delay(unsigned int d) {
      int i;
      for (i = 0; i<d; i++) {
        nop();
      }
    }
    
    int main(void) {
      WDTCTL = WDTPW | WDTHOLD;
      P1DIR = 0xFF;
      P1OUT = 0x01;
    
      for (;;) {
        P1OUT = ~P1OUT;
        delay(0x4fff);
      }
    }
    

    The include is wrong, but will do the trick for the example.

  6. Compile the source code and create de elf file data to be uploaded to the chip:

    /opt/msp430-gcc-4.4.5/bin/msp430-gcc -Os -mmcu=msp430x2231 -o led.elf led.c

  7. Connect the platform to the pc and upload the program to chip:

    mspdebug rf2500
    prog led.elf
    run

  8. Now you have to see red and green lights blinking alternatively. Let’s try to do your own changes to the code and create awesome projects!

Sources: hackaday.com and mylightswitch.

Updated 18/11/2010: thanks to hvontres I’ve changed the retrieval of th mspgcc4 code and now it download the latest version from git. Indeed it has support for the microcontrollers that come with the Launchpad, so I also changed the sample code to include the correct header and the compilation command.
Updated 28/05/2011: thanks to Andrew I’ve changed the mspdebug download link to always download the latest release.

56 replies on “MSP430 LaunchPad in Ubuntu”

@sucotronic,
OK, thank, that’s cool.

Another (very similar) question. Are you familiar with eclipse, more with CCS5 (Code Composer Studio)?
It is an IDE, provided by TI which works with an eclipse installation. As I know it has already the MSP430-GCC compiler in the toolchain.

I have it installed twice. One time under Windows, one time under Linux on the same machine. I can run and debug it under Windows without any problem. But my preferred system is Linux (LinuxMINT and Ubuntu). I can use and run CCS under Linux but when I what to debug an error appears as follows:
___
Error initializing emulator:
No USB FET was found
___
I skipped the part with the MSP430-GCC and carried on with the other points of your instruction which worked, but the problem is still the same.

Even MSPDEBUG cannot find any device and I don’t no why.

Do you have any hint for me?

Thank you
Fabian

Hi guys, thanks for the tutorial it works for me, everything awesome.
BUTTTTTTTTT:
Anybody managed to get the VCP working in Ubuntu 12.04 to get UART chars from the board??
It works on older kernels, Windows and even on my OSX I managed it.
But in Ubuntu 12.04 I always get I/O errors… are the usb-chip drivers not fit for kernel 3.2?

sudo cat /dev/ttyACM0
cat: /dev/ttyACM0: Input/output error

minicom gives
minicom: cannot open /dev/ttyACM0: No such file or directory

screen is more or less the same…

anybody managed to get it running?
thanks!

@lexi, sorry, currently I don’t have any machine with ubuntu 12.04 to try it; what I only can say is that in 10.04 it’s possible to get characters through ACM0

Leave a Reply

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