New Arduino Nano Boards Run Arm’s Mbed OS

Earlier in the year, at the last ever Maker Faire Bay Area, Arduino introduced a new family of Arduino Nano boards. While the Arduino Nano…

Alasdair Allan
5 years agoInternet of Things

Earlier in the year, at the last ever Maker Faire Bay Area, Arduino introduced a new family of Nano boards. While the Nano Every and the Nano 33 IoT were built around the Microchip ATmega4809 and SAM D21 respectively, the Nano 33 BLE and Nano 33 BLE Sense were based on the Nordic nRF52840. Which poses a bit of a problem as, unlike the Microchip processors of the two other new Nanos, there wasn’t an existing official Arduino core for the Nordic chip.

The solution? Build the Arduino core on top of Arm’s Mbed OS.

Without an officially supported core there were three options to get the Arduino core running on the Nordic chip at the heart of the Nano 33 BLE and 33 BLE Sense; write a new core from scratch, build the core on top of Nordic’s SoftDevice, or on top of Arm’s Mbed OS.

Writing a new core wasn’t an option, as it would take too much time, and impose too high a support burden for just a single pair of boards in the Arduino range. Though Nordic’s SoftDevice isn’t open source. That left building the Arduino core for the Nano 33 BLE and 33 BLE Sense on top of Arm’s Mbed OS.

“…Mbed is a fully preemptive RTOS (real-time operating system), meaning you can run multiple ‘programs’ (more specifically, threads) at the same time, much like what happens in your notebook or smartphone. At Arduino, we have been looking for an RTOS to use on our more advanced boards for a long time but we never found something we liked until we started working with the Mbed OS. Programming an RTOS is usually quite complicated (every university grade course on operating systems will be full of frightening terms like ‘mutex’ and ‘starvation’), but you don’t have to worry if you just want to use it as an Arduino; setup() and loop() are in their usual place, and nobody will mess with your program while it’s running.”—Martino Faccin

However, just because the new Nano 33 BLE and 33 BLE Sense look and feel like any other Arduino on the surface, it doesn’t mean that you can’t dig down to the underlying Mbed OS from your code if you want.

More interestingly than that, because Arduino has effectively ‘ported’ the Arduino core to Mbed OS, they effectively support every board that runs the Mbed OS. You can now program any board running Mbed OS as if it was an Arduino.

This means you can use Arduino core for Mbed OS to load any Arduino library or sketch as part of an Mbed OS program.

“…it will give Arduino users a much bigger standard library of high quality components including an RTOS, two file systems, networking stacks and automatic power management. And second, this also brings the Arduino core as a library to Mbed OS, giving Mbed OS applications access to the huge set of Arduino peripheral drivers through a standard interface.”—Jan Jongboom

Despite the quiet announcement then, this is a lot more intriguing than it might initially look on the surface. While it’s going to take a while for the full implications to sink in, having an Arduino code for Mbed OS-enabled devices is going to be of huge benefit to both communities, and reduce the barriers of access. Which can only be a good thing.

If you want to take a look at the core you can take a look at the code in the project’s GitHub repo, and Jan Jongboom has also published example code showing how to run Arduino sketches on Mbed OS boards.

Alasdair Allan
Scientist, author, hacker, maker, and journalist. Building, breaking, and writing. For hire. You can reach me at 📫 alasdair@babilim.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles