Header file brings Arduino sketches to the TI Launchpad

[Chris Hulbert] is making it easy for Arduino users to program MSP430 chips with a header file that allows you to compile Arduino sketches for the Launchpad. This makes sense, as the growing number of Arduino sketches available, and the low cost of the TI Launchpad make for a good bedfellows. It’s really wasn’t that hard to make this happen, although you’re not going to find support for all of the Arduino functions just yet.

At the time of writing, [Chris] has just 51 lines of code committed to the project. It provides macros for setup(), loop(), delay(), pinMode(), pinBit(), digitalWrite(), and digitalRead(). You’ll notice that one of the most important parts of the header file is that it disables the watchdog timer for the user (a stumbling block for many MSP430 beginners). It’s an interesting solution, but to be truly useful we’d want to see hardware integration with the Arduino IDE. That, as well as the rest of the Arduino functions are at the tips of your fingers. Get coding and submit your push requests to [Chris] for inclusion in his repository.

[Thanks Chris]

Comments

  1. r_d says:

    Something about this makes me cringe. I’m not sure what.

  2. Mike Hogan says:

    Great minds think alike, I suppose.

    Here’s a rather larger Wiring-like header file that I created called TIWrap. It includes a bunch of sample projects.

    http://bigvulcandeal.com/msp430/sample_code/TiWrap_demos.zip

  3. gcb says:

    @r_d why? because you feel like electronics shouldn’t be accessible? surely this will, if anything, move arduino developers to a new platform. isn’t this what people want?

  4. Bill D. Williams says:

    This is by far one of the best hacks I’ve seen on HAD in a good long while.

    Wow – the arduino team will drop a brick. They are pretty protective of their little money making machine. And at $30 each – as you’d expect, they have a healthy profit margin. (too much maybe?)

    Now, who’s down for some $4.30 arduinos?

  5. Matthew says:

    http://code.google.com/p/easymsp/

    I started EasyMSP 14 weeks ago. EasyMSP has a AFI, or a Arduino Function Interface.

    Regards,
    Matthew Burmeister

  6. Chris Muncy says:

    Hey Mike,

    Thanks for cleaning the article up for me. I knew it would be of interest.

  7. mungewell says:

    In terms of ‘code elegance’ – WTF!

    However this is a really cool project which will help introduce even more people to firmware hacking, which is definately a good thing.

  8. zing says:

    @Bill D. Williams

    Yah, real protective. That’s why you can buy them from other people(same gerbers, just with the name filed off) for $20-something. Or get a barebones one without that stupid USB chip for like $15.

    Real protective.

  9. js says:

    @Bill d. Williams

    to continue where @zing left off….

    Or get the chip for $4.30 and burn the free bootloader your self using the free IDE (and a cheap Atmel ISP). It has 16 times the program space, 16 times the RAM, 4 more IO pins and 6 analog inputs.

  10. r_d says:

    @Bill D. Williams:
    You have no idea what you’re talking about. The purpose of the Arduino project was to make an _OPEN_ platform for learning. That is, one that anyone is free to build or modify (or sell). They are not protective of anything. In fact being “protective” of their “little money-making machine” goes against the very purpose of the Arduino.

    I might be bitter and dismissive of Arduino-related projects, but I can’t say that the it wasn’t a pretty big step forward.

  11. js says:

    Forgot the link:

    http://www.sparkfun.com/products/9061

    or for $1.20 more – no need to program the boot loader:

    http://www.sparkfun.com/products/9217

  12. Aaron says:

    r_d: What makes me cringe about this is that Arduinites with no clue are going to see it and go “Ooh! I can run my Arduino ‘sketches’ on something that costs a tenth what an Arduino does!” And then they find out that, even with clueful and clever header support, porting between the platforms is still pretty far from trivial. Then, once the initial wailing and gnashing of teeth has mostly died down, we spend the next two or three years constantly hearing the ignorant shriek about how MSPs suck because “they can’t run this nifty blinking-LED Arduino sketch I found on instructables.com!”

    It’s a nifty idea in theory and likely in practice as well, but I can’t imagine there being enough yellow caution tape and disclaimers in the world sufficiently to lower the expectations of the sort of ignorant magical thinkers who’d believe that any but the most utterly trivial Arduino code can run on an MSP without significant modification.

    TiWrap, on the other hand, is super nifty, especially for somebody like me who’s been having no success at all getting piezo buzzers to behave usefully. Thanks, Mike!

    tl;dr: If you want an Arduino, you know where to find one. TiWrap is awesome.

  13. Robert Ely says:

    @r_d I can think of a few things.

    For one the launch pad has no USART, thats going to be a big turn off to the arduino people.

    It has far less memory, The arduino boot loader takes up more memory than the Value line has…(2k)

    Less IO pins, only 8, and 2 of those are taken by a software USART if you use one, Another 1 for an onboard switch, and another 2 for the onboard Leds…(that you can disable with jumpers)

    The Big reason the Launch pad is not taking off is the really bad Fragmentation in the comunity, The TI documentation is great….but there is A lot of it and the TI site is TERRIBLE, if they really want to take over the market the C code is not going to stop them. I mean just look at the arduino Documentation, its very very clean.

    Also the watchdog timer really trips up people? I mean, EVERY tutorial or book I have read on the 430 is REAL specific about turning that off.

  14. slipp says:

    This is great.

    Too bad TI didn’t use the same header pin configuration as arduino so that the arduino shields could be used on the launchpad.

  15. Bill says:

    Arduino is protective of their money making machine.

    But it’s not the physical boards, it’s their name.

    Best and most recent example is they threatened to throw lawyers (Sony style) at Jeremey Blum for his “Arduino Tutorial” now called ‘Tutorial for Arduino’ because of the threat.

  16. Bill D. Williams says:

    Right.

    Not everyone in OSHW is in it for the right reasons. Some are a greedy business wrapped in a pretty, open source package.

    Thinking otherwise is just naive.

  17. mike hogan says:

    A lot of these arguments hint at religion. I worship mimimalism. Beat the $0.35 cost of an mspg4001 and you have a convert.

  18. Gadget says:

    This is great as my launchpad is arriving tomorrow! Also in case anyone is interested the ti store is shipping stuff free ATM. Even to international destinations (via fedex) – fantastic!

  19. nave.notnilc says:

    jeez, really? one little header file with a few trivial functions, this really will only get you as far as toggling LEDs :P

    check out http://www.43oh.com/forum/viewtopic.php?f=10&t=45

  20. garboui says:

    While there are some valid arguments about arduino being a money hungry machine because of their name and their enevatableness to sell their own product (god forbid) thats sold along side zillions of other compatible platforms. is it not reasonable that a group makes a profit for their efforts for spinning off their own OSHW?

    Now on to the matter for the TIwrapper/ MSParduino emulator. Having been a recent convert to the msp430 platform for both hobby and business i think this is a (limited) good concept. The reason for the limited part is because MSP series chips are meant to be cheap (or minimalist, however you look at it). For this reason i think that if the TI wrapper stays at the stage it is now it will 1. leave space for lots more code and also provide that hook to encourage Arduinians to begin learning on a new platform or mostly learn how to use the rest of the available peripherals on their own and all the different various configurations that they can be used in.

    one more thing. launch pad converts can rejoice in real debugging capabilities incorporated at 20% the cost ;)

  21. Aleks Clark says:

    what, nobody caught this yet?

    it’s a /pull/ request. I ordered 6 launchpads when they came out and they never arrived. I guess I should complain…will probably wait until I’m stateside…

  22. Bill D. Williams says:

    ^I got mine – no problem. $4.30 pfff. I’ve spend more on…well never mind that.

    If you don’t already have one, here’s where you can get it:

    http://focus.ti.com/docs/toolsw/folders/print/msp-exp430g2.html

  23. Cool! says:

    I can’t imagine the Arduino people are THAT protective of their trademark.

    Why?

    Well, for one there are a million Arduino compatible `diono development boards – no problem.

    You can pretty much expect any “duino” to be a compatible clone.

    The one duino system causing brand and platform CONFUSION is the Netduino, which is wholly incompatible with Arduinos. I cant believe those db’s are trying to ride on the Arduno’s name (but what do you expect, from a Microsoft .net platform?)

  24. thattiguy says:

    Up until now, I’ve only been an arduino user. The STM32 & ARM boards I have experimented with were too big of a step up.

    I just got my launchpad yesterday and I think the learning curve will be more manageable than 32 bit.

    Why the MSP430? I’m building a battery operated robot which needs low power consumption. MICRO amp(uA) standby times! Sold me on the MSP Valueline for this specific application.

    God, I sound like astroturf, but seriously uA!

  25. NatureTM says:

    I saw this and just added a couple code snippets to my site for millis() and analogRead(). They’re not in a nice header file, but they should be easy to use.

    http://naturetm.com/?p=128

  26. Ian Tester says:

    Macros for setup() and loop()? I only see macros for delay(), pinMode(), digitalWrite(), and digitalRead(). I see plain, ordinary ANSI C prototypes for setup() and loop(), and a main() function that uses them.

    Perhaps Mike needs to brush up on his C basics, particularly what the preprocessor (cpp) does.

    /flame

  27. Ekaj says:

    How about you just learn some basic microcontroller skills and forget this nonsense? It is pathetically easy to use the MSP430, I don’t understand why you would want to do something like this.

  28. Matt Jones says:

    I love this guy, thanks for making it easy for us not so tech savy people to enjoy the fun of arduinos! i will PM you cause i need some help with my arduino mega for use on and octocopter.

  29. NatureTM says:

    I don’t get why people are so upset. If someone has a project in mind that could use a microcontroller, why is it so imperative that they learn bitwise operations and all the ins and outs of the peripherals. Let them enjoy themselves!

  30. mike hogan says:

    @NatureTM — well put. I taught an MSP430 course and a lot of people kind of hit a wall with the bit-wise stuff. Folks in the class were quite intelligent .. lots of sheepskins from various Penn graduate schools .. it was a little weird … but it took some effort to teach bit bopping and some folks decided after that that they weren’t all that interested anymore.p

  31. The biggest problem that I have with the MSP is the changes from one chip to another. They all use the same sets of peripherals, but there are multiple versions of the same peripheral – timer a3, timer a7, uart vs usart, etc. To use them requires you to select a chip with exactly what you want, then pouring over the thorough documentation to figure out how to use it. A week later, you come up with a new project, and you have to re-learn everything you know, and try not to mash the new with the old.

    With arduino, you can throw the same code together in 1/10 the time it takes you to fully understand ONE module. Maybe the code isn’t as efficient, but when all that I want is to write ‘hello world’ on an lcd, I really don’t care.

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 93,621 other followers