This is a basic Mbed OS project for micro:bit V2.
- Git
- Mercurial
- Arm GCC
- v7.3.1 is the oldest and v10.2.1 the last tested versions
- Python 3
- Tested with Python 3.7.12
- Mbed CLI
- v1.10.2, and v1.10.5 are the last tested versions
- Can be installed using one of the methods from the official documentation: https://os.mbed.com/docs/mbed-os/v6.15/build-tools/install-and-set-up.html
- The installers are outdated and not recommended
- If installed via pip a virtual environment is recommended
This project contains multiple Mbed OS "targets" for different versions of the micro:bit V2 board and for the Nordic nRF52833 DK development board.
nrf52_microbit_v2
: Target for all production micro:bit V2 board versions.nrf52833_dk
: For the Nordic nRF52833 DK board (useful for testing).
Other targets are available for micro:bit V2 prototype boards, and their
names can be found in the mbed_app.json file.
These are essentially the same as the nrf52_microbit_v2
target, but for code
to support multiple boards it is useful to have different target names to be
able to do conditional compilation of pins, I2C addresses, etc, as shown in the
sensors.cpp example code.
Even older prototype targets can be found in the mbedos-softdevice
branch.
The version of the micro:bit V2 board can be seen on the silkscreen at the back, near the right side of the edge connector.
The micro:bit V2.2 contains an nRF52 microcontroller as the Interface MCU and Mbed OS targets has been created to be able to create Mbed OS project for these microcontrollers as well.
nrf52_microbit_v2_if_820
: Target for micro:bit V2.2 with a nRF52820 Interface MCU.nrf52_microbit_v2_if_833
: For a micro:bit V2.2 with a nRF52833 Interface MCU. This target is configured to be identical to the nrf52820 builds (including reduced RAM & Flash), with the only difference being some pin assignments.
Note that for the mbed target ...
line you should select the right target
for your board.
git clone https://github.com/microbit-foundation/mbedos-microbit-v2-starter.git
cd mbedos-microbit-v2-starter
mbed config root .
mbed target nrf52_microbit_v2
mbed toolchain GCC_ARM
mbed deploy
If it fails to install some of the Python dependencies on the last command
(mbed deploy
) you can try to install them manually.
Run this command in the Python environment that has mbed-cli
installed:
pip install -r mbed-os/requirements.txt
Warning: Do not use mbed new .
as it can update MbedOS to the latest
version, and this is often unwanted.
mbed compile
Or if you want to manually add the flags previously configured in the project on the "Initialise" section:
mbed compile -m nrf52_microbit_v2 -t GCC_ARM
Build output can be found in: ./BUILD/NRF52_MICROBIT_V2/GCC_ARM/mbedos-microbit-v2-starter.hex
If mbed
cannot find the tools directory in mbed-os, then you may have to
delete the mbed cache by removing ~/.mbed/
.
This repo is currently configured Mbed OS to version 6.13.0.