Difference between revisions of "Pdmc"

From ESS-WIKI
Jump to: navigation, search
(Created page with "== Pelion Device Management Client Example == <div style="margin-left:0.847cm;margin-right:0cm;"> This example is demonstrate how to connect to Pelion Device Management. Pleas...")
 
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Pelion Device Management Client Example ==
+
== ARM Pelion ==
 +
 
 +
=== Pelion Device Management Client Example ===
 
<div style="margin-left:0.847cm;margin-right:0cm;">
 
<div style="margin-left:0.847cm;margin-right:0cm;">
 
This example is demonstrate how to connect to Pelion Device Management. Please follow the below steps to give it a try.
 
This example is demonstrate how to connect to Pelion Device Management. Please follow the below steps to give it a try.
  
:'''Step01:''' Get source code and compile it by mbed CLI.<br/>
+
:'''Step01:''' Prepare an Mbed account<br/>
:Please click [https://github.com/ADVANTECH-Corp/WISE-1570-Rf-Bridge "Link to source"] and review the file "README.md" to know how to deployment and compilation with this example. The output binary will be "source_dir/BUILD/WISE_1570/GCC_ARM/WISE-1570-Rf-Bridge.bin"<br/>
+
:Before a device connected to Pelion Device Management, the user need an Mbed account. please refer to the below link to sign up<br/>
 +
 
 +
::*An Mbed account - [https://os.mbed.com/account/login/ "sign up if you don't have one."]
 +
 
 +
::*Access to Pelion Device Management - [https://console.mbed.com/cloud-registration "request access here"]
 +
 
 +
 
 +
 
 +
:'''Step02:''' Create developer certificate.<br/>
 +
:Please click [https://portal.mbedcloud.com/identity/certificates "link to create certificate"] and follow the below steps to create a new one.
 +
 
 +
::*Click the "New certificate"
 +
 
 +
[[File:Wise1570 pdmc 07.png|center|900px|Wise1570 pdmc 07.png]]
 +
 
 +
 
 +
 
 +
::*Click the "Create a developer certificate" in pop-up window
 +
 
 +
[[File:Wise1570 pdmc 08.png|center|400px|Wise1570 pdmc 08.png]]
 +
 
 +
 
 +
 
 +
::*Give a name of your certificate and click "Create certificate"
 +
 
 +
[[File:Wise1570 pdmc 09.png|center|900px|Wise1570 pdmc 09.png]]
 +
 
 +
 
 +
 
 +
::*Click the "Download Developer C file" to download the certificate and get the file "mbed_cloud_dev_credentials.c"
 +
 
 +
[[File:Wise1570 pdmc 10.png|center|900px|Wise1570 pdmc 10.png]]
 +
 
 +
 
 +
 
 +
:'''Step03:''' Get source code and compile it by mbed CLI.<br/>
 +
:Please click [https://github.com/ADVANTECH-Corp/WISE-1570-Pelion-Device "Link to source"] and review the file "README.md" to know how to deployment and compilation with this example. The output hex file will be "source_dir/BUILD/WISE_1570/GCC_ARM/WISE-1570-Pelion-Device.hex"<br/>
 +
 
 +
 
 +
 
 +
:'''Step04:''' Flash programming by DAPLink on WISE-DB-1505<br/>
 +
:Check device connected to PC using micro-USB cable and use drag-and-drop programming with your hex file.<br/>
 +
 
 +
 
 +
 
 +
:'''Step05:''' Access sensor data in Pelion Device Management Portal
 +
::*Open browser and go to [https://portal.mbedcloud.com/devices "Device Management Portal's Device Directory page."]. The user will see the list of devices.
 +
 
 +
[[File:Wise1570 pdmc 02.png|center|900px|Wise1570 pdmc 02.png]]
 +
 
  
[[File:WISE-1570-FirstExample 01.png|center|500px|WISE-1570-FirstExample 01.png]]
 
  
 +
::*Click the device ID and select the "RESOURCES" tab to view the device's exposed LwM2M resources.
  
 +
[[File:Wise1570 pdmc 03.png|center|900px|Wise1570 pdmc 03.png]]
  
:'''Step02:''' Prepare an Mbed account<br/>
 
:Before a device connected to Pelion Device Management, the user need an Mbed account. please refer to the below link to sign up<br/>
 
::
 
*An Mbed account - [https://os.mbed.com/account/login/ "sign up if you don't have one."]
 
::*Access to Pelion Device Management - [https://console.mbed.com/cloud-registration "request access here"]
 
  
  
 +
::*Scroll down to locate the resource temperature or humidity.
 +
 +
[[File:Wise1570 pdmc 04.png|center|900px|Wise1570 pdmc 04.png]]
 +
 +
 +
 +
::*Click "temperature - Sensor Value" or "humidity - Sensor Value" to open the graph and observe the sensor's data changed.
 +
 +
[[File:Wise1570 pdmc 05.png|center|800px|Wise1570 pdmc 05.png]]
 +
 +
 +
</div>
 +
 +
 +
=== OTA with PDMC ===
 +
<div style="margin-left:0.847cm;margin-right:0cm;">
 +
The “Over the Air” (OTA) is method for firmware update. For PDMC, we need to prepare two firmwares, one is programmed into WISE-1570 and anthoer is hosted in your PC, and use the manifest tool to demonstrate how it works. Please follow the below steps to give it a try.
 +
 +
 +
 +
:'''Step01:''' Create an API key on Pelion Device Management Portal<br/>
 +
 +
:*Click the "New API key"
 +
 +
[[File:Wise1570 ota 01.png|center|900px|Wise1570 ota 01.png]]
 +
 +
 +
 +
:*Give a "API key name" and select the "Developers" group
 +
 +
[[File:Wise1570 ota 02.png|center|400px|Wise1570 ota 02.png]]
 +
 +
 +
 +
:*Copy the API key and API host, then save it in your PC
 +
::<span style="color:red">Please note that the key is only available once, so please be sure to copy it.</span>
 +
 +
[[File:Wise1570 ota 03.png|center|400px|Wise1570 ota 03.png]]
 +
 +
 +
 +
:'''Step02:''' Install manifest tool<br/>
 +
:The manifest tool is compatible both with Python 2.7.11 and later and with Python 3.5.1 and later.<br/>
 +
 +
:*Option1: install from PyPi with pip
 +
 +
:<pre>$ pip install manifest-tool</pre>
 +
 +
:*Option2: install from GitHub over HTTPS.
 +
 +
:<pre>$ pip install git+https://github.com/ARMmbed/manifest-tool.git</pre>
 +
 +
 +
 +
:'''Step03:''' Create a new project<br/>
 +
 +
:*Initialize by manifest-tool.
 +
:<pre>$ manifest-tool init -d "<company domain name>" -m "<product model identifier>" -a "<Device Management API Key>" -S "<Device Management Alternative API address>"</pre>
 +
 +
:*Example:
 +
:<pre>$  manifest-tool init -d "www.advantech.com" -m "wise-1570" -a "ak_1MDE1N2ZmZTA5ZGEzMDAaMjBhM12wZjBkMDAwMD87MDA016a00d388945e0274c21077000000004bkctykMAhnUTAQssYpFmNLRJhHS2PxR" -S "https://api.us-east-1.mbedcloud.com"</pre>
 +
 +
:*Fill in the information.
 +
 +
[[File:Wise1570 ota 04.png|center|800px|Wise1570 ota 04.png]]
 +
 +
:*Output files
 +
 +
[[File:Wise1570 ota 05.png|center|550px|Wise1570 ota 05.png]]
 +
 +
 +
 +
:'''Step04:''' Add certificate into source tree and rebuild the PDMC<br/>
 +
:*Please replace the file "update_default_resources.c" generated by manifest tool into your source tree.<br/>
 +
:*Build out the hex file and it will be "source_dir/BUILD/WISE_1570/GCC_ARM/WISE-1570-Pelion-Device.hex"
 +
 +
 +
 +
:'''Step05:''' Flash programming by DAPLink on WISE-DB-1505<br/>
 +
:Check device connected to PC using micro-USB cable and use drag-and-drop programming with your hex file.<br/>
 +
 +
 +
 +
:'''Step06:''' Build the new PDMC that has "OTA" string displayed on console<br/>
 +
:*Comment out the macro "OTA_TEST" in main.cpp and rebuild the PDMC.<br/>
 +
:*The output binary will be "source_dir/BUILD/MTB_ADV_WISE_1570/GCC_ARM/WISE-1570-Pelion-Device_update.bin
 +
 +
 +
 +
:'''Step07:''' Launch OTA<br/>
 +
:*Launch OTA by mainfest tool (PC):
 +
:<pre>$ manifest-tool update device -p <payload> -D <device ID></pre>
 +
 +
:*Example:
 +
:<pre>$ manifest-tool update device -p WISE-1570-Pelion-Device_update.bin -D 016a533470bb000000000001001003ca</pre>
 +
 +
:*You will see the state keep on publishing (PC)<br/>
 +
 +
[[File:Wise1570 ota 06.png|center|550px|Wise1570 ota 06.png]]
 +
 +
:*Get request on endpoint (Device)<br/>
 +
 +
[[File:Wise1570 ota 07.png|center|550px|Wise1570 ota 07.png]]
  
:'''Step02:''' Flash programming by WISE-ED22<br/>
+
:*Download in progress (Device)<br/>
:Check device connected from WISE-ED22 to PC using micro-USB cable and use drag-and-drop programming with your binary.<br/>
 
  
[[File:WISE-1570-FirstExample 02.png|center|700px|WISE-1570-FirstExample 02.png]]
+
[[File:Wise1570 ota 08.png|center|550px|Wise1570 ota 08.png]]
  
 +
:*Check integrity with the firmware image (Device)<br/>
  
 +
[[File:Wise1570 ota 09.png|center|550px|Wise1570 ota 09.png]]
  
:'''Step03:''' Get the version of RF by AT command "AT+CGMR"
+
:*You will see "OTA" string on console after reboot (Device)<br/>
:*Choose any terminal you like. (e.g., the snapshot is setting of Tera Term.)
 
:*Please set terminal as the below setting:
 
::Baud rate: 9600
 
::Data: 8bit
 
::Parity: None
 
::Stop: 1bit
 
::Flow control: None
 
:*Type AT command "AT+CGMR" and see the response on the console.
 
  
[[File:WISE-1570-FirstExample 03.png|center|300px|WISE-1570-FirstExample 03.png]]
+
[[File:Wise1570 ota 10.png|center|550px|Wise1570 ota 10.png]]
  
  
 
</div>
 
</div>

Latest revision as of 10:46, 6 May 2019

ARM Pelion

Pelion Device Management Client Example

This example is demonstrate how to connect to Pelion Device Management. Please follow the below steps to give it a try.

Step01: Prepare an Mbed account
Before a device connected to Pelion Device Management, the user need an Mbed account. please refer to the below link to sign up


Step02: Create developer certificate.
Please click "link to create certificate" and follow the below steps to create a new one.
  • Click the "New certificate"
Wise1570 pdmc 07.png


  • Click the "Create a developer certificate" in pop-up window
Wise1570 pdmc 08.png


  • Give a name of your certificate and click "Create certificate"
Wise1570 pdmc 09.png


  • Click the "Download Developer C file" to download the certificate and get the file "mbed_cloud_dev_credentials.c"
Wise1570 pdmc 10.png


Step03: Get source code and compile it by mbed CLI.
Please click "Link to source" and review the file "README.md" to know how to deployment and compilation with this example. The output hex file will be "source_dir/BUILD/WISE_1570/GCC_ARM/WISE-1570-Pelion-Device.hex"


Step04: Flash programming by DAPLink on WISE-DB-1505
Check device connected to PC using micro-USB cable and use drag-and-drop programming with your hex file.


Step05: Access sensor data in Pelion Device Management Portal
Wise1570 pdmc 02.png


  • Click the device ID and select the "RESOURCES" tab to view the device's exposed LwM2M resources.
Wise1570 pdmc 03.png


  • Scroll down to locate the resource temperature or humidity.
Wise1570 pdmc 04.png


  • Click "temperature - Sensor Value" or "humidity - Sensor Value" to open the graph and observe the sensor's data changed.
Wise1570 pdmc 05.png



OTA with PDMC

The “Over the Air” (OTA) is method for firmware update. For PDMC, we need to prepare two firmwares, one is programmed into WISE-1570 and anthoer is hosted in your PC, and use the manifest tool to demonstrate how it works. Please follow the below steps to give it a try.


Step01: Create an API key on Pelion Device Management Portal
  • Click the "New API key"
Wise1570 ota 01.png


  • Give a "API key name" and select the "Developers" group
Wise1570 ota 02.png


  • Copy the API key and API host, then save it in your PC
Please note that the key is only available once, so please be sure to copy it.
Wise1570 ota 03.png


Step02: Install manifest tool
The manifest tool is compatible both with Python 2.7.11 and later and with Python 3.5.1 and later.
  • Option1: install from PyPi with pip
$ pip install manifest-tool
  • Option2: install from GitHub over HTTPS.
$ pip install git+https://github.com/ARMmbed/manifest-tool.git


Step03: Create a new project
  • Initialize by manifest-tool.
$ manifest-tool init -d "<company domain name>" -m "<product model identifier>" -a "<Device Management API Key>" -S "<Device Management Alternative API address>"
  • Example:
$  manifest-tool init -d "www.advantech.com" -m "wise-1570" -a "ak_1MDE1N2ZmZTA5ZGEzMDAaMjBhM12wZjBkMDAwMD87MDA016a00d388945e0274c21077000000004bkctykMAhnUTAQssYpFmNLRJhHS2PxR" -S "https://api.us-east-1.mbedcloud.com"
  • Fill in the information.
Wise1570 ota 04.png
  • Output files
Wise1570 ota 05.png


Step04: Add certificate into source tree and rebuild the PDMC
  • Please replace the file "update_default_resources.c" generated by manifest tool into your source tree.
  • Build out the hex file and it will be "source_dir/BUILD/WISE_1570/GCC_ARM/WISE-1570-Pelion-Device.hex"


Step05: Flash programming by DAPLink on WISE-DB-1505
Check device connected to PC using micro-USB cable and use drag-and-drop programming with your hex file.


Step06: Build the new PDMC that has "OTA" string displayed on console
  • Comment out the macro "OTA_TEST" in main.cpp and rebuild the PDMC.
  • The output binary will be "source_dir/BUILD/MTB_ADV_WISE_1570/GCC_ARM/WISE-1570-Pelion-Device_update.bin


Step07: Launch OTA
  • Launch OTA by mainfest tool (PC):
$ manifest-tool update device -p <payload> -D <device ID>
  • Example:
$ manifest-tool update device -p WISE-1570-Pelion-Device_update.bin -D 016a533470bb000000000001001003ca
  • You will see the state keep on publishing (PC)
Wise1570 ota 06.png
  • Get request on endpoint (Device)
Wise1570 ota 07.png
  • Download in progress (Device)
Wise1570 ota 08.png
  • Check integrity with the firmware image (Device)
Wise1570 ota 09.png
  • You will see "OTA" string on console after reboot (Device)
Wise1570 ota 10.png