Kostas Antonakoglou

Blogging about personal, technological and musical adventures…

MSP430 (ez430) on Fedora

with 4 comments

For learning purposes I currently have on my hands a EZ430-F2013 Development Kit (We all should also use Arduino :) ). This kit comes with a CD containing proprietary software (an IDE) in order to program and debug the MSP430 microcontroller. So, I took the chance to run it on Fedora using Linux tools and a few resources on the internet. In this post I will write down how you can program and debug your ez430 using Fedora 13 and your terminal.

First, I plugged in the ez430 and opened a terminal (yes we will work only this way for now). Write down lsusb and hit enter. Then you should get some lines containing this one:

Bus 005 Device 003: ID 0451:f430 Texas Instruments, Inc. MSP-FET430UIF JTAG Tool

That means that by default your system recognises the device and you can actually communicate with it.

Next, we need our tools! Go to System ->Administration-> Add/Remove Software (or use yum install etc.). The software we need is (actually not sure if everything is needed):

  • latest version of gcc, texinfo, patch, ncurses5-dev, zlib, zlib-dev, libX11-dev, libusb-dev (not only libusb1-dev), libreadline6-dev, msp430-binutils, msp430-gcc, msp430-libc

and also : mspdebug (the program that actually does the work).To install it manually (in case there is an older version on the repository) download the .tar file create a  folder named “Programs” (in case you don’t have one) on your Home Folder.Then, extract the mspdebug folder there!

With your terminal (you can auto-complete the words in the directory using Tab on your keyboard) :

$ cd /home/(your user name on Fedora)/Programs/mspdebug-0.11

(now you are in the mspdebug folder with your terminal, the version 0.11 is the current one I use, yours can differ)

$ make (this will compile the program)

$ su -c “make install” (and give your root password to install it)

(the $ symbol is just to show that you are using different commands in the terminal, don’t copy it)

now you have installed mspdebug! Great!

If you are ready to use the MSP430 you should have a program already written. In case you don’t, get this example (modified by me to get it to compile) that flashes the internal LED of the device:

/* Blink LED example */
#include <msp430x20x3.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 = 0×01;   // THE x IS NOT Copy-Pasted CORRECTLY :)

for (;;) {
P1OUT = ~P1OUT;
delay(0x4fff);
}
}

Create a file named blink.c in a folder of your choice, copy this on the file and then cd on the folder. Now to compile it we need 3 lines (I also changed this to work):

$ msp430-gcc -Os -mmcu=msp430x2013 -o led.elf blink.c

$ msp430-objdump -DS led.elf > led.lst

$ msp430-objcopy -O ihex led.elf  led.hex

In order not to do this every single time, you need to run the program, you can create a Makefile based on the one in this site (it’s inside this zip file).

Next, to run mspdebug in order to flash the program into the MSP430, type :

$ mspdebug -d /dev/ttyUSB0 uif

(“/dev/ttyUSB0″ is of course the ez430 if you don’t have any other device and “uif” the parameter to run it with mspdebug, check the manual for more)

To flash the program you need to type : prog led.hex . Notice that it is a command to control mspdebug and not the terminal). If you push Control+D mspdebug will close, the ez430 will reset, start the program and also blinking the LED! :)

My resources were 3 posts in this site : http://bit.ly/deonNa I should also mention that I have installed all the Fedora Electronic Lab packages with: $ su -c “yum groupinstall “electronic-lab”

About these ads

Written by constanton

Οκτωβρίου 12, 2010 at 1:27 μμ

Αναρτήθηκε στις fedora, hardware, open source

Tagged with , , , ,

4 Σχόλια

Subscribe to comments with RSS.

  1. Μπράβο για την δημοσίευση! Όλα λειτουργούν τέλεια!

    Dimitris Dimas

    Νοεμβρίου 22, 2010 at 1:50 μμ

  2. Nice post (even if I can’t read the comments in greek ! :) )
    Here’s a quick and slightly advanced Hello World example, that deals with how to display some scrolling text on the watch itself:
    http://trandi.wordpress.com/2011/09/03/ti-ez430-watch-unbox-hworld/

    Dan

    trandi

    Σεπτεμβρίου 4, 2011 at 2:36 μμ


Υποβολή απάντησης

Εισάγετε τα παρακάτω στοιχεία ή επιλέξτε ένα εικονίδιο για να συνδεθείτε:

WordPress.com Logo

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό WordPress.com. Log Out / Αλλαγή )

Twitter picture

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό Twitter. Log Out / Αλλαγή )

Facebook photo

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό Facebook. Log Out / Αλλαγή )

Google+ photo

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό Google+. Log Out / Αλλαγή )

Σύνδεση με %s

Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: