Getting Started with the Stellaris Launchpad

We’ve already given an overview of the Stellaris Launchpad, but lets look at the first steps to running code on the device. First we’ll get the development software working, then we’ll build and run a very simple example.

TI allows use of the full version of their IDE, Code Composer Studio, with the Launchpad’s on-board debugger. To work with Stellaris microcontrollers, you’ll also need to grab StellarisWare. This free software package contains support for the Stellaris devices including peripheral drivers, a USB library, and code examples. Finally, you’ll need the ICDI drivers to communicate with the debugger. TI has all the required software for this board available here. See the TI getting started directions for a walk-through of how to install the required software.

Windows 8

If you’re using Windows 8, the drivers won’t install because they aren’t signed. The workaround is to reboot and interrupt the Windows 8 boot by holding Shift and mashing F8. Select the “Disable Driver Signature Enforcement” option and let Windows boot up. You can now install the drivers by following TI’s instructions.

Creating a Project

With these packages installed, we can start writing code for the device. Create a new CCS project (File -> New -> CCS Project) and give it a name. Choose “ARM” as the family, “Stellaris LM4F120H5QR” as the variant, and select “Stellaris In-Circuit Debug Interface” as the connection. Select “Empty Project (with main.c)” under “Empty Projects” and click finish.

Now we need to include a header file that gives names to the microcontroller’s ports. To do this, click Project -> Properties and go to Build -> Arm Compiler – >Include Options. Click the plus beside “Add dir to #include search path,” click “File System,” and find the “inc” subdirectory under where you installed StellarisWare. Click OK to add the folder.

Making Light

Lets test that everything is working. In this simple example, we’ll just turn on all three colors of the RGB LED. To do this, we turn on the pins that the LED are connected to, which happen to be:

PORTF 1 = RGB LED red
PORTF 2 = RGB LED blue
PORTF 3 = RGB LED green

See the user manual for full schematics.  Here’s the code:

// processor definitions
#include "lm4f120h5qr.h"
#define LED_RED 0x2
#define LED_BLUE 0x4
#define LED_GREEN 0x8

void main(void) {
  // enable PORT F GPIO peripheral
  SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOF;
  // set LED PORT F pins as outputs
  GPIO_PORTF_DIR_R = LED_RED|LED_BLUE|LED_GREEN;
  // enable digital for LED PORT F pins
  GPIO_PORTF_DEN_R = LED_RED|LED_BLUE|LED_GREEN;
  // clear all PORT F pins
  GPIO_PORTF_DATA_R = 0;
  // set LED PORT F pins high
  GPIO_PORTF_DATA_R |= LED_RED|LED_BLUE|LED_GREEN;
  // loop forever
  for(;;);
}

Replace the code in main.c with this snippet. Debug the project by clicking Run -> Debug. This will build your code, and load it onto the device. To start execution, click Run -> Resume. The LED should light up white. Changing which pins are set high will change the color of the LED.

Any issues getting your Stellaris Launchpad up and running? Let us know in the comments.

