Generic Pelion Device Management example for various Advantech modules.

This example is known to work great on the following platforms:

Example Functionality

This example showcases the following device functionality:

  • On timer button increment, simulate Pelion LWM2M button resource change

Use this example with Mbed CLI

1. Import the application into your desktop:

mbed import https://os.mbed.com/teams/Advantech/code/pelion-example-common
cd pelion-example-common

2. Download your developer certificate from pelion portal

3. Compile the program

mbed compile -t <toolchain> -m <TARGET_BOARD>

(supported toolchains : GCC_ARM / ARM / IAR)

4. Copy the binary file pelion-example-common.bin to your mbed device.

Committer:
chuanga
Date:
Tue Mar 12 13:48:39 2019 +0800
Revision:
0:43ff9e3bc244
copying sources from github repository

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chuanga 0:43ff9e3bc244 1 {
chuanga 0:43ff9e3bc244 2 "macros": [
chuanga 0:43ff9e3bc244 3 "ARM_UC_USE_PAL_BLOCKDEVICE=1",
chuanga 0:43ff9e3bc244 4 "MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP_BLOCKDEVICE",
chuanga 0:43ff9e3bc244 5 "MCC_PLATFORM_WAIT_BEFORE_BD_INIT=3"
chuanga 0:43ff9e3bc244 6 ],
chuanga 0:43ff9e3bc244 7 "target_overrides": {
chuanga 0:43ff9e3bc244 8 "*": {
chuanga 0:43ff9e3bc244 9 "target.components_remove" : ["FLASHIAP"],
chuanga 0:43ff9e3bc244 10 "platform.stdio-baud-rate" : 115200,
chuanga 0:43ff9e3bc244 11 "platform.stdio-convert-newlines" : true,
chuanga 0:43ff9e3bc244 12 "mbed-trace.enable" : false,
chuanga 0:43ff9e3bc244 13 "nsapi.default-wifi-security" : "WPA_WPA2",
chuanga 0:43ff9e3bc244 14 "nsapi.default-wifi-ssid" : "\"AlanAP\"",
chuanga 0:43ff9e3bc244 15 "nsapi.default-wifi-password" : "\"Alan1234\""
chuanga 0:43ff9e3bc244 16 },
chuanga 0:43ff9e3bc244 17 "MTB_USI_WM_BN_BM_22": {
chuanga 0:43ff9e3bc244 18 "target.components_add" : ["SPIF"],
chuanga 0:43ff9e3bc244 19 "spif-driver.SPI_MOSI" : "PC_3",
chuanga 0:43ff9e3bc244 20 "spif-driver.SPI_MISO" : "PC_2",
chuanga 0:43ff9e3bc244 21 "spif-driver.SPI_CLK" : "PB_13",
chuanga 0:43ff9e3bc244 22 "spif-driver.SPI_CS" : "PA_6",
chuanga 0:43ff9e3bc244 23 "device-management.flash-start-address" : "0x08000000",
chuanga 0:43ff9e3bc244 24 "device-management.flash-size" : "(1024*1024)",
chuanga 0:43ff9e3bc244 25 "device-management.sotp-section-1-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 48*1024)",
chuanga 0:43ff9e3bc244 26 "device-management.sotp-section-1-size" : "(16*1024)",
chuanga 0:43ff9e3bc244 27 "device-management.sotp-section-2-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)",
chuanga 0:43ff9e3bc244 28 "device-management.sotp-section-2-size" : "(16*1024)",
chuanga 0:43ff9e3bc244 29 "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 128*1024)",
chuanga 0:43ff9e3bc244 30 "update-client.storage-address" : "(2*1024*1024)",
chuanga 0:43ff9e3bc244 31 "update-client.storage-size" : "(1*1024*1024)",
chuanga 0:43ff9e3bc244 32 "update-client.storage-locations" : "1",
chuanga 0:43ff9e3bc244 33 "target.features_add" : ["BOOTLOADER"],
chuanga 0:43ff9e3bc244 34 "target.bootloader_img" : "bootloader/mbed-bootloader-MTB_USI_WM_BN_BM_22.bin",
chuanga 0:43ff9e3bc244 35 "target.header_offset" : "0x20000",
chuanga 0:43ff9e3bc244 36 "target.app_offset" : "0x20400",
chuanga 0:43ff9e3bc244 37 "target.OUTPUT_EXT" : "hex"
chuanga 0:43ff9e3bc244 38 },
chuanga 0:43ff9e3bc244 39 "MTB_ADV_WISE_1530": {
chuanga 0:43ff9e3bc244 40 "target.features_add" : ["STORAGE", "BOOTLOADER", "LWIP"],
chuanga 0:43ff9e3bc244 41 "target.components_remove" : ["SPIF"],
chuanga 0:43ff9e3bc244 42 "target.components_add" : ["SD"],
chuanga 0:43ff9e3bc244 43 "target.network-default-interface-type" : "WIFI",
chuanga 0:43ff9e3bc244 44 "target.header_offset" : "0x00020000",
chuanga 0:43ff9e3bc244 45 "target.app_offset" : "0x00020400",
chuanga 0:43ff9e3bc244 46 "target.lse_available" : 0,
chuanga 0:43ff9e3bc244 47 "target.bootloader_img" : "bootloader/mbed-bootloader-MTB_ADV_WISE_1530.bin",
chuanga 0:43ff9e3bc244 48 "target.stdio_uart_tx" : "PA_9",
chuanga 0:43ff9e3bc244 49 "target.stdio_uart_rx" : "PA_10",
chuanga 0:43ff9e3bc244 50 "device-management.flash-size" : "(1024*1024*2)",
chuanga 0:43ff9e3bc244 51 "device-management.pal_fs_mount_point_primary": "\"/sd\"",
chuanga 0:43ff9e3bc244 52 "device-management.partition_mode" : 0,
chuanga 0:43ff9e3bc244 53 "device-management.primary_partition_size" : "(1024*1024*2)",
chuanga 0:43ff9e3bc244 54 "device-management.sotp-section-1-address" : "0x0800C000",
chuanga 0:43ff9e3bc244 55 "device-management.sotp-section-1-size" : "0x4000",
chuanga 0:43ff9e3bc244 56 "device-management.sotp-section-2-address" : "0x08010000",
chuanga 0:43ff9e3bc244 57 "device-management.sotp-section-2-size" : "0x10000",
chuanga 0:43ff9e3bc244 58 "update-client.application-details" : "0x08020000",
chuanga 0:43ff9e3bc244 59 "update-client.bootloader-details" : "0x08005ce4",
chuanga 0:43ff9e3bc244 60 "update-client.storage-address" : "(1024*1024*2)",
chuanga 0:43ff9e3bc244 61 "update-client.storage-size" : "(1024*1024*2)",
chuanga 0:43ff9e3bc244 62 "update-client.storage-locations" : "1",
chuanga 0:43ff9e3bc244 63 "update-client.storage-page" : 1,
chuanga 0:43ff9e3bc244 64 "sd.SPI_MOSI" : "PC_3",
chuanga 0:43ff9e3bc244 65 "sd.SPI_MISO" : "PC_2",
chuanga 0:43ff9e3bc244 66 "sd.SPI_CLK" : "PB_13",
chuanga 0:43ff9e3bc244 67 "sd.SPI_CS" : "PB_9",
chuanga 0:43ff9e3bc244 68 "target.led1" : "NC",
chuanga 0:43ff9e3bc244 69 "target.led2" : "NC",
chuanga 0:43ff9e3bc244 70 "target.OUTPUT_EXT" : "hex"
chuanga 0:43ff9e3bc244 71 },
chuanga 0:43ff9e3bc244 72 "MTB_ADV_WISE_1570": {
chuanga 0:43ff9e3bc244 73 "target.components_add" : ["SPIF"],
chuanga 0:43ff9e3bc244 74 "spif-driver.SPI_FREQ" : 20000000,
chuanga 0:43ff9e3bc244 75 "target.network-default-interface-type" : "CELLULAR",
chuanga 0:43ff9e3bc244 76 "cellular.debug-at" : false,
chuanga 0:43ff9e3bc244 77 "cellular.use-apn-lookup" : false,
chuanga 0:43ff9e3bc244 78 "platform.stdio-baud-rate" : 115200,
chuanga 0:43ff9e3bc244 79 "platform.default-serial-baud-rate" : 115200,
chuanga 0:43ff9e3bc244 80 "device-management.flash-start-address" : "0x08000000",
chuanga 0:43ff9e3bc244 81 "device-management.flash-size" : "(1024*1024)",
chuanga 0:43ff9e3bc244 82 "device-management.sotp-section-1-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))",
chuanga 0:43ff9e3bc244 83 "device-management.sotp-section-1-size" : "(4*1024)",
chuanga 0:43ff9e3bc244 84 "device-management.sotp-section-2-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))",
chuanga 0:43ff9e3bc244 85 "device-management.sotp-section-2-size" : "(4*1024)",
chuanga 0:43ff9e3bc244 86 "device-management.mcc_transport_mode" : 0,
chuanga 0:43ff9e3bc244 87 "device-management.pal_dtls_peer_min_timeout" : "20000",
chuanga 0:43ff9e3bc244 88 "device-management.pal-udp-mtu-size" : 1358,
chuanga 0:43ff9e3bc244 89 "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 32*1024)",
chuanga 0:43ff9e3bc244 90 "update-client.storage-address" : "(2*1024*1024)",
chuanga 0:43ff9e3bc244 91 "update-client.storage-size" : "(1*1024*1024)",
chuanga 0:43ff9e3bc244 92 "update-client.storage-locations" : "1",
chuanga 0:43ff9e3bc244 93 "target.features_add" : ["BOOTLOADER"],
chuanga 0:43ff9e3bc244 94 "target.bootloader_img" : "bootloader/mbed-bootloader-MTB_ADV_WISE_1570.bin",
chuanga 0:43ff9e3bc244 95 "target.header_offset" : "0x8000",
chuanga 0:43ff9e3bc244 96 "target.app_offset" : "0x8400",
chuanga 0:43ff9e3bc244 97 "target.OUTPUT_EXT" : "hex",
chuanga 0:43ff9e3bc244 98 "mbed-client.sn-coap-duplication-max-msgs-count": 1,
chuanga 0:43ff9e3bc244 99 "nsapi.dns-response-wait-time" : 30000
chuanga 0:43ff9e3bc244 100 }
chuanga 0:43ff9e3bc244 101 },
chuanga 0:43ff9e3bc244 102 "config": {
chuanga 0:43ff9e3bc244 103 "format-storage-layer-on-error": {
chuanga 0:43ff9e3bc244 104 "help": "Whether to format the storage layer when it cannot be read - always disable for production devices!",
chuanga 0:43ff9e3bc244 105 "value": 1
chuanga 0:43ff9e3bc244 106 },
chuanga 0:43ff9e3bc244 107 "main-stack-size": {
chuanga 0:43ff9e3bc244 108 "value": 6000
chuanga 0:43ff9e3bc244 109 },
chuanga 0:43ff9e3bc244 110 "use-button": {
chuanga 0:43ff9e3bc244 111 "help": "Whether the target has a button",
chuanga 0:43ff9e3bc244 112 "macro_name": "USE_BUTTON",
chuanga 0:43ff9e3bc244 113 "value": false
chuanga 0:43ff9e3bc244 114 },
chuanga 0:43ff9e3bc244 115 "button-pressed-state": {
chuanga 0:43ff9e3bc244 116 "help": "Value of the button when pressed",
chuanga 0:43ff9e3bc244 117 "value": 1
chuanga 0:43ff9e3bc244 118 },
chuanga 0:43ff9e3bc244 119 "no_led": {
chuanga 0:43ff9e3bc244 120 "help": "This flag disables the heartbeat thread in tests. This is useful for platforms that don't have an LED or the LED is used for other functionality like LED on the SPI clockline etc",
chuanga 0:43ff9e3bc244 121 "value": null
chuanga 0:43ff9e3bc244 122 },
chuanga 0:43ff9e3bc244 123 "developer-mode": {
chuanga 0:43ff9e3bc244 124 "help": "Enable Developer mode to skip Factory enrollment",
chuanga 0:43ff9e3bc244 125 "value": 1
chuanga 0:43ff9e3bc244 126 },
chuanga 0:43ff9e3bc244 127 "trace-level": {
chuanga 0:43ff9e3bc244 128 "help": "Options are TRACE_LEVEL_ERROR,TRACE_LEVEL_WARN,TRACE_LEVEL_INFO,TRACE_LEVEL_DEBUG",
chuanga 0:43ff9e3bc244 129 "macro_name": "MBED_TRACE_MAX_LEVEL",
chuanga 0:43ff9e3bc244 130 "value": "TRACE_LEVEL_INFO"
chuanga 0:43ff9e3bc244 131 }
chuanga 0:43ff9e3bc244 132 }
chuanga 0:43ff9e3bc244 133 }