Mistake on this page?
Report an issue in GitHub or email us

Device Management for Mbed OS

Pelion Client is an abstraction of Device Management Client, and lets Mbed OS devices use Pelion Device Management services. Pelion Client:

  • Provides LwM2M Resources, which are variables that sync automatically through Device Management. Pelion Client makes it possible to expose sensors, actuators and other variables to a cloud service.
  • Supports firmware updates with just a few lines of code.
  • Runs separately from your main application; it does not take over your main loop.
  • Helps avoid blocking network operations in interrupt contexts, by automatically deferring actions to a separate thread.
  • Provides end-to-end Greentea tests for Device Management.

This guide builds on the quick connect guide, which creates a cloud-connected application for supported Mbed OS boards. The guide covers:

Tip: To learn more about Device Management Client, see the API documentation and the tutorials.

Device Management for your Mbed OS application

Requirements

Not every device (microcontroller, module or board) is capable of running device management features. You can add or extend some hardware capabilities, such as connectivity, storage and TRNG. Others are impossible or inconvenient to extend (for example, RAM or flash).

The minimum requirements to add device management feature to your application are:

  • RAM: 128 KiB or more.
  • Flash: 512 KiB or more.
  • Real Time Clock (RTC).
  • (Optional but recommended) True Random Number Generator (TRNG).
  • A storage device: SD card, SPI flash, QSPI flash or data flash.
  • IP connectivity: Ethernet, Wi-Fi, cellular, 6LoWPAN or Thread.

Additionally, we recommend the latest version of Mbed OS support the device and any additional complementary hardware components, or that they have support for the APIs provided in the latest releases of Mbed OS.

Useful references:

Adding Device Management connectivity to your application

  1. Add Pelion Client to your Mbed OS project:

    Note: the library is called simple-mbed-cloud-client.

    $ mbed add https://github.com/ARMmbed/simple-mbed-cloud-client
    

    If you do not have an Mbed OS project to add, you can create one with mbed new <your_application_name> and then run mbed add.

  2. Reference the library from the main.cpp file, and add network and storage drivers.

  3. Initialize the simple-mbed-cloud-client library:

    #include "simple-mbed-cloud-client.h"
    #include <Block device>
    #include <Filesystem>
    #include <Network>
    
    int main() {
    
        /* Initialize connectivity */
        NetworkInterface *net = NetworkInterface::get_default_instance();
        net->connect();
    
        /* Initialize storage */
        BlockDevice *bd = BlockDevice::get_default_instance();
        <Filesystem> fs("fs", &bd);
    
        /* Initialize SimpleMbedCloudClient */
        SimpleMbedCloudClient client(net, &bd, &fs);
        client.init();
    
        /* Create resource */
        MbedCloudClientResource *variable;
        variable = client.create_resource("3201/0/5853", "variable");
        variable->set_value("assign new value");
        variable->methods(M2MMethod::GET | M2MMethod::PUT);
    
    }
    
  4. Configure the API key for your Device Management account by specifying the API key as the global mbed configuration:

    $ mbed config -G CLOUD_SDK_API_KEY <your-api-key>
    

    Tip: If you don't have an API key available, log in to Device Management Portal, navigate to Access Management and API keys, and create a new one.

  5. Install the Device Management certificate:

    $ mbed dm init -d "<your company name.com>" --model-name "<product model identifier>"
    

This creates your private and public key pair and also initializes various .c files with these credentials, so you can use Connect and (firmware) Update device management features.

Example applications

To help you start quickly, refer to the application example. It demonstrates how to connect to the Device Management service, register Resources and get ready to receive a firmware update.

There are also several board-specific applications that focus on providing more elaborate hardware features with Mbed OS and Device Management. These are available in the Device Management quick start. See the reference table, organized by vendor name, for details:

Platform Connectivity Storage Example URL
Nuvoton NUMAKER-IOT-M487 Wi-Fi SD Card https://os.mbed.com/teams/Nuvoton/code/pelion-example-common/
Nuvoton NUMAKER-PFM-M487 Ethernet SD Card https://os.mbed.com/teams/Nuvoton/code/pelion-example-common/
Nuvoton NUMAKER-PFM-NUC472 Ethernet SD Card https://os.mbed.com/teams/Nuvoton/code/pelion-example-common/
NXP FRDM-K64F Ethernet SD Card https://os.mbed.com/teams/NXP/code/mbed-cloud-connect-example-ethernet
NXP FRDM-K66F Ethernet SD Card https://os.mbed.com/teams/NXP/code/mbed-cloud-connect-example-ethernet
Renesas GR-LCYHEE Wi-Fi SD Card https://os.mbed.com/teams/Renesas/code/pelion-example-common/
Sigma Delta Technologies SDT64B Ethernet SD Card https://os.mbed.com/teams/Sigma-Delta-Technologies/code/pelion-example-common
ST DISCO_L475E_IOT01A Wi-Fi QSPI https://os.mbed.com/teams/ST/code/pelion-example-disco-iot01/
ST DISCO_F413H Wi-Fi QSPI https://os.mbed.com/teams/ST/code/pelion-example-common/
ST DISCO_F746NG Ethernet QSPI https://os.mbed.com/teams/ST/code/pelion-example-common/
ST NUCLEO_F429ZI Ethernet SD Card https://os.mbed.com/teams/ST/code/pelion-example-common/
ST NUCLEO_F767ZI Ethernet SD Card https://os.mbed.com/teams/ST/code/pelion-example-common/
ST NUCLEO_F746ZG Ethernet SD Card https://os.mbed.com/teams/ST/code/pelion-example-common/
ST NUCLEO_F207ZG Ethernet SD Card https://os.mbed.com/teams/ST/code/pelion-example-common/
UBlox EVK ODIN W2 Wi-Fi SD Card https://os.mbed.com/teams/ublox/code/pelion-example-common/
UBlox C030 U201 Cellular SD Card https://os.mbed.com/teams/ublox/code/pelion-example-common/
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.