A first look at the mbed platform and the recently launched Application Board.
I'm embarrassed to admit that the mbed platform has remained on my must-properly-investigate list for quite a long time. In fact, from since just before mbed's Chris Styles presented at an OSHUG meeting back in September 2010, and for whatever reason — most likely a pre-occupation with numerous other things of a technical nature — I haven't get round to taking a closer look until now.
What follows is by no means a thorough exploration of all the features that the mbed platform provides — that would require a much longer post — but rather instead a look at the out-of-box experience with an mbed module and the brand new Application Board.
It's safe to say that this won't be the last post on the topic!
There are two current versions of the mbed module and the one covered here is the ARM Cortex-M3 based LPC1768 variant rather than the Cortex-M0 based one.
Inside the box could be found the mbed module, a USB cable, a sticker, a handy laminated card with a graphic depicting the pinout and a simple setup guide.
The mbed itself is a remarkably compact design, with the LPC1768 variant packing a 32-bit ARM Cortex-M3 clocked at 96MHz, with 32K RAM and 512K flash. Plus Ethernet, USB host/device, 2xSPI, 2xI2C, 3xUART, CAN, 6xPWM, 6xADC and GPIO. The board also incorporates voltage regulators and is able to run on supplies of 4.5-14v and provides 3.3v and 5v outputs.
The microcontroller includes an Ethernet PHY and so only the addition of a MagJack is required, and a UTP patch lead with one end cut off can be used instead as a quick and dirty hack.
Part of the magic of the platform is that mbed appears as USB flash storage and no drivers are required for programming, and this is made possible by a second microcontroller on the underside.
The Application Board provides sockets for Ethernet, USB and analogue input/output, along with a dizzying selection of peripheral devices for a board of its size. Including I2C temperature sensor and accelerometers, SPI LCD, 2x potentiometers, a 5-way switch, RGB LED and loudspeaker. The board is also able to accommodate a ZigBee or WiFi module and a USB 3G modem is supported.
In addition to a novel means of loading firmware, another key characteristic of mbed is the use of an online compiler, and together these make it possible to be up and running with the platform in no time at all and without having to install any software onto your workstation.
The mbed SDK provides a “C/C++ startup environment and peripheral abstraction libraries”, which brings the convenience of a tried-and-tested high-level API for peripherals. Although this is intended for prototyping the licence also permits its use in finished products.
On plugging the mbed into a computer a USB storage device appears and this contains a single file.
Opening the file in a web browser takes you to mbed.org and at which point you're able to sign-up for an account if you don't already have one. Ownership of mbed hardware is a requirement for access to the online tools and this serves to keep the noise level in the community down.
Registration takes only a moment and upon completion you are presented with a welcome screen, and in my case this notified me that a firmware update was available for my mbed. Performing the update was simply a matter of saving a file to the flash storage and resetting the module.
The online compiler is integrated with Mercurial, allowing for source code to be managed through revision control and with the ability to view a log/graph of changes and to revert these, and switch between revisions and merge them with the working copy.
On creating a new program this is pre-populated with the few lines of code required for the embedded hello world: a blinking LED!
Selecting compile results in a brief delay before a binary is returned for saving to the mbed flash storage, after which the module must be reset by pressing the button on the top.
Incidentally, that same flash storage is also accessible to programs by using the local filesystem. However, for obvious reasons it can't be accessed by a program and over USB at the same time.
The mbed Cookbook is a wiki for community contributed resources and there a page is provided for the Application Board, with example code for the peripheral devices.
Examples are clearly formatted and include a link that allows them to be quickly imported into the compiler.
In this case a trivial change was made to the LCD example code before compilation.
Examples are provided for all of the Application Board's onboard peripheral devices plus an optional WiFi module, 3G dongle and servos. USB device examples are provided for mouse, keyboard, serial and HID, and USB host use with a memory stick.
Ethernet examples are included for NTP and a HTTP client, and also for WebSocket applications and with a server being provided that can be used in simple tests.
It should be pointed out that this is just the tip of the iceberg and the Cookbook includes a great many more programs and libraries that can be used in projects!
Offline tool support
As great as the online compiler is it may not be for everyone, as some will have already invested in offline tools and may have local revision control and workflows etc. that are integrated with these.
The online compiler allows programs to be exported for use with the following offline tools:
Keil uVision 3
code_red Red Suite 4
Code Sourcery GCC
ARM Embedded GCC
In addition to which it's possible to export a ZIP archive of the project as-is and use a Mercurial client to directly clone a project repository which has been published.
At the core of the mbed hardware is a capable device with a rich selection of I/O and plenty of headroom for the majority of microcontroller applications. The highly compact Application Board builds upon this to add many commonly used peripheral devices with great support resources.
The mbed experience is well polished and optimised for ease of use and prototyping speed, all the way from unpacking and small things such as the inclusion of a laminated card clearly depicting the module pinout, to the formatting of online example code and integration of this with the compiler.
This post has barely scratched the surface of the value of the mbed SDK, and online community and resources, and these are things that deserve further exploration via a future post!Follow
1 likeLike this