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"
- In the upper right, click on "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".
Creating 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
- Gvie you 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
Creating 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
Creating update certificate¶
- Install your API key as a global mbed configuration
mbed config -G CLOUD_SKD_API_KEY <your-api-key>
- From within your project directory, install the device management certificate. This creates a private and public key pari and initializes files in your project.
mbed dm inti -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
- Make a small modification to main.cpp like changing or adding a printf
- Re-compile but do not flash
- Using the device ID that is displayed in the terminal window after the device connected to Pelion issue the following command:
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.
- 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`