Jeffrey's Log

Archives | Subscribe


Running MSP430F5529 Launchpad using GNU/Linux

Published on: March 11, 2014

Share on      


I own an MSP430F5529 USB launchpad from Texas Instruments. Cheap in cost, this launchpad is a good resource for developing your USB applications. It has an open source onboard debugger eZ-FET lite.

For developing applications for MSP430, there is already a well maintained C toolchain(gcc-msp430) available. On an Ubuntu/Debian machine, you can install it using the below command

sudo apt-get install gcc-msp430 msp430-libc msp430mcu

For debugging purpose, I am using mspdebug. But I had some hard time in setting up this debugger on my GNU/Linux machine. Due to some driver issues, the default mspdebug package from Ubuntu repository didn’t work. To get it working, there are some extra packages provided by TI to be installed.

Another alternative was to get the pre-compiled mspdebug from Energia. Energia comes with all these issues solved. But if you want to try the hard way, refer this.

Below steps describe how to use mspdebug from Energia

1) Download Energia for GNU/Linux from http://energia.nu/download/

2) Extract the tgz file. I got a folder named energia-0101E0011. The number in the folder name might change for you depending on the energia version you are using.

3) Go into the folder energia-0101E0011/hardware/tools/msp430/bin/ using the cd command.

3) Copy libmsp430.so to /usr/lib/

4) Update the firmware of the debugger using sudo ./mspdebug tilib --allow-fw-update

5) Now you can run mspdebug using the following command sudo ./mspdebug tilib

If you were successful, you will get the mspdebug console

(mspdebug)

Now lets write a small code and see if we can flash it to the launchpad.

Save the below code as blink.c

#include <msp430.h>

main()
{
  unsigned int i = 0;
  P1DIR = 1;

  while(1)
  {
    P1OUT = 1;
    for (i=0; i < 65535; i++);
    P1OUT = 0;
    for (i=0; i < 65535; i++);
  }
}

Lets compile this software using the below command

msp430-gcc -mmcu=msp430f5529 -mdisable-watchdog blink.c

We need to flash the output of the above compilation to the launchpad. Launch mspdebug using sudo ./mspdebug tilib. Then run

(mspdebug) prog a.out

Note: Since mspdebug is inside the energia folder and this blink.c file is at another location, when using the prog command in mspdebug, you have to give the path to the a.out file i.e

(mspdebug) prog /path/to/the/file/a.out

Now the LED on the launchpad will start to blink!

MSP430F5529 blinking LED


Comments

Comments can be emailed or tweeted to me. I would like to hear them and will try to reply.


Made using Jekyll, Twitter Bootstrap, Code Prettify and Font Awesome.

Copyright (C) 2008 - 2021 Jeffrey.