How-to: Launchpad programming with Linux

posted Aug 11th 2010 1:00pm by
filed under: how-to, Microcontrollers

When TI released their Launchpad development board at the end of June it generated a lot of Buzz. Here’s a package that delivered a programmer, debugger, two microcontrollers, and some accessories for less than five bucks (including shipping). They even provided a choice of two software suites but only for users running Windows who don’t mind proprietary software. If you’re looking to go another way you should consider trying out the open source alternative MSPGCC. After the break we’ll take a look at getting the tool-chain up and running in a Linux environment.

We’ll be working with Ubuntu 10.04 Lucid Lynx. When the Launchpad is connected to USB it is identified and mounted to /dev/ttyACM0. It’s not immediately apparent how to use the device but fortunately it can be done. To talk to the hardware for programming and debugging we’ll need to use MSPDebugger. For compiling our code we’ll be using the MSPGCC open source compiler package.

Compiling and Installing MSPGCC

The first thing we’ll need to do is satisfy our build dependencies.

sudo apt-get install subversion gcc-4.4 texinfo patch \
libncurses5-dev zlibc zlib1g-dev libx11-dev libusb-dev \
libreadline6-dev

Now we’ll checkout the source code from the subversion repository:

svn checkout https://mspgcc4.svn.sourceforge.net/svnroot/mspgcc4

Next we enter the directory and start compiling:

cd mspgcc4
sudo sh buildgcc.sh

This will take some time so go read some posts and come back in 20-45 minutes.

To add the tools we just installed to the path, we need to edit the /etc/profile file:

sudo nano /etc/profile

Add this line to the end of the file (CTRL-X to exit once you’re done):

export PATH=${PATH}:/opt/msp430-gcc-4.4.3/bin

Now reload the profile you just edited for this to take effect:

source /etc/profile

Great, now you have the tools necessary to compile your C code into an .elf file that the microprocessor will understand. Next we’ll need a way to get that file onto the chip.

Compiling MSPDebug

We’ll use the MSPDebug instructions for downloading and compiling. First you need to go to the download page and get the latest version. We downloaded version 0.9 and will use that in the filename for the following commands. Now go to the directory where you saved that download and unpack the archive, compile, and install the package using the following set of commands:

tar xvfz mspdebug-0.9.tar.gz
cd mspdebug-0.9
make
sudo make install

That should take just a few seconds and it’s the last of the tools that we need. Next we can use our new software to connect with the device.

The code

It’s best to try out some proven code the first time around. Download our simple code package to test out the compiler and use the debugger for programming. This is much simpler than the temperature demo found on Ramblings and Broken Code be we are using their Makefile and once you’re comfortable with the process there’s a lot of great code examples in that package.

Unpack the code, open a terminal window, and navigate to the directory where the files are located. Compile the file by typing:

make

If that went well, great. If you get an error like “msp430-gcc: command not found” there’s something wrong with your path to the MSPGCC tools.

Connecting to the chip

MSPDebug is what we use to connect to the chip. The following command will most likely NOT work for you:

mspdebug rf2500

Spitting out the error message:

Trying to open interface 1 on 033
rf2500: warning: can't detach kernel driver: Operation not permitted
rf2500: can't claim interface: Operation not permitted
rf2500: failed to open RF2500 device

This is most likely caused by a permission problem. This will work if you add ‘sudo’ to the beginning but that’s not ideal. Let’s add a UDEV rule to take care of the Launchpad every time we plug it in. We need to create a rule file that has this line of code in it:

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

Use nano to open and edit this file. Press CTRL-X to exit when you’re finished, then reload UDEV:

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

sudo restart udev

*** If you need more help with this, take a look at our guide to writing udev rules ***

Unplug the Launchpad and plug it back in. Make sure you’re in the same directory as the ‘main.elf’ file created by the compiler earlier. Now give MSPDebug another try:

mspdebug rf2500

Now you will be greeted with the (mspdebug) prompt. It’s just a matter of programming the chip and running that program:

prog main.elf
run

Both LEDs will start blinking at about 1 Hz. Congratulations, you’ve compiled and loaded a program using open source tools.

A look into how the code works:

Let’s take a quick look into how this simple program works in an effort to get you comfortable with learning to code with MSPGCC. The keywords used in the code are defined in the include files from MSPGCC. You need to spend some time in the /opt/msp430-gcc-4.4.3/msp430/include/msp430 directory until you get used to the keywords. Once you get the hang of it you can probably guess new keywords based on what you read in the datasheets for the microprocessors.

Our code blinks two LEDs. Blinking means we need to use some method of tracking time. First let’s investigate the system clock:

Download a copy of the MSP430x2xx family datasheet (we’re using Rev. E) and follow along. This is a more useful document than the chip-specific datasheet as it lists the operating information for all of the peripherals.

Review the various system clock features in Section 5.1 paying attention to LFXT1CLK, VLOCLK, and ACLK. Next read Section 5.2 on page 289 which tells us that after power-up the system clock will be running at 1.1 MHz. If we used the system clock for timing we’re going to have trouble counting high enough with a 16-bit timer for a meaningful delay. Be we can use the auxiliary clock instead. The same page of the datasheet tells us that the ACLK is sourced from LFXT1CLK (an external crystal or clock source) but let’s change that. The VLOCLK can be used as a source for the auxiliary clock and it runs at 12 kHz, so 1-second timing is well within the range of a 16-bit counter. Let’s set up the clock source. Section 5.2.2 clearly tells us “VLOCLK source is selected by setting LFXT1Sx = 10 when XTS = 0.”. Now we just check the register description until we find that LFXT1S is set on register BCSCTL3 and then write code to implement this setting:

BCSCTL3 |= LFXT1S_2;

Next we want to set up an interrupt based on the auxiliary clock. In Section 12 you can read about TimerA. We’ll configure it to run in UP mode. On page 410 the configuration of the timer control register TACTL is covered. We need TASSELx to be set to use ACLK and MCx configured for UP mode. Notice that the settings for each portion of the register are listed in binary next to the description. We can use these to select the proper bits. Setting the MC bits to 1 (binary 01) and TASSEL bits to 1 (binary 01) with the following code:

TACTL |= TASSEL_1 | MC_1;

Now we must enable the capture/compare interrupt for TimerA compare/capture register 0:

TACCTL0 = CCIE;

Now we can start the timer by writing a value to it. Because we are using the internal very low oscillator at 12 kHz, we can count up to 11999 to keep track of about 1 second passing (0 is counted and that’s why we set the compare match for one cycle less than the clock speed):

TACCR0 = 12000;

And finally we enable global interrupts:

eint();

Now we just need some code in an Interrupt Service Routine that will toggle the LEDs:

interrupt(TIMERA0_VECTOR) TIMERA0_ISR(void) {
  LED_OUT ^= (LED0 + LED1);	//Toggle both LEDs
}

We pulled all of this together to make the example file. Take some to trying to understand what the datasheet is telling you. Although they can be confusing, everything you need to know is there.

Resources:



