I have been fiddling around a bit with microcontrollers lately. As the Arduino revolution still hasn’t hit Sweden, the first microcontroller I got my hands on was the PIC 16F690 that came with the PICkit2. Later, I discovered the MSP430 Launchpad that is available for the symbolic amount of $4.30. Being an avid Linux user, the solutions that came with these two kits didn’t quite work out of the box. Surely, there is always Wine, but this article will compare these two kits from a “native” standpoint in relation with Linux.
When it comes to hardware compatibility both kits are winners. Plug and Play all the way. Some minor tweaks were needed with the udev configuration in order to make the programmers available without requiring superuser permissions, but besides that no special drivers or other madness was needed.
The included microcontrollers are fairly decent. The PICkit2 comes with a PIC16F690 mcu in a DIP-20 IC. The Launchpad instead comes with a MSP430G2210 in a DIP-14 IC, and a spare mcu included in the package. The downside of the Launchpad is the limited number of I/O on the included mcus, and therefore the winner when it comes to hardware is the PICkit2.
The PICkit2 programmer can also be used to program a variety of the PIC16 series mcus (although not all of them on the demo board as it only supports the 20-pin form factor – you can however wire it up on a solderless breadboard or buy additional demo boards with support for other PIC16 series microcontrollers), while the Launchpad with the mspdebug utility currently only supports a subset of the available MSP430 microcontrollers, namely the following: (this list seem to differ from the list of compatible microcontrollers provided by TI)
CC430F5133 MSP430F149 MSP430F2234 MSP430F2618 MSP430F5438A CC430F5137 MSP430F1611 MSP430F2274 MSP430F413 MSP430F5529 CC430F6137 MSP430F1612 MSP430F2370 MSP430F4270 MSP430FG4618 MSP430F1121 MSP430F169 MSP430F247 MSP430F47197 MSP430G2231 MSP430F1232 MSP430F2013 MSP430F249 MSP430F5437 MSP430F147 MSP430F2131 MSP430F2616 MSP430F5437A MSP430F148 MSP430F2132 MSP430F2617 MSP430F5438
The functionality provided on the boards is pretty similar. The PICkit comes with four leds, one button and one potentiometer that can not be disabled. The Launchpad instead comes with two leds that can be disabled with two jumpers, and two pushbuttons of which one acts as a reset button.
Microchip does offer an open source programmer, pk2cmd, that provides the same functionality as the PICkit2 programmer software does in Windows. As an added bonus, this programmer also compiles on Mac.
In the case of the Launchpad, there is no official effort to support Linux or any other platforms besides Windows for that matter. Programming the device is done using the open source community effort mspdebug which also offer step-by-step debugging as well as disassembly and memory dumping.
Microchip gets a gold star for providing an open source programmer, but from a usability standpoint the programming and debugging features provided by mspdebug makes this the winner.
3. The Code
The Microchip assembly language is very well supported by the gpasm software suite, all the examples that you can find in documentation as well as on the interwebs can be instantly compiled and tested. For the Launchpad, I still haven’t had a go at writing assembly language code.
Both kits do however support C; in the case of the PIC microcontrollers the Small Devices C Compiler (SDCC) does a fairly good job at creating binary blobs from standards compliant C code, while the Launchpad instead prefer a patched version of the Gnu C Compiler (GCC) aptly named msp430-gcc.
The PICkit2 with SDCC however does require a bit of digging in order to get full access to header files and similar to support I²C, UART etc.
Microchip also provides a C-compiler named HiTech C that works in Linux, but this is really crippleware with a limitation on the resulting code size based on the target device.
For Windows, the support comes with the MPLAB IDE that integrates the programmer with a C-based environment based around HiTech C. There is also a MPLABX IDE available as a beta that is built around the OpenSource IDE NetBeans, that works with SDCC as well as the other by Microchip supported programmers. For some reason, MPLABX feels much more heavy compared to the standalone NetBeans IDE, but this will hopefully change when it gets out of beta.
The winner here is yet again the Launchpad, but if Microchip decided to help bring SDCC up to speed as well continue their work on MPLABX the verdict is very likely to change.
Both platforms work flawlessly in Linux, but they leave a bit to wish for when it comes to support from the manufacturers. As for getting started, both the PICkit and the LaunchPad work pretty much out of the box, and both have got potent open source solutions to deliver the full potential even in Linux. The Launchpad however feels more mature when it comes to writing code in C, and also comes with powerful debugging functionality. The only thing the Launchpad falls behind with is the number of I/O the included microcontrollers come with, but on the other hand, with a pricetag of $4.30 it just can’t go wrong.