Comments

  1. Jeff Patton says:

    Jealous, mine boards won’t get shipped until early Novemeber :(

    • Bill Stewart says:

      My board arrived yesterday, but has anybody else had trouble downloading the software? The ICDI drivers downloaded and installed just fine (on Win7), but I’ve made several attempts to download the Code Composer Studio + StellarisWare package, and it’s failed every time (on both IE8 and Mozilla, directly from the Internet or through my work firewall.) It’s about a gigabyte, but after going through the Export Control nonsense, it still doesn’t get past 0% downloaded, so it’s not just a size problem. Should I give up on CCS and just download the StellarisWare part for now?

    • slooker says:

      Same here. Early november. :(

    • Mental2k says:

      Ha, I’m early November too. This resulted in some crushing disappointment for me, I read the estimated shipping date as 11/9/2012 and thought great mid September. I forgot that while I’m not American TI are amd only realised earlier this week when I was getting a bit anxious about where the hell the thing was.

  2. trandi says:

    Hi guys,

    In case anybody’s interested, here’s one of my posts regarding a library I wrote for controlling a TM1638 (nice and cheap little board featuring 8 7segment digits !):

    http://trandi.wordpress.com/2012/10/11/tm1638-display-driver-for-stellaris-launchpad/

    There was already one for Arduino and the MSP430, and now you can easily use the Stellaris Launchpad too.

    You can download the library and use it as you wish, I can’t wait to see what people will be doing with it..:)

    Dan

  3. Coda says:

    I could hate you for waving that stellaris in our faces before we’ve even got ours, but I’m going to act all grown up instead. Here’s a tongue :P

  4. Adrian says:

    Also check out the excellent Getting Started workshop document and videos here:

    http://processors.wiki.ti.com/index.php/Getting_Started_with_the_Stellaris_EK-LM4F120XL_LaunchPad_Workshop

  5. WestfW says:
  6. frollard says:

    I just got my 2 in the mail last week. It’s confusing as all hell when the only thing you’ve worked with previously is an arduino…

    things like a real debug interface…etc. I figured out how to get code running in debug mode, but I have no idea how to build/upload code in final build mode. Time to do some learning. The variable/port/everything names are incredibly complex…again compared to my arduino experience.

  7. frollard says:

    **oh, and when setting the address/serial number words, remember it’s a permanent commit! The interface gives no warning that you can only save the values once.

  8. Pietro says:

    Got mine in Brazil last week, in the next weeks i’ll do some nice stuffs, still learning the new enviroment, i’m used to work with PIC and arduinos, so won’t be much before doing something awesome.

  9. dr.nick says:

    Mine came in the mail a couple of days ago. Go to dowload CCS and drivers…1.3GB :|

  10. Matt says:

    I’m surprised I haven’t seen a link to these videos from TI yet:

    I stumbled onto this by accident.

  11. bluehash says:

    Shameless plug:
    There are some interesting projects coming up at Stellarisiti. Most of us are from 43oh and are trying to get MSP430 BoosterPacks up and running on the Stellaris Launchpad. Feel free to join in.

    Projects:

    http://forum.stellarisiti.com/forum/35-projects/

    BoosterPacks:

    http://forum.stellarisiti.com/forum/61-stellaris-launchpad-booster-packs/

  12. WickedShell says:

    Had mine since early last week, just haven’t gotten to do anything with it yet :(

  13. MasterFX says:

    Maybe for someone a Coocox workspace is helpful.
    You can download my compileable Coocox “Project0″-Workspace here: http://www.mikrocontroller.net/topic/268911#2861029

    For flashing the LM4F you have to use the TI “LM Flash Programmer” because CoFlash doesn’t support the onboard programmer yet.

  14. ty says:

    for installing drivers on Win8 with signature verification turned off, people should add that special test certificate to the system and have that trusted. I don’t think disabling signature check for the entire system is a good thing.

  15. mexchip says:

    Great! I received my boards last week and only had the chance to test the demo program. I’ve just finished downloading the tools and I’m ready to go (as soon as I find some time :P).

  16. a3 says:

    Got mine last week and wasn’t sure on where to start.

    Keep them coming.

  17. nafix says:

    So, PIC32 or Stellaris?

    I mean they’re basically the same thing: 32 bit, 80MHz max clock, and a ton of peripherals. Does it just come down to MIPS vs ARM (and customer support, libraries, IDE, etc)?

    I’ve been doing a lot of PIC32 recently, but I’ve also been interested in venturing into the world of ARM.

    • Good question. I’ve worked with PIC32 quite a bit, and not as much with ARM. One advantage is the large number of ARM variants out there. It’s also used much more in industry. Hopefully I’ll have a better opinion after working with the Stellaris for a little while.

    • asdf says:

      I’ve used Cortex-M3s in a few projects and I am currently working on a project using a PIC32 and given the choice I’d go with ARM every time. The PIC32’s MIPS core is just so old and clumsy compared to the Cortex-M. Microchip’s libraries do an admirable job of hiding most of the crap where they can, but it’s still obvious you’re not dealing with a modern, purpose-designed architecture.

    • bluehash says:

      To be honest, once you get acquainted with StellarisWare, there us no turning back. That library is so well written by TI.

      • Mj says:

        Not to mention that the StellarisWare peripheral drivers are also included in on-chip ROM. That I like alot, as it may actually enable significant savings on program flash.

  18. AmosSam says:

    talking about perfect timing!! :-D
    i got mine two board just this morning!! :-)))
    this will be interesting! i started with mcu’s with paralax propeller, and will see how this one will go!
    (but this will not replace propeller, at least not for me!)

    ….. just to figure out what to do with these boards… :-D

  19. Got my two a couple days ago, been too busy to do more than check out the preloaded demo. Goddamn LED damn-near burned a hole in my retina, lol. That sucker is BRIGHT.

    btw, can anyone source ridiculously-bright tiny formfactor surface mount RGB LEDs like that? I hardly ever see anything but 5050/PLCC-6 ones.

  20. LJR says:

    So I’m going to have to fork over $445 for the Code Composer Studio if I want my code to run on a board not connected to a PC. That takes a lot of the shine off the $5 per board price.

    • Coda says:

      Have you understood that correctly? Cos if so, I won’t even bother with the official stuff, I’ll go straight to GCC.

    • J says:

      I got mine in about a week ago. Still playing around with it. I didn’t need to play for CCS. I just had it “lock” to my board. I can run code without having my LaunchPad connected to my PC.

    • Otto Hunt says:

      Use the free LM Flash programmer to download your file to your custom board that you proofed out on the Launch Pad. If you find a bug, work it out on the Launch Pad and, again, download the debugged file to you custom board.

      For more complicated projects you may have to create a plug-in board that will sit on top of the Launch Pad. Full specs are on the TI site.

  21. yabapolido says:

    ARGH… They still suck at software.
    I had a Chronos Watch and it was hell to do something on it… Stellaris is even worse.
    I’ve came from the Arduino world too and there’s no way they can compete with it.

  22. linuxbot5 says:

    TI has no luv for linux. They release the launchpad but, like the msp430, their flagship software CCS doesn’t work with the launchpad and linux. If it follows the msp430 route, they’ll get it running sometime in 2014 or 2015.

    Why can’t TI make great chips AND software that works with linux?

  23. I already got my board 7 days ago :-)
    Grrrr8

  24. yuvadm says:

    Nice platform but horribly setup to work with open toolchains.

    If anyone wants to join efforts on making this run on standard ARM EABI toolchains on multiple platforms (Linux/Mac), please get in touch with me.

  25. Ramana says:

    i what explanation of this line
    (HWREG(GPIO_PROTF_BASE + GPIO_0_LOCK) = GPIO_LOCK_KEY_DD;

  26. I had good experience with CCSV5.2 and Stellaris Launchpad with Windows Vista Home Basic but after I replaced it with CCSV6 I cannot download my compiled software into the board. It asks me to update to new Target Configuration file *xxml. I wonder if it not compatible with Window Vista Home Basic.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,449 other followers