129 Responses to How-to: Launchpad programming with Linux

  • JMLB says:

    Still waiting for mine I ordered it 1 day after it came out and it was back ordered until September 13 at mouser

  • JMLB says:

    good article though

  • Russ Weeks says:

    Very cool! Thanks for the article.

  • BR says:

    Only 3 months of backorder so far. I hope to have it in september. I was looking at the other 430 offerings that TI has available with some interest.

  • iv_s says:

    I compiled mspgcc and mspdebug under Mac OS X.
    When I start ‘mspdebug rf2500′ I get:
    rf2500: can’t claim interface: Permission denied
    rf2500: failed to open RF2500 device
    and with ‘sudo’ the same.
    As far as I known – there is no udev on Mac, what should I do?

  • Stealth- says:

    Very nice, it looks like I’m going to buy one of these afterall :)

  • Spork says:

    Got 2/3 shipments of my orders, not sure what’s up with yours.

  • regomodo says:

    Still waiting for my that I ordered over a month ago (there was no warning about backorder/stock at the TI site).

    Bookmarking this page for when the damn things eventually turn up.

  • UltraMagnus says:

    great article, but I think it quite graphically illustrates why this thing is absolutely no arduino killer.

  • Osgeld says:

    I ordered mine the day after announcement, and have had it long enough that I actually cut it in 2 trying to make a useful jtag / usb serial converter (the 2 chips on the emulator part are far more interesting than the ones they give you)

    4.30$ yea if you want to fool with it (and I have a whole host of reasons to let this one pass)

    arduino killer? not that they ever really marketed it like that but where is the community, scattered, and that is #1 on the arduino list of pluses

  • K. Kiser says:

    This is great! I, like everyone else, am waiting on mine to ship. Hope it’s here before I’m shipped off!

  • hyte says:

    no gui, too much hassle for me. I’ve just refurbished an old xp computer to try this instead of the coridium board i like.

  • SAGE says:

    I bought 2 from mouser a few days after release and got them weeks ago

  • Brennan says:

    @UltraMagnus

    Who was saying it was going to be an Arduino killer? I thought the goal of the project was to get some low-cost TI uC development tools in our hands.

  • epooch says:

    @ iv_s:
    Mac OS X HID driver is probably loading the USB device. see the instructions for the codeless kext:
    the the bottom of the MSPDebug download page <http://mspdebug.sourceforge.net/download.html

  • WestfW says:

    There are new instructions for getting mspdebug to work on MacOSX at the mspdebug site ( http://mspdebug.sourceforge.net/download.html )
    (I’ve been busy!)
    (I’m not sure whether anyone had tried these with a LaunchPad yet. They were developed based on earlier similar msp430 tools.)

  • NatureTM says:

    I’ve used linux for a long time, but now only on my server. All the freedoms of linux sure come with a lot of limitations. I kept wanting to run programs that only worked with windows. Wine didn’t always cut it. It’s the same reason I don’t use a mac for my main computer. I’ll stick with TI’s code composer studio. It’s Eclipse based, and I’ve been enjoyed using its nice integrated debug environment.

  • Jkx says:

    Did you manage to have the serial port to work well ?

    On mine, the serial port works randomly on linux (fine on windows). I tested on two boards w/ the same result. I read MacOS users seems to have same issue too.

  • TC says:

    SWEET! Another thing I can use without needing to reboot into Windows! Woohoo!

  • GCL says:

    And why was Linux development instructions provided only for Ubuntu?

    There are others, specifically Slackware. It happens to be the oldest one out there.

  • Hitek146 says:

    Damn, now I wish I had ordered one of these while the $5 offer was still in effect. Or maybe it is still in effect. Off to search… :)

  • plaes says:

    Hrm.. another “How-to: lets do something with Linux”, but Linux is mentioned inside the article only once, stating how hard it is to do something there… And then continues on talking about Ubuntu ;)

    Guys, please edit these kind of articles like this: first, mention the software one needs to get things done on Linux (ie mspgcc and mspdebug) and then continue on with distribution specific packages.

    Thanks from the other Linux distribution user.

    And also: `sudo make install` is generally a no go: please use `configure –prefix=$HOME/foo && make` :S

  • nave.notnilc says:

    of course mspgcc doesn’t include a GUI, it’s a compiler. you can use any linux IDE with it.

    have a makefile :P http://pastebin.com/0FBBN1Cx

  • nave.notnilc says:

    oh, incidentally, anyone done any interesting stuff using the USB connection with one of these yet?

  • iv_s says:

    @ epooch, WestfW
    Thanks for info. Some changes, but still note working,
    After installing kernel extension I start mspdebug and it hangs on:
    Trying to open interface 1 on 003
    If I pull out LaunchPad I get:
    Initializing FET…
    rf2500: can’t send data: Result too large
    fet: open failed
    Any ideas?

  • Urza9814 says:

    I tried this back when I first got my Launchpad, but it never worked. I mean, it would seem to work, it would compile and download, but the code would never run. Instead I’m using CCS on Windows XP running on VirtualBox. Wish I could make it work on Linux, but something about it is screwy.

  • Osgeld says:

    the usb chip feeds another msp430 mcu above it, the problem is the 12mhz clock is connected to the smd 430, then piped out of that into one of the xtal pins on the usb chip

    so, you either have to reprogram the emulator MSP chip, the usb converter chip (which does irda and 485 too) or maybe both

    you cant cut n play, its usb serial mcu bit banger / emulator serial targer MSP

  • Osgeld says:

    replying to nave.notnilc btw :)

  • Drone says:

    A perfect example of why Linux hasn’t taken surpassed Windows. Until Linux has a framework for simply adding and removing pre-compiled binaries that works across most distributions, it will continue to languish. Don’t get me wrong, I like Linux and xBSD and use them in preference to Windows wherever possible. But just saying…

  • e02jr says:

    Sweet, now I might get my ass out of the wagon and actually try and use them… =o)

  • blocke says:

    I refuse to believe that these Launchpads actually exist.

    Ordered #2, still hasn’t shipped, mouser shows 11 weeks leadtime? Really?

    Even if TI got me interested in using their stuff knowing that I could never expect to get things in a reasonable timeframe kills it.

    I can go to Sparkfun and get any number of Arduino boards delivered in 3 days. Where can I get the Launchpad? Nowhere.

    /rant

  • Drone says:

    In my post above, “pre-compiled binaries” is probably a bit of a stretch, at least the compile process should be uniform across distributions and automated in a user-friendly add-remove program framework.

  • charper says:

    @Drone

    Every consumer-oriented linux distribution (Redhat, Fedora, Ubuntu, Debian, Caldora, just off the top of my head) has a nice graphical package manager.

    The package manager downloads, installs, and automatically updates pre-compiled binaries for almost everything you’d ever want. I’m pretty sure mspgcc is actually available in most distros.

    As a quick aside, I think it’s actually a place where linux has completely obliterated windows in functionality. There’s one central program that manages updates for everything you install, OS, drivers, and applications.

  • vinito says:

    Orrrrr….
    you can do what I did and just kludge together an old PC to run Windows so I can do my micro stuff.
    TI is just like everybody else (AVR, PIC, etc.) in that they certainly aim it at Windows, unfortunately. I do Linux on everything but micro stuff, and use the old frankenPC with Winblows XP just for my micro stuff.

    Good to know this article is here though. I will try the steps someday and see how it works.

    BTW, last I heard even TI’s packaged Windoze thing isn’t that easy to deal with (haven’t tried it yet). So yea, not quite an Arduino competitor. But it is pretty cool for the money.

  • JoSSte says:

    I received my board weeks ago but haven’t taken the time to set it up yet. I use Ubuntu for my µC work – so I’ll definitely be reading this article thoroughly some time in the future.

  • errol says:

    Why is it that every time I touch something that has “mspgcc” & “Ubuntu” on it, it breaks?
    First it was version 3.2.3, (never did get that going) now 4.4!

    ~$ sudo apt-get install subversion gcc-4.4 texinfo patch \
    > libncurses5-dev zlibc zlib1g-dev libx11-dev libusb-dev \
    > libreadline6-dev
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Couldn’t find package gcc-4.4

    (I’m beginning to think I should go dig holes or something)

    So, where is gcc-4.4 ?

  • Rogan says:

    Nice article. Thanks.

    And to the hater who wants it done generically, so that Slackware user can follow along, surely you Slackware users can figure it out for yourselves?

  • ftorama says:

    I ordered mine at the beginning of July. I called last week and learnt they hat 6000 orders that were not delivered yet and that I was in rank 5000 to receive one.

    I definitely don’t wait for it anymore. Hopefully, i didn’t really needed it but wanted to test.

    Perhaps I’ll find it under the Christmas tree.

    Anyway, it’s not very serious from such a big company not to be able to deliver 6000 pieces.

  • yo9gjx says:

    good article and tutorial, thank you

  • fartface says:

    With all the Duino’ love here why not a Arduino linux howto? Get the n00bs up to speed using a real OS for dev work.

  • garhol says:

    Nice article and useful information. Ta

  • matt says:

    Boommarking, thanks for reminding me that my first day order is still on backorder.

    Not an arduino killer, but hopefully a solution to the arduino overkill. Somethings really don’t need to be running on a sanguino.

  • Mad sientist says:

    @ ftorama 6000 orders does not mean 6000 pieces many people ordered two or three so at least 12000 pieces

  • osgeld says:

    “Not an arduino killer, but hopefully a solution to the arduino overkill. Somethings really don’t need to be running on a sanguino.”

    you know these things are more powerful than the arduino lineup right?

  • nave.notnilc says:

    you don’t need an arduino tutorial, you just download and install a .deb and the IDE shows up in your menu, or you can use a ppa, it’s really easy.

  • WestfW says:

    BTW; my launchpad is still backordered (from early July), but my MSP430g samples arrived in 5 days… (now, to put together that PCB.)

  • Gnu says:

    I got my launchpad just two weeks after I ordered and that was an international delivery. I just have to find the time to actually do something with it.

  • WestfW says:

    (I hope the people complaining the “I can’t be bothered unless there’s a GUI” are not the same people who complain about “too many” Arduino-based Hack-a-Day postings. Sheesh!)

  • coreyl says:

    @osgeld

    No. The ATmega328p is significantly more capable than the low-end MSP430G2xx parts that the Launchpad includes and supports.

  • Ryan Barrie says:

    I got mine quickly from newark.com and they might still have them, but shipping isn’t free.

  • 0xPWNED says:

    This was incredibly easy to do, and is even easier than the limited Windows programs.

  • Joegeek says:

    I ordered mine the day this article came out and just got the “On back order” message yesterday. My wife works for a stepping motor manufacturer here in Silicone Valley. Her company also use TI controllers in their applications. TI seems to be having a tough time with meeting their demands in their case as well. All I can say is hang in there and hope to see some posts in September when we all get ours. On a closing note …. Here’s what the total cost is for all interested ->MSP-EXP430 -$4.30, Shipping $7.92, TOTAL a rocking $12.22 No wonder it’s on back order!

  • knot says:

    I’m still waiting for mine ordered two days after they came out. I’m hopeful they will arrive soon.

    Anyway, there is a forum for the 430 line devices if anyone is interested to discuss it.
    http://www.43oh.com/forum/

  • Ben C says:

    Make sure to add you user to the plugdev group. Otherwise you will still need root privileges to open the USB device.

    sudo usermod -a -G plugdev username

  • HeyAllen says:

    I ordered two from TI directly, when they were mentioned here, and had them in hand a couple of weeks ago, if not a month now.

    Handed one off to a friend, but like a couple of the others, just need to find the time to play with it.

  • ahmad says:

    Someone make a SlackBuild for thes tools please ;)

  • Navic says:

    Worked great on Mint 8, thanks for the article!

    I wish the industry would embrace all flavors of Linux.

  • Geoff says:

    Just got my boars today so they are definitely moving, just taking a while. To all the ‘duino folks – how fast could you get your duinos the first day they were announced? Did you even try? TI can send you reels of 430s or most anything else they have if you want them faster; you’ll just have to source a box, a board, USB connector, cable, CD etc to build your own board :}

  • TC says:

    Anyone else run into “undefined symbol” errors? I’m trying to compile some SD/mmc reading code and getting a whole list of errors like this: /opt/msp430-gcc-4.4.3/lib/gcc/msp430/4.4.3/msp1/libgcc.a(_mulsi3hw.o): In function `__umulsi3hw’: (.text.libgcc+0×2): undefined reference to `__MPY’

    It can’t find “multiply”? I am confused.

  • Rando says:

    I’m seeing the work/no work for the launchpad’s serial on Ubuntu Lucid, both in a VMware instance, and stand alone hardware.

    Stable for a few hours even, then the “T…ACM0″ device is g-o-n-e. Even a hard reset does not restore???

    Great article, but I still have to run msdebug rf2500 as su…

  • Tom says:

    Just got mine today. Disappointed in the lack of cross platform tools. If they had released Windows, Mac and Linux development tools at the launch, I would be taking them more seriously.

  • Raj Bhutani says:

    Thank you very much for the instructions.
    I installed suggested tools and tried my first compile and programming / debugging under Linux, running on a old Dell Dimension.
    Worked !!!

    For me also, I had to use ‘sudo mpcdebug rf2500′, but I am ok with that.

  • yusuf says:

    greetings -

    i followed most of the direction provided here but i can not find the example code [http://blog.mahalo.com/hackaday/howto/Launchpad-blink.tar]. the link returns a mahalo.com page not found.

    i’ve been trying for several days to find an elusive make file example for a LaunchPad — mostly they the ones found do not work or are for other MSP430 boards.

    i was hoping your example code would provide the last bit of direction that would allow me to begin exploring the LaunchPad.

    any and all assistence is appreciated.

  • Roger says:

    Just got MSPGCC working on knoppix 6.2
    Only had to compile texinfo. But other than that, it was smooth sailing. Thanks for the great article.

    @ the above comments with the snotty, whiner attitude if you fail to adjust these very basic instructions to work for your distro/flavor. Then by all means ask for help if you have to, but do not talk trash about mac / linux / other os’s. It’s better you shut your mouth and stick to your precious, filth, virus and pr0n infested windows then.

  • Kevin says:

    Bump on the missing example code. I’m new to programming and it would very helpful to have a template to work off of.

  • bluehash says:

    @Kevin:
    Check the TI wiki site. There are a number of code examples at http://www.43oh.com/forum/viewforum.php?f=10 to get you started.

  • Cout42 says:

    I finally got mine today! woot! I ordered it the day of the first post on HaD. I hope I find some good uses for it. Thanks for the walkthrough.

  • KC8RWR says:

    Didn’t work for you? Keep in mind, these directions have you getting the code through Subversion. That means you are getting the latest stuff that the MSPGCC programmers are working on. They might be in the middle of something and not have it in a working state.

    I haven’t tried it yet so I don’t know why the author chose to direct readers to grab it from Subversion. Maybe it is so new that the latest released version doesn’t work yet? Or maybe the author was just going for the latest and greatest.

    I would suggest that if you follow these directions and it doesn’t work then go to the MSPGCC SourceForge page and just download the latest release version instead of taking it from Subversion.

  • Some Bloke says:

    I only just finally got my launchpads. Better late than never I guess.

    In a hurry to get compiling and playing I really didn’t want to wait for the toolchain to build.

    Luckily someone has a PPA for mspgcc4. I wrote a blog post about it.

    http://someblokeinthedesert.blogspot.com/2010/09/launchpad-msp430-mspgcc4-and-ubuntu.html

    Hopefully this can save some others some time too.

  • sucotronic says:

    The link to the tar file with the sample code seems to be broken. Can somebody re-upload it and share a link?

  • Bittencourt says:

    Great tutorial!

    But one link is broken (the mahalo one)
    Cheers,

  • Rando says:

    Bump on linux launchpad serial port stability —

    Seems to be better on today’s release of Ubuntu 10.10. The temperature demo python logger has been stable for several hours…

    I’m really starting to enjoy this board! I wonder when 20 pin 8k-16k dip chip will be available?

  • Joegeek says:

    I Originally Posted at 9:49 pm on Aug 13th, 2010 that I ordered mine the day this article came out and just got the “On back order” message a that day.

    I also originally posted in that same post, that “On a closing note -It’s no wonder it’s on back order due to the low price” …. well, it’s October 13th now (2 Months later)… I missed out on all the funs stuff every else here is reporting on, and really feeling “RIPPED OFF” by Texas Instruments.

    I remember back when I was a kid, and I ordered this cool “Mystery Box” toy from the back page of my comic book. It too was on back order and I NEVER received that too. This is what I am feeling right now. I didn’t realize how PISSED OFF Texas Instruments actually made me, until now.

    It never matters how “Cheap” something is when you never receive the item in the first place.

    TI reference number: 105631

    -Joe

    Posted at 9:49 pm on Aug 13th, 2010 by Joegeek

  • Klaus says:

    Hi,

    great tutorial!

    But i can’t download the example code!

    - Klaus

  • ThomSirveaux says:

    @joe:

    It took TI two months for me to get mine. Be patient. When they released these, I believe they received over 100000 orders, which was about 90000 more than they expected for the first run.

    And has anyone tried to get this running on Fedora 13, or am I just wasting my time and should switch to a diff. linux distro?

  • KC8RWR says:

    I ordered mine on July 21 and am still waiting. That’s a lot more than 2 months! I suppose the orders probably came faster as word got out.

  • XTL says:

    I ordered mine in may and got it today.

    So far, I’ve got the crystal and headers soldered in. I played with the demo and mspdebug first. Then I compiled a gcc port of the demo from one of the links with gcc4 and flashed that. It ran, I looked at disassembly etc. So far, it’s looking good.

    (Laptop running Debian squeeze, 2.6.32)

  • Apo says:

    If anybody still cares, the link to the sample code is dead (http://blog.mahalo.com/hackaday/howto/Launchpad-blink.tar)

  • Casey O'Donnell says:

    msp430x20x3_1.c example will toggle pin 1.0
    can get all the examples from http://www.ti.com/lit/zip/slac080
    also includes the preloaded temperature demo.

    took me awhile to find a working led blinking example, should have checked the wiki i suppose.

  • notmyidea says:

    This didn’t work for me. Compiling the sample code gave me:
    main.c: In function ‘main’:
    main.c:64: error: ‘TASSEL__ACLK’ undeclared (first use in this function)
    main.c:64: error: (Each undeclared identifier is reported only once
    main.c:64: error: for each function it appears in.)
    main.c:64: error: ‘MC__UP’ undeclared (first use in this function)
    make: *** [main.o] Error 1

  • notmyidea says:

    Ahh found the problem.
    Dowloaded source contains line:
    TACTL = TASSEL__ACLK | MC__UP;
    Changing to:
    TACTL = TASSEL_1 | MC_1;
    Fixes it.
    Note also that the source code for mspgcc4 now uses a git repository:
    git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4
    and now contains a msp430g2231.h header file eliminating the need for -mmcu=msp430x2012 in cflags

  • sucotronic says:

    For those who might be interested I’ve written an updated guide to use the Launchpad platform in my blog, msp430 Launchpad in ubuntu

  • Rando says:

    Still having issue with mspdebug requiring sudo admin rights even with new rules posted today.

    Comment anyone?

  • MoritzS says:

    @Rando: When Mike Szczys wrote the article, he forgot about the WordPress “feature”, that apparentyl sometimes converts quotes (“) into "

    When you create the udev rule, you cannot just copy&paste their text. You need to replace every " with the double quotation marks (“).

    The linked article about udev rules shows how.

  • Tanner says:

    So can anyone explain how I put a assembly file onto the device

  • MadRush says:

    I just got mine… ordered it in like july! arrgh

  • Alan says:

    Anyone know where I could read about the Makefile? It’s something I’ve always managed to avoid thus far with C on a uC.

  • boobaloo says:

    @notmyidea – thanks! your fixes really helps me :D
    @Rando – you could use ‘sudo adduser USERNAME plugdev’ instead.

  • thedigitalsean says:

    Excellent guide, thanks! For those of you with low-end machines, I got this working in Lubuntu 10.10 following the instructions as-is. I also got it working in bare bones Debian “lenny” after I added the “testing” repositories so that apt-get would install the correct versions (particularly gcc-4.4). buildgcc.sh stopped a few times complaining about missing commands but I just “apt-get install”-ed whatever was missing until it was satisfied.

  • Jerome says:

    You should update the MSP430x2xx Family Datasheet link, which is now Rev F:

    http://www.ti.com/litv/pdf/slau144f

  • tinkerMore says:

    Great article, worked like a charm.

    My VLO is running almost dead on 13 kHz. I set the counter to count to 13000 and have less than half a second error over three minutes.

  • Leif-KC8RWR says:

    Anybody out there using Gentoo? Apparently there is an overlay for the msp430. I tried following the directions from the overlay: https://github.com/radhermit/msp430-overlay/blob/master/README.asciidoc.

    The first thing I ran into was he’s using portage 2.2.something. I am still using the latest ‘stable’ release which is in the 2.1.9 series. His second step is “emerge crossdev::msp430″ I’m not sure what the “::msp430″ part does but my version of portage doesn’t like it. Does this direct portage to use the one in the overlay as opposed to the main crossdev? Or is it specifying a slot. Can slots contain letters? I tried just doing an “emerge crossdev”. It emerged crossdev and the msp430 target is available if I do a “crossdev -t help”.

    I tried “crossdev -t msp430″. It gets through binutils ok but then it tries to compile the linux headers. I’m not that experienced with cross compiling toolchains but I am guessing I would only need that if I was going to run the Linux kernel on the msp430? Intriguing as that sounds I don’t think it’s going to happen. I added the “–without-headers” option. I get farther now but it still fails when it tries to build msp43-gcc.

    One other thing… crossdev adds an /etc/portage/package.keywords/cross-msp430 file. One of the entries is “cross-msp430/[latest] * ~* -x86 -~x86″. I have never seen the “[latest]” form before. My portage doesn’t like it, I’m guessing it’s another 2.2 feature?

    Well, thanks in advance for any help/advice! I may just try installing per the directions here and forget the overlay. I hate to do that though, it’s so much nicer to let a distros package manager take control of things for ease of upgrading or uninstalling later.

  • Leif-KC8RWR says:

    woops, I also had to put the -S and -s4 options when I ran crossdev otherwise it didn’t actually try to build gcc.

  • George says:

    Got mine today after ordering about a month ago. Good guide except for what Moritz said about WordPress screwing with the quotes in the udev rules.

  • Alan says:

    If the udev rules don’t work for you, make sure you didn’t copy them from the code box, which as morphed some double quotes into some HTML syntax.

    It should be (hoping this isn’t also transhtml’d):
    ATTRS{idVendor}==”0451″, ATTRS{idProduct}==”f432″, MODE=”0660″, GROUP=”plugdev”

  • Alan says:

    I’ve made a better demo app, doesn’t use the timer any more, but still uses interrupts (S2) and shows you how to use low power mode.

    http://iamtheb.org/me/A_Better_MSP430_Launchpad_Demo.tar.gz

  • Roger Wolff says:

    It doesn’t work since sourceforge got hacked. I hope they come back online soon.

    Stupid scripts that try to download “the latest from CVS” instead of something more stable, and more easy to find mirrored somewhere else.

  • Ok, I got fed up with trying to make this work the ‘Gentoo way’ using Crossdev and just followed the directions here. It worked great! I don’t know what Roger Wolff was writing about but it seems to work fine now. I got the impression that support for this was pretty new under Linux. If so I would imagine that is why the latest from CVS is being used. The release version (is there one) is probably not functional enough yet. That was my guess anyway and I’d rather thank the author for making this possible and easy than complain about CVS. Thank you!

  • REW says:

    Yeahaa!!! It works. Sourceforge is back up, and it works now. I have a blinking led at 1Hz (not like the 0.5Hz, claimed above to be 1Hz) :-)

  • augre says:

    Hy,
    I installed the gcc from here.
    When I try to compile it can’t find include librarys:

    main.c:31:16: error: io.h: Nincs ilyen fájl vagy könyvtár
    main.c:32:20: error: signal.h: Nincs ilyen fájl vagy könyvtár

    Could you help?
    Thank you!

  • Leave a Reply

    XHTML: You can use these tags: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Hack a Day serves up fresh hacks each day, every day from around the web as well as hacking related news.

    Send us your hacks










         




    Hacks

    Resources