Mbed CE: Official Support for Arduino Nano 33 BLE

I’m happy to announce that Mbed OS Community Edition now has official support for the Arduino Nano 33 BLE! This means that you can now build and flash code for it straight from the Mbed CE build system, with no extra configuration required.

A bit of background

The Nano 33 BLE has been “almost” supported by Mbed for a while: Mbed supports the nRF52840 MCU that it uses, and there are even pin configuration files that correctly map the pins on the Arduino PCB. However, it didn’t quite work out of the box as of Mbed 6.16:

  • The Arduino bootloader used on the chip was not supported by Mbed tooling
  • The linker script was set up wrong and couldn’t generate binaries that coexisted with the bootloader
  • Mbed assumes existence of a USB-serial adapter for console prints, but the Arduino must use USB CDC mode and send the console over the USB port

When Arduino added support for the Nano 33 BLE (among other Mbed chips) to their framework, they had to take Mbed and apply a bunch of patches and libraries on top to work around these issues and get something that would work out of the box on their boards.

In Mbed CE, we have added new solutions for these issues, including a new ArduinoBossac upload method that talks to the bootloader and new infrastructure for automatically using the USB port to provide console output when required by a target. Additionally, we have added a Nano 33 BLE to our CI test infrastructure, and confirmed that nearly all the tests are passing on real hardware (except the USB ones, plz halp). What this means is, you can now grab Mbed CE master branch and run it on a Nano 33 BLE with no additional changes!

Using Mbed on Nano 33 BLE

If you have a board around, booting up Mbed on the Nano 33 BLE is pretty simple. First, follow the normal process to create an Mbed CE project, either by copying the hello world example or by creating a new project from scratch. Next, install the ArduinoBossac upload tool, using the instructions near the bottom here. Then, compile the project, setting MBED_TARGET=ARDUINO_NANO33BLE and UPLOAD_METHOD=ARDUINO_BOSSAC. Finally, plug in your board and put it into bootloader mode (double-tap reset), and flash code using the Mbed project (by building the flash-<your program name> target).

Additionally, if you have an SWD debugger soldered to your Nano, Mbed can use that too. Just set MBED_TARGET to ARDUINO_NANO33BLE_SWD and UPLOAD_METHOD to PYOCD or OPENOCD.

For more details, important info, and instructions on doing the debugger mod, check out the Nano 33 BLE MCU Info page here!

5 Likes

So that you have something to run on this board, I also converted the build system of the BLE Examples repo so that it works with Mbed CE: GitHub - mbed-ce/mbed-os-example-ble: BLE examples using Mbed OS Community Edition

And hey, with the Mbed CE buildsystem changes, now we can just have all of the examples in one project instead of splitting them across like 10 different projects! Copying files or downloading extra dependencies (aside from the submodules) is no longer needed.

Next steps are testing them out and setting up CI on that repo.

1 Like