MultiTech's official mbed team.
This document is intended to lead the user through the process of getting the MTS_DRAGONFLY_F413RH up and running with Pelion.
Connecting to Pelion¶
- Install mbed CLI
- Serial terminal - PuTTY, TeraTerm
- Register mbed.com/ Pelion account
- Point your browser to https://www.mbed.com/en/
- Click log in/Sign up
- On the landing page click "Try Pelion Device Mangement with Mbed"
- Click on "Activate Pelion Device Management account"
- On the lower right, click on "Launch the Portal" to open the Pelion device management portal
- Select "Log in with Mbed.com"
- When prompted, accept the license agreement
- Open a command prompt on your computer and type:
- 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
- Navigate to Device identity > Certificates
- Click New certificate
- Click Create a developer certificate
- Give your certificate a name, click Create certificate
- Click on your certificate's name in the list
- Click download Developer C file
- Replace the existing file in your project's root directory with this file
Create an API key¶
- In the Pelion portal, navigate to Access Management > API keys
- Click New API key
- Give your key a name. Choose the group Developers. Click Create API key
- 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¶
- Open your serial terminal and set the comm port to 115200bps
- Press the reset button
- Once the device is connect to the cellular network and register to Pelion it will print the device ID
Check device resources¶
- In the Pelion portal, click Device directory
- Click on a device ID
- Click Resources
- 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.
- Make a small modification to main.cpp like changing or adding a printf
- Re-compile but do not flash
- 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:
- Upload the payload, generated by mbed compile, to Device Management.
- Hash the payload. Create a manifest that links to its location in Device Management.
- Create an update campaign for the supplied device ID, with the newly created manifest.
- Start the campaign. Wait for the campaign to complete.
- Delete the payload, manifest and update campaign out of Device Management
- Download results
- On your serial terminal you can see the new image downloading to the storage.
- After the download in complete, the image will be authenticated.
- If authentication succeeds, the image is copied to internal flash.
- 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.
- 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.
- The device management update client is included in the Pelion example. So don't add it again.
For detailed documentation see
- Summary overview:
- Install and initialize the manifest tool.
- Install Python 3 pyasn1 module.
- Register device.
- Working offline on a PC, compile the 'original firmware' then the 'new firmware'.
- We recommend a simple change to a printf for demonstration purposes.
- 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).
- 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.
- Upload it to the Pelion portal and copy the delta file's URI.
- On your PC, build the manifest with the above URI and upload it to the Pelion portal.
- 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`