MultiTech


MultiTech's official mbed team.

Pelion for Dragonfly

Information

This document is intended to lead the user through the process of getting the MTS_DRAGONFLY_F413RH up and running with Pelion.

  • If you encounter problems with this process please refer to the Pelion documentation for help.
  • If you find inaccuracies please let MultiTech know by opening a support case.

Connecting to Pelion

Prerequisites

  1. Install mbed CLI
  2. Serial terminal - PuTTY, TeraTerm
  3. Register mbed.com/ Pelion account

Provisioning

  1. Point your browser to https://www.mbed.com/en/
  2. Click log in/Sign up
  3. On the landing page click "Try Pelion Device Mangement with Mbed"
  4. Click on "Activate Pelion Device Management account"
  5. On the lower right, click on "Launch the Portal" to open the Pelion device management portal
  6. Select "Log in with Mbed.com"
  7. When prompted, accept the license agreement

Check tools

  • Open a command prompt on your computer and type:
     mbed --version
  • You need version 1.10.0 or later.

Import example application

  • From a command prompt type:
     mbed import https://github.com/MultiTechSystems/pelion-example
     cd pelion-example

Configure the APN

  • In the mbed_app.json file, set the APN to match your device. See "nsapi.default-cellular-apn".

Create a device certificate

  • In the Pelion Device Management portal, generate and download a developer device certificate
    1. Navigate to Device identity > Certificates
    2. Click New certificate
    3. Click Create a developer certificate
    4. Give your certificate a name, click Create certificate
    5. Click on your certificate's name in the list
    6. Click download Developer C file
    7. Replace the existing file in your project's root directory with this file

Create an API key

  1. In the Pelion portal, navigate to Access Management > API keys
  2. Click New API key
  3. Give your key a name. Choose the group Developers. Click Create API key
  4. Copy your API key

Create an update certificate

  • Install your API key as a global mbed configuration
     mbed config -G CLOUD_SDK_API_KEY <your-api-key>
  • From within your project directory, install the device management certificate. This creates a private and public key pair and initializes files in your project.
     mbed dm init -d "<your company name.com>" --model-name "<product model identifer>"

Compile and flash your application

     mbed compile -t GCC_ARM -m MTS_DRAGONFLY_F413RH
  • Drag and drop the compiled application onto the target device

Connect device to pelion

  1. Open your serial terminal and set the comm port to 115200bps
  2. Press the reset button
  3. Once the device is connect to the cellular network and register to Pelion it will print the device ID

Check device resources

  1. In the Pelion portal, click Device directory
  2. Click on a device ID
  3. Click Resources
  4. The Pelion example increments a counter when a character is typed on the debug port. This is reflected in resource /3200/0/5501 in the Pelion portal.

FOTA

  1. Make a small modification to main.cpp like changing or adding a printf
  2. Re-compile but do not flash
  3. Using the device ID issue the following command:
  • Note: The device ID can be found on the debug port when the device connected connects to Pelion or in the Pelion portal in the device directory.
      mbed dm update device -D <device ID> -m MTS_DRAGONFLY_F413RH
  • The previous command handles several actions:
    1. Upload the payload, generated by mbed compile, to Device Management.
    2. Hash the payload. Create a manifest that links to its location in Device Management.
    3. Create an update campaign for the supplied device ID, with the newly created manifest.
    4. Start the campaign. Wait for the campaign to complete.
    5. Delete the payload, manifest and update campaign out of Device Management
  • Download results
    1. On your serial terminal you can see the new image downloading to the storage.
    2. After the download in complete, the image will be authenticated.
    3. If authentication succeeds, the image is copied to internal flash.
    4. Then control is passed to the bootloader, which boots the application.
  • Return to the Pelion portal and see that the update is marked as successful.

Delta FOTA

Information

  1. Don't install the delta tool until after the original and new images have been compiled. The delta tool creates a delta file based on two previously compiled images.
  2. The device management update client is included in the Pelion example. So don't add it again.

For detailed documentation see

Pelion firmware update documentation

  • Summary overview:
    1. Install and initialize the manifest tool.
    2. Install Python 3 pyasn1 module.
    3. Register device.
    4. Working offline on a PC, compile the 'original firmware' then the 'new firmware'.
      1. We recommend a simple change to a printf for demonstration purposes.
      2. In order to compile each binary with a unique name, the name plus a timestamp can be defined using the command below (use back ticks not single quotes).
    5. Copy the delta tool into the Pelion example at the root, compile the diff tool and perform diff on the two files above to generate the delta bin file.
    6. Upload it to the Pelion portal and copy the delta file's URI.
    7. On your PC, build the manifest with the above URI and upload it to the Pelion portal.
    8. In the Pelion portal, create and start the update campaign, (using wizard), by selecting the appropriate delta image and target ID then starting the update campaign.
mbed compile -N pelion-example`date<space>+%s`

All wikipages