Hello!
I'm writing this blog hoping to provide a quick and painless procedure to get started with Texas Instrument's MSP430 LaunchPad board on Mac OS X. Their support for OSX is quite poor to say the least. I'm providing a self-contained package so that you don't have to waste your time like I did all day. Just download the following file, unzip and install:
Note that this is a set of command-line tools in the spirit of the equivalent CrossPack tools for AVR MCUs.
To test it:
- Download their temperature demo. Unzip.
- Open a Terminal, cd to the folder you just unzipped, then run
make
If you don't have 'make', just install Xcode (I know, it's overkill, but...). - You should get a 'main.elf', now upload it to the LaunchPad with:
sudo mspdebug rf2500 "prog main.elf"
- Done! You won't notice much of a change since you just uploaded the same blinking red/green demo that came pre-loaded, but you get the idea :)
- You don't get a serial interface like Windows/Linux users do. The official wiki(yes, the official wiki) will tell you to install this driver, but you'll just waste your time yet again. This information is not only misleading, but absolutely wrong, that driver was written for the TUSB3410UARTPDK and will not work with the LaunchPad.
- You can only program the board once, and then it won't get recognized again by mspdebug until you unplug it and plug it back in.Edit: fixed! download the lastest package.
What's under the hood?
The package will install a few things:
- The mspgcc4 toolchain (current version: 20101006), which includes GCC/G++ 4.4.3, GDB 7.0.1 and related bintuils.
- mspdebug (current version: 0.12). This is a programmer/debugger for the MSP430 devices. It's actually very neat, you can perform on-chip disassembly, debugging and step-by-step execution. I think you can piggyback gdb on it and debug from gdb or any of its front-ends, but I haven't actually tried it. Again, I included the binaries so that you don't have to deal with the homebrew/darwinports/libusb stuff yourself.
- An especially crafted driver by Bill Westfield (westfw). This is sort of a "null" driver so that OSX doesn't take exclusive control over the LaunchPad when you plug it in.
I hope this helps. It goes without saying that this is a barely tested build of the toolchain and it might not even work for you. I just tested it on Snow Leopard (10.6.4), but it should work with Tiger and Leopard, too. Edit:. So far, the toolchain only works on Snow Leopard. Please drop your flames on the comment area below. If you get it to work, let me know as well.
This comment has been removed by the author.
ReplyDeleteI don't have make installed, so I'm downloading XCode now.
ReplyDeleteHowever, mspdebug should work at this point, but:
dyld: Library not loaded: /usr/local/Cellar/libusb-compat/0.1.3/lib/libusb-0.1.4.dylib
I'm presuming therefore I need to find libusb-compat from somewhere.
I now find libusb-compat needs sudo port - which requires XCode - so I'm stuck waiting. :)
Might it be an idea to point out the install order a little more clearly to "virgin developers" like myself :)
Welp, got everything installed but I'm stuck on "make" now.
ReplyDeleteI downloaded the project you indicated, but now this:
MSP-EXP430G2-Launchpad $ ls
Debug lnk_msp430f2012.cmd test_RX.c.old
MSP430F2012.ccxml main.c
MSP-EXP430G2-Launchpad $ make
make: *** No targets specified and no makefile found. Stop.
Sad times :(
Ah. I think you meant the temperature demo here:
ReplyDeletehttp://losinggeneration.homelinux.org/2010/07/02/msp430-launchpad-on-linux/
Which has a makefile ;)
We're getting there! Together! I love you!
cr3: you don't need to install the three components manually. Just download the package I mentioned in the beginning of the article and off you go.
ReplyDeleteAnyway, you seem to be almost there... Let me know if it works!
Very usefull!
ReplyDeleteThanks!
I am trying to call __delay_cycles but at compile time I get undefined reference to `__delay_cycles' at link time. Does this mean it didn't find the correct headers? I'm trying to compile for the MSP430G2231 on the launchpad. I tried changing -mmcu to different names to no avail. Any ideas?
ReplyDeleteMatt -- I think __delay_cycles is IAR-specific and has not been ported to mspgcc4. Check out TI's temperature demo (link on the post). They use something like this:
ReplyDeletestatic void __inline__ delay(register unsigned int n)
{
__asm__ __volatile__ (
"1: \n"
" dec %[n] \n"
" jne 1b \n"
: [n] "+r"(n));
}
Since it's an inline function and each dec+jne loop takes 3 cycles, that should pause your program for exactly 3*n cycles (assuming no interruptions).
This seem to ONLY work on Snow Leopard, will fail with "dyld: unknown required load command 0x80000022" on anything below this.
ReplyDeleteThank-you! So much for the nice easy to use package. I was able to program my MSP430 with your breathing light demo using the included makefile. However I can't find any information about how I could put my own C or Assembly program on the thing? Any push in the right direction would be greatly appreciated. I mostly want to use this to learn Assembly. So instructions on how to load Assembly programs would be nice.
ReplyDeletep.s. Is it just me or is most of your website in English but some of the buttons are in spanish?
Tanner: everything should be in english now :)
ReplyDeleteI haven't programmed the MSP430 in assembler myself, but you can use msp430-gcc to assemble code and generate the .elf:
msp430-gcc -Os -Wall -g -mmcu=msp430x2012 -c main.s
msp430-gcc -Os -Wall -g -mmcu=msp430x2012 -o main.elf main.o
If you need an idea of how a ".s" looks like, its syntax, etc, you can also have gcc generate one for you from a .c source code with:
msp430-gcc -Os -Wall -mmcu=msp430x2012 -S -c main.c
I theory, compiling a .c into .s, then assembling into an .o should produce the same result as compiling directly a .c into an .o.
That way, at least you can write some code in C and look how it looks like in assembler.
Good luck!
Hi, first thank you for setting this up, its very welcome. Hope to see a lot of postings. Good luck.
ReplyDeleteI tried to avoid usb drivers except the main. Had bad experiense that other driver took away usb connections from some of mine projects ( pic with out of the box working usb ).
So my question, is libusb working well, no influence on the standard drivers?
Is it possable to connect more then one launch-pad at the same time?
rva, thanks for the kind words. The driver checks for the VendorID and ProductID, so in theory (I haven't written it myself), no other device should be "masked out" by this driver.
ReplyDeleteYou shouldn't find any conflict with libusb either, unless another application decides to install a different/incompatible version of libusb... Which you have to check by hand (CMD-I) from the installer, since OSX packages don't usually check dependencies at all.
life is easier now,
ReplyDeletethanks dude!
Does this toolkit run on a 32-bit system? I get the following when attempting to execute any of the binaries:
ReplyDeleteBad CPU type in executable
I am attempting to run on a Mac Mini with an Intel Core Duo processor.
@Richard: apparently not, sorry :( I have no way to test this other than on my own computer. I'm thinking of posting the pkg project and a brief shell script, so anyone can build the package on their architecture.
ReplyDeleteWoo hoo! It works! You sir are a genius.
ReplyDeleteI had to remove the TIVCP extension first to get it to work.
I don't see how TI thinks they're going to break into the hobbyist market with this complicated mess of drivers etc...
Anyway, thanks again.
well, firstly thanks for all. but __delay_cycles() does not work. do u have any solution
ReplyDelete@altu: read 12 comments above for a function that does cycle-precision delays. Or, take a look at TI's temperature demo (link on the post).
ReplyDeleteSo - I've been trying to get the VCP driver working on my macbook (core duo / 32bit/ 10.6.7) with the launchpad.
ReplyDeleteI built the driver supplied by TI (v1.2.1), modified the VID/PID to match my device, and the device is recognised. The kext loads and runs, but it fails to upload the firmware to the device. The driver complains that FindNextInterface is returning NULL.
Anyone else hit this? Any ideas?
On one of the many other disperate forums, someone alluded to a v1.2.2 of the driver - does this exist?
Thanks,
reg
Thank you! I got the Breathing Demo to work on my MBP. I had to run sudo make install to get it to compile
ReplyDeletewhat about the host software for a mac? any tutorials?
ReplyDeleteBig Guy: What do you mean by host software?
ReplyDeleteGot this working first time, thanks Javi!
ReplyDeleteclean and easy install
ReplyDeletethen added the build parameters to NetBeans
Now I'd say its almost better than TIs IDE ^_^
http://mspdebug.sourceforge.net/faq.html#rf2500_osx worked for me after getting a "Permission denied" message while trying to push the .elf file on the msp.
ReplyDelete(Intel i7 / Snow Leopard)
This is very useful!!
ReplyDeleteeasy to install.
(Macbook air w/ snow leopard)
Javier, It worked!!
ReplyDeleteI am really happy to confirm that the osx-lauchpad package works on a MBP Snow Leopard 10.6.8
I downloaded the Breathing LED program -> unzipped -> from terminal, typed: sudo make install (from the unzipped directory)
thats it. Thanks...
Now there's a beta serial driver for the launchpad.
ReplyDeletehttp://www.43oh.com/forum/viewtopic.php?f=7&t=1591&start=10#p10955
Are you planning to upgrade the packages at some point?
Thanks!
sanpedro: that's interesting news... I'll see if I can get some spare time and build a new package with this driver in.
ReplyDeleteThat would be great! Javi, we will be very happy if you'll include that stuff in a new post. Thank you for your work so far! Greetings from Hungary, EU
ReplyDeleteWhen I try to make, I get this error:
ReplyDeletemake: *** No rule to make target `install'. Stop.
I'm in the folder you linked to, when I try to do it. Any help?
Hello,
ReplyDeleteYou know, you've written exactly what I was looking for. Thank you very much for your work. Continue to publish, dear. Join and learn all you need to know about the Launchpad Development Solution.
Thanks and that i have a keen provide: House Renovation for home renovation
ReplyDelete