Command-line tutorial for the advanced Device Management Client example with an Mbed OS device
This is an advanced Device Management Client example (mbed-cloud-client-example) for Mbed OS device with the following features:
- Support for latest Mbed OS and Device Management Client releases.
- Support for multiple operating systems.
- Support for developer and production mode provisioning.
- Support for firmware update.
- Support for delta firmware update.
- Support for advanced network stack and Pelion features.
- Configuring Device Management Client.
- Compiling and flashing Device Management Client.
- Connecting and performing a firmware update on your device.
The Device Management Client version used for the tutorial is 4.0.0 or later.
Here is how the different Device Management Client example application and Mbed OS versions work together:
|Device Management Client||3.3.0||3.4.0||4.0.0||4.1.0||4.2.0||4.3.0|
|Mbed OS 5.13||Works out-of-box||Works out-of-box||Works out-of-box||Works out-of-box||Works out-of-box||Requires changes|
|Mbed OS 5.14||Works out-of-box||Works out-of-box||Works out-of-box||Works out-of-box||Works out-of-box||Requires changes|
|Mbed OS 5.15||Works out-of-box||Works out-of-box||Works out-of-box||Works out-of-box||Works out-of-box||Works out-of-box|
The highlighted combinations have been tested as part of the release. Other combinations should mostly work as listed, although some minor issues may appear.
Due to upcoming changes in Mbed OS 6.0 APIs, 4.3.0 version of the application is no longer backwards compatible with older Mbed OS releases.
You can use this tutorial with the following boards. The default stack configuration is in the
|Board/MCU||Default stack||Other stacks||DAPLink or STLink||Storage for credentials and FW candidate||Notes|
||Ethernet||Wi-Fi||DAPLink||SD card / Internal flash (
(1)Wi-Fi configuration is available in
(1a)RAM-optimized configuration for K64F is available in
configs/wifi_esp8266_minimal.json. It uses only internal flash storage and does not require an SD card.
(2)Wi-SUN configuration is available in
(3)For Wi-Fi stacks, you need to add your SSID and password information to the configuration file.
(4)The Platform Security Architecture (PSA) target configuration is available in the
(4a)PSA Wi-Fi configuration is available in
(4b)PSA ethernet configuration is available in
(4c)PSA ethernet configuration for ATECC608A secure element is available in
configs-psa/eth_v4_with_se_atmel.json. For the full secure element tutorial, see Connecting to Device Management with a pre-provisioned ATECC608A secure element
(5)This board supports only ARMC6 compiler. Due to the limited flash size of the board, you can only compile with the release profile.
LPC55S69_NSalso requires a separately wired SD card adapter. See the application configuration for pin mapping. The internal SD card slot is not supported.
--app-config option does not support relative paths used for linking the bootloader binary files, thus all configuration files must be copied to the application root-level. Alternatively, you can also copy the configuration file over the default
For Mesh, we recommend that you use a router compiled with same version of Mbed OS as the application. For Wi-SUN stack, also the Wi-SUN certificates (
configs/wisun_certificates.h) need to match between the application and the router. See the Github repository for the Device Management-enabled managed Pelion Border Router or the unmanaged Nanostack Border Router.
To work with the Device Management Client example application, you need:
- A supported board with a network connection and an SD card attached.
- Serial connection to your device with open terminal connection (baud rate 115200, 8N1).
- Arm Mbed CLI installed. See installation instructions.
- Make sure that all the Python components are in par with the
pippackage requirements.txt list from Mbed OS.
- Make sure that all the Python components are in par with the
- An API key (with
Administratorsgroup privilages) for your Device Management account.
- Updated DAPLink software (version 250 or later), if your board uses DAPLink.
Configuring Device Management Client
Clone the embedded application's GitHub repository to your local computer and navigate to the new folder:
mbed import https://github.com/ARMmbed/mbed-cloud-client-example cd mbed-cloud-client-example
Configure Mbed CLI to use your Device Management account and board:
mbed config -G CLOUD_SDK_API_KEY <API_KEY> mbed target <MCU> mbed toolchain GCC_ARM
Use Mbed CLI to download a developer certificate and to create an update-related configuration for your device:
mbed device-management init -d arm.com --model-name example-app --force -q
Compiling and flashing Device Management Client
To compile the example application:
Read more detailed instructions on the parameters related to Mbed CLI and
Flashing the binary to the device
To flash the binary to the device:
- Connect the device to your computer over USB. It's listed as a mass storage device.
- Drag and drop
mbed-cloud-client-example.binto the device. This flashes the binary to the device. You should see the LED blink rapidly; wait for it to stop.
Connecting and performing a firmware update on your device
Checking the device connection and obtaining the Device ID
- Press the Reset button to restart the device.
- Obtain your device's Device ID either from device console logs or from Device Management Portal.
When the client has successfully connected, the terminal shows:
Client registered Endpoint Name: <Endpoint name> Device ID: <Device ID>
To verify the connection with Device Management Portal:
- Log in to Device Management Portal.
- Select Device directory from the menu on the left.
- When your device is listed on the Devices page, it is connected and available.
Your device is now connected and ready for the firmware update. For development devices, the Endpoint name and Device ID are identical.
Updating the firmware
To update the firmware on your device:
mbed device-management update device -D <Device ID>
When the update starts, the client tracing log shows:
Firmware download requested Authorization granted Downloading: [++++++++++++++++++++++++++++++++++++++++++++++++++] 100 % Download completed Firmware install requested Authorization granted
After this, the device reboots automatically and registers to Device Management.