Review: Mbed NXP LPC1768 Microcontroller

mbed is a next-generation 32-bit microcontroller platform. It’s a prototyping and teaching tool somewhat along the lines of Arduino. On steroids. With claws and fangs. Other contenders in this class include the MAKE Controller, STM32 Primer and Primer 2, Freescale Tower, and Microchip’s PIC32 Starter Kit. The mbed hardware has a number of advantages (and a few disadvantages) compared to these other platforms, but what really sets it apart is the development environment: the entire system — editor, compiler, libraries and reference materials — are completely web-based. There is no software to install or maintain on the host system.

The Hardware

The mbed board is sensibly priced at $60; about middle of the road among its peers. mbed’s size (or lack thereof) is among its greatest assets, measuring only about 1″ by 2″ (26 x 52mm) in a stout 40-pin DIP package that just barely manages to fit in a breadboard…a major win.

The top of the board is dominated by the microcontroller itself: a 60MHz NXP LPC1768 based on the eminently capable 32-bit ARM Cortex-M3 core, sporting 64K of RAM and 512K flash, and rounded out with an embarrassment of peripheral riches: Ethernet, USB (host, device, and to-go), CAN bus, multiple serial, I2C and SPI buses, 12-bit A/D and even a 10-bit D/A converter and realtime clock/calendar. Also on top is the USB connector (mini-B), some power regulation circuitry (operating on 4.5 to 9 volts DC, or USB power), several indicator LEDs, and the reset button (a plain vanilla tactile switch on our purchased unit, not the candy-like blue button seen in product shots).

The underside conceals an Ethernet transceiver chip (requiring only the addition of an RJ45 jack to get the board on a network) and a DiskOnChip-style component that provides a small (about 2MB) FAT filesystem when attached to a host system through USB, much like a thumb drive.

This latter feature — the FAT filesystem — is half of the key to mbed’s software-free, cross-platform magic. Getting new code onto the device is simply a matter of copying the compiled program (as a .bin file) to this drive. Press the reset button, and the new code is copied to the MCU’s internal flash and run. No special programming hardware dongle, no special bootloader software, just drag and drop. This has some serious implications. Pretty much any system these days can mount a FAT filesystem. We’re not just talking about getting Mac and Linux users into the fold alongside Windows…there’s also the impending wave of featherweight netbooks with ARM and VIA chips running peculiar, instant-on operating systems. Or the OLPC XO-1. Or older PowerPC Macs. The computers in the school’s lab that you’re not allowed to install any software on. Game consoles.

The Software

Cloud computing” is still the hot buzzword this week, and the mbed project has adopted the concept wholeheartedly, comprising the other half of their softwareless strategy. Everything with mbed — everything, even your own source code — resides on their servers and is accessed through a web browser. This carries with it all of the good and bad points of any other network-based service such as Google Docs. There’s the potential for this to be a fantastic tool for teaching and collaboration, and in fact they’ve created such an online community for mbed, with forums and publicly-shareable code libraries. One can move between home and office, or travel around the world, and resume editing code on any system with a solid ’net connection. No need to check for software updates; the server will always be current.

mbed programs are written in C++ (yes, thankfully it’s “programs” and “C++,” not “sketches” or “the mbed language”) using their JavaScript-based online editor. When ready, click the Compile button. The compiler and linker run on the back end, on the server at the other end of the network connection. Provided your code is all syntactically valid, a compiled .bin file will then be downloaded to your computer…save this to the mbed USB disk, press the reset button, and you’re good to go. In Arduino-like fashion, the mbed device also appears as a virtual COM port, so you can monitor a program’s serial output using any terminal program.

The Good

We were taught that you should always say something kind before criticizing, so we’ll point out that the above process does, in fact, work exceedingly well, and has proved to be both quick and reliable. Once you get into the groove, the sequence of operations is no more onerous than with Arduino or any other microcontroller-specific programmer dongle.

To their credit, unlike some microcontroller evaluation kits, there are no artificial limitations to the mbed compiler; the full code and memory space of the processor is available to your code. The editor has realtime syntax coloring and multiple undo levels. And double-clicking on an error message in the compiler output will take you directly to the offending line, as in any decent IDE. You can import existing code from your local system to the mbed “cloud,” or likewise export individual files or an entire project. All good stuff.

The real saving grace of this setup is the libraries, both the official functions in what they call the “Handbook,” and community-contributed code in the “Cookbook.” A tremendous amount of functionality has been implemented in a concise and usually object-oriented manner. It’s almost comical sometimes, after having worked with other microcontrollers and girding for some expected coding nightmare, only to find that the corresponding library handles a task in a couple of lines (browse through the Handbook and Cookbook for examples). There’s a tendency also to follow stdlib or “UNIX-like” conventions for file access, character I/O, realtime clock access, etc., so existing systems programmers new to microcontrollers will feel right at home, no weird function names or syntaxes.

