« »

MSP430 LaunchPad in Ubuntu

November
15
member
sucotronic

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.


date Posted on: Monday, November 15, 2010 at 20:57 pm
Category electrónica.
Puedes seguir las respuestas de esta entrada a traves de l feed RSS 2.0.

Puedes dejar una respuesta, o trackback desde tu propio sitio.



56 Respuestas to “MSP430 LaunchPad in Ubuntu”

  1. Joel

    Thanks for this. I installed it using instructions on other sites but couldn’t get the C files compiled. Turns out I didn’t install mspgcc properly (used all ‘1’ rather than the defaults). Reading your post helped me realize 1 was the default for some :) Thanks.

    [Responder]

    sucotronic Reply:

    @Joel, I’m glad you find useful the post. Feel free to come back in the future to see example uses of the Launchpad.

    [Responder]

    Joel Reply:

    @sucotronic, I’m still getting compile errors on any Launchpad code I try to compile, including the LED example here. Here’s the error:

    led.c:12: error: ‘WDTCTL’ undeclared (first use in this function)
    led.c:12: error: (Each undeclared identifier is reported only once
    led.c:12: error: for each function it appears in.)
    led.c:12: error: ‘WDTPW’ undeclared (first use in this function)
    led.c:12: error: ‘WDTHOLD’ undeclared (first use in this function)
    led.c:13: error: ‘P1DIR’ undeclared (first use in this function)
    led.c:14: error: ‘P1OUT’ undeclared (first use in this function)

    Seems like I’m missing some kind of dependency. But I’m new to the C world so I’m having problems figuring it out. I have redone everything several times. I’ll try using the GIT repo. Do you have any other instructions?

    Thanks.

    [Responder]

    sucotronic Reply:

    @Joel, it seems the compiler isn’t finding the included header file. Try to do the step one again with the updated git repository and note that in the example code I’ve also changed the included file.

    November 18th, 2010 at 7:08 am
     
  2. hvontres

    Thanks for the instructions. I think the svn repo is no longer the main branch. This is the log entry for the last revision:
    “Add note that SVN is for WASP and general users should use Git.”

    So I think the correct checkout procedure would be to use the following command:

    git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4

    [Responder]

    sucotronic Reply:

    @hvontres, thanks for the tip, I’ve updated the post with the new way of retrieval the code, the included header in the example code and the compilation command. :D

    [Responder]

    November 18th, 2010 at 8:16 am
     
  3. Rob

    Thank you; this was a great help getting up and running with Launchpad on Linux!

    I found I have to run mspdebug rf2500 as a super-user or it comes up with errors:

    “Trying to open interface 1 on 003
    rf2500: warning: can’t detach kernel driver: Operation not permitted
    rf2500: can’t claim interface: Operation not permitted
    rf2500: failed to open RF2500 device”

    If I use “sudo mspdebug rf2500″, it works just fine.

    Best Regards,
    Rob

    [Responder]

    sucotronic Reply:

    @Rob, the step 3 should avoid you to execute the command with sudo :P

    [Responder]

    Niall Reply:

    @sucotronic, You may have the default rule overriding for /dev/ttyACM0, I found with my system (Ubuntu 10.10) I had to move the 46-TI_launchpad.rules suggested above to 56-TI_launchpad.rules in order for plugdev group to be assigned (otherwise dialout group applies, you could just join it instead and skip the specific rule altogether).

    … Niall

    [Responder]

    Bino Reply:

    @Niall, I tried “sudo mv /etc/udev/rules.d/46-TI_launchpad.rules /etc/udev/rules.d/56-TI_launchpad.rules” but it didn’t work, what do I have to do?

    Niall Reply:

    @Bino, I would have expected that command to work, are you in group plugdev ? What permissions and ownership are on the newly created device ? Try enabling debug on udev and watching what happens when you plugin the board.

    Bino Reply:

    @Niall, yes, I am in the plugdev group. How do I see the permissions and how do I enable debug on udev?
    Thanks for your help!

    Bino Reply:

    @Niall, damned double quotes! I’ve copied the code from the tutorial but the double quotes were of this type -> ” instead of this type -> “, so it didn’t work.
    Thanks for the help though! :D

    sucotronic Reply:

    @Niall, happy to see your problem solved :D

    December 31st, 2010 at 6:40 am
     
  4. gmm

    Hi sucotronic

    I was able to compile and program the g2231 but I have to keep using sudo mspdebug rf2500. Is this because the double quotes used in the udev rule? What should I change?

    TIA
    gmm

    [Responder]

    sucotronic Reply:

    @gmm, I’ve changed the style of that paragraph in order to do the copy&paste well. Try it now to see if it is solved.

    [Responder]

    February 27th, 2011 at 5:50 am
     
  5. gmm

    That worked for me! Thank you very much for your help!

    Regards
    gmm

    [Responder]

    February 27th, 2011 at 18:38 pm
     
  6. Eric (USA)

    Thanks for the information, everything works.

    I run mspdebug as a normal user, the mspdebug gives a error on the first try in finding the board. But then the program does a second try and finds it and works.

    I am running Mint 10 linux, based on Ubuntu.

    I compiled the led program, loaded it and run it…

    Thanks again for a great job….

    [Responder]

    sucotronic Reply:

    @Eric (USA), you’re welcome. I’m doing a small gui in python to help coding for msp430, so keep in touch for new articles about this device and linux :)

    [Responder]

    March 5th, 2011 at 19:57 pm
     
  7. Ritesh Mehta

    @sucotronic, you rock, worked perfectly ! Thank you ! I am going to post it on my blog, of course with your reference only.

    [Responder]

    sucotronic Reply:

    @Ritesh Mehta, you’re welcome. Be free to copy whatever you need and put bactrack link in your post :)

    [Responder]

    April 23rd, 2011 at 17:46 pm
     
  8. MSP-EXP430G2 LaunchPad Board in Kubuntu « RitzZ's Blog

    […] module but without any success. Then I tried to follow all of the instruction I found on this page and boom ! It worked perfectly. I am so thankful to the […]

    April 23rd, 2011 at 18:14 pm
     
  9. Luis
     
  10. TI launchpad | Synapse
     
  11. Andrew

    Worked like a charm on Ubuntu 10.04, thanks for the article! I used mspdebug version 0.15 without a hitch too.

    [Responder]

    sucotronic Reply:

    @Andrew, you’re welcome. I’ve changed the download link in order to download always the latest mspdebug release.

    [Responder]

    May 27th, 2011 at 20:00 pm
     
  12. nebulous

    Thanks, this worked perfectly. Much more concise than some of the other instructions around the net.

    [Responder]

    sucotronic Reply:

    @nebulous, glad to help you :D

    [Responder]

    June 23rd, 2011 at 13:44 pm
     
  13. arvindh

    Hi i’have been trying to run it through linux from past a month, and till now i couldn’t. after all “make” process when i enter the compiling line i get an error,..

    $ /opt/msp430-gcc-4.4.5/bin/msp430-gcc -Os -mmcu=msp430x2231 -o led.elf led.c
    bash: /opt/msp430-gcc-4.4.5/bin/msp430-gcc: No such file or directory

    while i navigated into the /opt/msp430-gcc-4.4.5 folder i found it empty,.!! can any one please help me,..

    [Responder]

    September 6th, 2011 at 15:16 pm
     
  14. arvindh

    im in a real urgent, coze im using this for my project work so i put my outputs that i faced while installing them,..
    here goes my terminal window’s output while compiling mspgcc and mspdbug,. (command line output in pastebin)

    PS: I’ve edited this comment to move the code to pastebin instead of storing it in a comment.

    [Responder]

    sucotronic Reply:

    @arvindh, according to the output of the scritp, it seems that it is unable to download the binutils source tar file. You can modify it in order to download a file named binutils-2.21.1.tar.bz2 instead of the binutils-2.21.tar.bz2 of your actual script.

    [Responder]

    arvindh Reply:

    @sucotronic, Thanks a lot for responding immediately,..

    im a new to linux, so tell me this, can i download that file separately and compile it,.??

    [Responder]

    arvindh Reply:

    @sucotronic,
    hi man, im sorry if i disturb you quite often, but still after running that particular binutils-2.21.1.tar.bz2 file im getting error,. that is after the “make” command,.
    here goes the output,.

    http://pastebin.com/xc29UBqU

    [Responder]

    arvindh Reply:

    @arvindh, And the make error i get is
    “make[1]: *** [configure-intl] Error 1″ and after a small search i could get the internal happening of it by executing the command

    $ make configure-intl SHELL=/bin/sh\ -x
    the output is here,.. http://pastebin.com/kiYzDUtg

    arvindh Reply:

    @sucotronic,
    Hey, i finally found it,.. the pointing link was different, so i tracked down to the binutils-2.21 file.

    i hope the following link might be useful for new installers
    http://wiki.zolertia.com/wiki/index.php/Mainpage:Contiki_installation_Ubuntu

    [Responder]

    sucotronic Reply:

    @arvindh, nice to know you finally got it :) I’m preparing also an article about using the new toolchain (as mentioned in the url you posted) for new msp430 development.

    yamaplos Reply:

    @arvindh, You are the man, @arvindh, this thing went nowhere until I got that final link, http://wiki.zolertia.com/wiki/index.php/Mainpage:Contiki_installation_Ubuntu

    @Sucotronic, you know, the official TI Launchpad points to this page, but the instructions did not work in my Natty – yet without your page I’d be nowhere. ¡Gracias, compañero!
    http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_%28MSP-EXP430G2%29#Linux_Support

    September 6th, 2011 at 18:06 pm
     
  15. arvindh

    Hey dude, im getting a new kind of error now,..
    and this time its happening during burning the program into the IC.
    its saying,..

    (mspdebug) prog bright.c
    binfile: this format contains no code
    (mspdebug)

    [Responder]

    sucotronic Reply:

    @arvindh, you cannot program directly a .c program with mspdebug, you’ve first to compile it.

    [Responder]

    arvindh Reply:

    @sucotronic, Yeah got that.
    Thanks a LOT ,.. :)

    [Responder]

    yamaplos Reply:

    @arvindh, see point 5 in the instructions above “Compile the source code and create de elf file data to be uploaded to the chip:”

    September 9th, 2011 at 9:17 am
     
  16. Andy Piper

    I can’t get this to work on Ubuntu 11.04 – binutils version has changed, edited scripts to get a “good” one, patching then failed… gave up and grabbed a binary msp430 gcc from another link in the comments, can compile basic code but nothing which sources msp430* header files. Bit of a mess :-(

    [Responder]

    sucotronic Reply:

    @Andy Piper, I’ve not checked it by myself, but you can take a look at the following guide about installing uniarch and use it with the launchpad: https://github.com/sergiocampama/Launchpad

    [Responder]

    arvindh Reply:

    @Andy Piper, hey Andy,..

    i first was using ubuntu 11.04, and messed things like any thing. there were too many dependency errors with the kernel version and the binutils,..
    for some reason i shifted back to 10.04,.. and lately try’d it. with some little dep,. errors i was able to get it right,..

    but, do search a lot, coze i’ve came across people those who have made it work on both 11.04 & .10,…

    Good Luck m/

    [Responder]

    November 30th, 2011 at 20:21 pm
     
  17. yamaplos

    te cuento que el link a unikl.de da un 404… :-(

    gracias, mi tercer intento con los dichosos 430…

    Do you want to start build right now? (y/n) [n] y
    Running sh do-binutils.sh “/opt/msp430-gcc-4.4.5″ “2.21” “http://ftp.uni-kl.de” “build”
    –2012-02-07 11:06:07– http://ftp.uni-kl.de/pub/gnu/binutils/binutils-2.21.tar.bz2
    Resolving http://ftp.uni-kl.de... 131.246.123.4, 2001:638:208:ef1b:0:ff:fe00:4
    Connecting to http://ftp.uni-kl.de|131.246.123.4|:80… connected.
    HTTP request sent, awaiting response… 404 Not Found
    2012-02-07 11:06:09 ERROR 404: Not Found.

    [Responder]

    sucotronic Reply:

    @yamaplos, prueba a editar el script y poner en su lugar: binutils-2.22.tar.bz2

    [Responder]

    yamaplos Reply:

    @sucotronic, ¡Gracias! te cuento que haciendo trampa, bajando el tarbal de zucotronic (link en el comentario a arvindh), la cosa marcha, y ya tengo mi 430 flasheando feliz. Antes de la noche: codiguear mi controlador de step-motor.

    MUY feliz. AHora, ni idea si la cosa funcionó gracias a la montaña de código que he bajado estos días – más bien, milagro que funcionó, a veces cuando uno intenta diversas recetas (y te cuento, traté VARIAS), se llega a romper el entramado del espacio-tiempo. Sería cosa de probar en un install fresco.

    Definitívamente más difícil que el Arduino, pero por el precio, vale la pena!

    Gracias de nuevo

    [Responder]

    February 7th, 2012 at 18:10 pm
     
  18. Launchpad on Ubuntu – Setup « blahblahcoolstuffblah

    […] some blog provide a step by step guide for the basic steps. I followed the steps listed in the Hackaday […]

    April 8th, 2012 at 10:10 am
     
  19. BrEin

    Hi,

    thank you for that introduction.
    Unfortunately the build of the MSP430-GCC aborts with errors:

    ______

    Do you want to start build right now? (y/n) [n] y
    Running sh do-binutils.sh “/opt/msp430-gcc-4.4.5″ “2.21” “http://ftp.uni-kl.de” “build”
    –2012-06-03 19:17:30– http://ftp.uni-kl.de/pub/gnu/binutils/binutils-2.21.tar.bz2
    Resolving http://ftp.uni-kl.de (ftp.uni-kl.de)… 131.246.123.4, 2001:638:208:ef1b:0:ff:fe00:4
    Connecting to http://ftp.uni-kl.de (ftp.uni-kl.de)|131.246.123.4|:80… connected.
    HTTP request sent, awaiting response… 404 Not Found
    2012-06-03 19:17:30 ERROR 404: Not Found.

    sh do-binutils.sh “/opt/msp430-gcc-4.4.5″ “2.21” “http://ftp.uni-kl.de” “build” exited with status code 8.
    Failed to execute sh do-binutils.sh “/opt/msp430-gcc-4.4.5″ “2.21” “http://ftp.uni-kl.de” “build” at ./buildgcc.pl line 248, line 9.
    ______

    Du you have any clue why?

    [Responder]

    sucotronic Reply:

    @BrEin, right now I cannot check it and help you sorry. But I’m preparing a new article about compiling code using uniarch new toolchain.

    [Responder]

    BrEin Reply:

    @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

    [Responder]

    June 3rd, 2012 at 18:26 pm
     
  20. Cross-Compiling for TI MSP430 Launchpad | MitchTech

    […] by this […]

    June 23rd, 2012 at 14:03 pm
     
  21. MSP-GCC 编译器安装与使用小记 « andy的linux小屋

    […] MSP430 LaunchPad in Ubuntu MSP430 LaunchPad on Linux […]

    July 19th, 2012 at 12:55 pm
     
  22. lexi

    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!

    [Responder]

    sucotronic Reply:

    @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

    [Responder]

    August 15th, 2012 at 12:37 pm
     
  23. CoffeeBreak Tutorial #1 : Setting up Ubuntu 12.04LTS 64bit to say hi to MSP430 | Indian Tinker

    […] Sometimes you may also need to add a udev rule so that the system can identify the msp430 launchpad.Follow this […]

    February 17th, 2014 at 15:50 pm
     

Escribe un comentario


a trastear un poco is powered by WordPress
Theme is Coded&Designed by Wordpress Themes at ricdes