Generic Pelion Device Management example for various Advantech modules.
This example is known to work great on the following platforms:
- WISE-1530 WiFi Module using DB-1505 carrier board and external SD card reader.
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.
Diff: mbed_app.json
- Revision:
- 0:43ff9e3bc244
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed_app.json Tue Mar 12 13:48:39 2019 +0800 @@ -0,0 +1,133 @@ +{ + "macros": [ + "ARM_UC_USE_PAL_BLOCKDEVICE=1", + "MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP_BLOCKDEVICE", + "MCC_PLATFORM_WAIT_BEFORE_BD_INIT=3" + ], + "target_overrides": { + "*": { + "target.components_remove" : ["FLASHIAP"], + "platform.stdio-baud-rate" : 115200, + "platform.stdio-convert-newlines" : true, + "mbed-trace.enable" : false, + "nsapi.default-wifi-security" : "WPA_WPA2", + "nsapi.default-wifi-ssid" : "\"AlanAP\"", + "nsapi.default-wifi-password" : "\"Alan1234\"" + }, + "MTB_USI_WM_BN_BM_22": { + "target.components_add" : ["SPIF"], + "spif-driver.SPI_MOSI" : "PC_3", + "spif-driver.SPI_MISO" : "PC_2", + "spif-driver.SPI_CLK" : "PB_13", + "spif-driver.SPI_CS" : "PA_6", + "device-management.flash-start-address" : "0x08000000", + "device-management.flash-size" : "(1024*1024)", + "device-management.sotp-section-1-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 48*1024)", + "device-management.sotp-section-1-size" : "(16*1024)", + "device-management.sotp-section-2-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 64*1024)", + "device-management.sotp-section-2-size" : "(16*1024)", + "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 128*1024)", + "update-client.storage-address" : "(2*1024*1024)", + "update-client.storage-size" : "(1*1024*1024)", + "update-client.storage-locations" : "1", + "target.features_add" : ["BOOTLOADER"], + "target.bootloader_img" : "bootloader/mbed-bootloader-MTB_USI_WM_BN_BM_22.bin", + "target.header_offset" : "0x20000", + "target.app_offset" : "0x20400", + "target.OUTPUT_EXT" : "hex" + }, + "MTB_ADV_WISE_1530": { + "target.features_add" : ["STORAGE", "BOOTLOADER", "LWIP"], + "target.components_remove" : ["SPIF"], + "target.components_add" : ["SD"], + "target.network-default-interface-type" : "WIFI", + "target.header_offset" : "0x00020000", + "target.app_offset" : "0x00020400", + "target.lse_available" : 0, + "target.bootloader_img" : "bootloader/mbed-bootloader-MTB_ADV_WISE_1530.bin", + "target.stdio_uart_tx" : "PA_9", + "target.stdio_uart_rx" : "PA_10", + "device-management.flash-size" : "(1024*1024*2)", + "device-management.pal_fs_mount_point_primary": "\"/sd\"", + "device-management.partition_mode" : 0, + "device-management.primary_partition_size" : "(1024*1024*2)", + "device-management.sotp-section-1-address" : "0x0800C000", + "device-management.sotp-section-1-size" : "0x4000", + "device-management.sotp-section-2-address" : "0x08010000", + "device-management.sotp-section-2-size" : "0x10000", + "update-client.application-details" : "0x08020000", + "update-client.bootloader-details" : "0x08005ce4", + "update-client.storage-address" : "(1024*1024*2)", + "update-client.storage-size" : "(1024*1024*2)", + "update-client.storage-locations" : "1", + "update-client.storage-page" : 1, + "sd.SPI_MOSI" : "PC_3", + "sd.SPI_MISO" : "PC_2", + "sd.SPI_CLK" : "PB_13", + "sd.SPI_CS" : "PB_9", + "target.led1" : "NC", + "target.led2" : "NC", + "target.OUTPUT_EXT" : "hex" + }, + "MTB_ADV_WISE_1570": { + "target.components_add" : ["SPIF"], + "spif-driver.SPI_FREQ" : 20000000, + "target.network-default-interface-type" : "CELLULAR", + "cellular.debug-at" : false, + "cellular.use-apn-lookup" : false, + "platform.stdio-baud-rate" : 115200, + "platform.default-serial-baud-rate" : 115200, + "device-management.flash-start-address" : "0x08000000", + "device-management.flash-size" : "(1024*1024)", + "device-management.sotp-section-1-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 2*(4*1024))", + "device-management.sotp-section-1-size" : "(4*1024)", + "device-management.sotp-section-2-address" : "(MBED_CONF_APP_FLASH_START_ADDRESS + MBED_CONF_APP_FLASH_SIZE - 1*(4*1024))", + "device-management.sotp-section-2-size" : "(4*1024)", + "device-management.mcc_transport_mode" : 0, + "device-management.pal_dtls_peer_min_timeout" : "20000", + "device-management.pal-udp-mtu-size" : 1358, + "update-client.application-details" : "(MBED_CONF_APP_FLASH_START_ADDRESS + 32*1024)", + "update-client.storage-address" : "(2*1024*1024)", + "update-client.storage-size" : "(1*1024*1024)", + "update-client.storage-locations" : "1", + "target.features_add" : ["BOOTLOADER"], + "target.bootloader_img" : "bootloader/mbed-bootloader-MTB_ADV_WISE_1570.bin", + "target.header_offset" : "0x8000", + "target.app_offset" : "0x8400", + "target.OUTPUT_EXT" : "hex", + "mbed-client.sn-coap-duplication-max-msgs-count": 1, + "nsapi.dns-response-wait-time" : 30000 + } + }, + "config": { + "format-storage-layer-on-error": { + "help": "Whether to format the storage layer when it cannot be read - always disable for production devices!", + "value": 1 + }, + "main-stack-size": { + "value": 6000 + }, + "use-button": { + "help": "Whether the target has a button", + "macro_name": "USE_BUTTON", + "value": false + }, + "button-pressed-state": { + "help": "Value of the button when pressed", + "value": 1 + }, + "no_led": { + "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", + "value": null + }, + "developer-mode": { + "help": "Enable Developer mode to skip Factory enrollment", + "value": 1 + }, + "trace-level": { + "help": "Options are TRACE_LEVEL_ERROR,TRACE_LEVEL_WARN,TRACE_LEVEL_INFO,TRACE_LEVEL_DEBUG", + "macro_name": "MBED_TRACE_MAX_LEVEL", + "value": "TRACE_LEVEL_INFO" + } + } +}