The mbed’s FAT filesystem is also accessible to the microcontroller, making it useful for more than just program storage. Web pages can be served from this space, or a data logging program can store results here. If the two megabyte capacity is too limiting for your needs, have a look at the SDCard library in the Cookbook — it’s almost trivial to wire up and use. Pretty much all of the libraries are like that!

The Bad and the Ugly

Hardware-wise, there are just a few minor nitpicks:

First is with the local FAT filesystem. Even though this is one of the device’s most unique features, and the very thing that enables its platform neutrality, the implementation just seems a bit anachronistic. The aforementioned SDCard library demonstrates how readily that format can be used. It’s faster, with the potential for far greater capacity, and cards could be easily swapped out for different code or data files. Not a major disappointment, just seems like an opportunity was missed to make this product even better.

Second is with the indicator LEDs on the board. Four of them, scant millimeters apart, all blue…making them pretty much worthless as status indicators from across the room, where they all blur into a singular blob. Ten years ago, blue LEDs were novel. Five years ago, they were mainstream, festooning every last USB hub, mouse, flash drive and imported piece of crap. Today they’re just tired, let’s get over it. Different colors would indicate status at a distant glance.

Finally, not a problem with the mbed board itself, but it would be nice to see one of the Cookbook projects, the “BoB2” breakout board, made into an available product. The blank board can be ordered through BatchPCB, but after postage and handling the price for just the empty board — no components — is $33. Have this populated and mass-produced, bundle it with the mbed in a $100 package, and it sounds like a winning setup, ready to go head-to-head with the MAKE Controller.

But really, those are just nitpicks. Our real beef is with the software…the code editor specifically. If you find the Arduino editor aggravating, the mbed editor will have you seeing red (or maybe purple if you factor in all those blue LEDs). Like Arduino, there’s no true tab formatting; everything’s expanded to spaces, like it or not. Auto-indent cannot be disabled, and there’s seemingly no command to increase or decrease the indentation of a block of code. If you’re accustomed to anything more than arrow keys to move and click-and-drag to highlight text, the editor disregards a lot of system-native editing behaviors that may be deeply ingrained in your muscle memory (such as shift-clicking to select a range of text, or triple-click-and-drag for multiple contiguous lines). What’s more, the quirky behaviors are a little different across each browser and operating system. Don’t even try that triple-click-and-drag in Firefox for Mac…you won’t get your text cursor back without a complete reboot (seriously, just restarting the browser isn’t sufficient). And at present, only the most common browsers are supported; all others are currently shut out.

The closed-source nature of the tools may also be off-putting to some. If one finds the Arduino editor distasteful, there are options: get in there and change the code, or simply use a different editor and link with the Arduino libraries manually…it’s all legal and encouraged. With mbed, there are no alternatives. Access to the compiler and libraries is “free as in beer,” but not “free as in speech.” There’s little recourse should the service ever be taken down, or if they should suddenly start charging a subscription fee (there’s no indication this is planned, just a hypothetical scenario).

The good news, at least with regard to the former, is that software is of course infinitely more malleable than hardware, and it’s almost certain the tools will improve with time. The site is under active development…new “Home” and “Notebook” features were added for registered users just yesterday. Perhaps, given time, they’ll get the Command key working properly on the Mac. The selection of user-submitted code will expand regardless, making it progressively easier to do more and different things with this board.

In Summary

The mbed Tour page is frank about what the platform is good for, and what it’s not. mbed was intended as a quick prototyping and educational tool, and at that it excels. A lack of features such as a debugger or offline compiler keep this from being a professional-strength development platform, which is okay. Think of it as Arduino: The Next Generation. Although the mbed board costs more up front than Arduino, there are capabilities here that would otherwise require costly “shields” and strain every last byte and CPU cycle of the 8-bit ATmega328 processor: Ethernet, USB, SD cards…mbed handles these tasks with aplomb.

mbed is not without its flaws, and the “cloud” development approach may never sit right with some. For a product that’s just weeks out of beta testing, the results thus far are extremely encouraging. There’s immense potential here: a seriously powerful chip, easy to interface and to program. If the online tools can be improved, or if open source alternatives become available, mbed could be a major player. We expect to be seeing a lot more of this device in future hacks.

54 thoughts on “Review: Mbed NXP LPC1768 Microcontroller

  1. I’m using the mbed at my university with our own chip-level libraries and API, the source is available for free as well as plenty of documentation:

    They also offer a means of using GCC with the original MBED libraries, which might be more relevant.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.