Specific Pelion ready example using features of Seeed Wio boards including cellular and SD Card

Dependencies:   WS2812 PixelArray

Fork of simple-mbed-cloud-example-wio_3g by Toyomasa Watarai

DEPRECATED

This example application is not maintained and not recommended. It uses an old version of Mbed OS, Pelion DM, and Arm toolchain. It doesn't work with Mbed Studio.

Please use: https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-pelion/

This example is known to work great on the following platforms:
Seeed Wio 3G and Seeed Wio LTE-M1/NB1(BG96) over cellular and using SD card.

https://os.mbed.com/media/cache/platforms/Wio_3G.png.250x250_q85.png

Follow the Quick-Start instructions: https://cloud.mbed.com/quick-start

Example functionality

This example showcases the following device functionality:

  • Allow the user to change the state of the board LED from Pelion LWM2M led_state resource and PUT request.

Instructions to use this program with mbed CLI

1. Import the application into your desktop:

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

cd pelion-example-common

2. Install the CLOUD_SDK_API_KEY

mbed config -G CLOUD_SDK_API_KEY <PELION_DM_API_KEY>

For instructions on how to generate your API key, please see the documentation.

3. Initialize firmware credentials (done once per repository). You can use the following command:

mbed dm init -d "<your company name in Pelion DM>" --model-name "<product model identifier>" -q --force

If above command do not work for your Mbed CLI, please consider upgrading Mbed CLI to version 1.9.x or above.

  • Set APN name, username and password in the mbed_app.json.

            "nsapi.default-cellular-plmn"      : "\"00000\"",
            "nsapi.default-cellular-sim-pin"   : "\"0000\"",
            "nsapi.default-cellular-apn"       : "\"apn\"",
            "nsapi.default-cellular-username"  : "\"username\"",
            "nsapi.default-cellular-password"  : "\"password\""

Information

For the Wio LTE-M1/NB1(BG96) target, PLMN (Public land mobile network) should be specified to get quick connection to the network. This is usually found first 5 digit from your SIM card IMSI (International Mobile Subscriber Identity) number. e.g. 44052

4. Compile and program:

mbed compile -t <toolchain> -m WIO_3G

(supported toolchains : GCC_ARM / ARM / IAR)

Troubleshooting

  • Make sure the fields nsapi.default-cellular-sim-pin, nsapi.default-cellular-apn, nsapi.default-cellular-username and nsapi.default-cellular-password from the mbed_app.json file are filled in correctly. The correct values should appear in the user manual in the details of the SIM card.
  • Enable trace flag to have access to debug information "mbed-trace.enable": true.
  • Try both TCP and UDP socket types.
  • Try both "lwip.ppp-enabled": true and "lwip.ppp-enabled": false.
  • The modem and network may only support IPv6 in which case "lwip.ipv6-enabled": true shall be defined.
  • The SIM and modem must have compatible cellular technology (3G, 4G, NB-IoT, ...) supported and cellular network available.
Committer:
MACRUM
Date:
Sat Nov 10 20:27:36 2018 +0900
Revision:
0:91c16b1711c2
Child:
2:aadfd874279d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:91c16b1711c2 1 {
MACRUM 0:91c16b1711c2 2 "macros": [
MACRUM 0:91c16b1711c2 3 "MBEDTLS_USER_CONFIG_FILE=\"mbedTLSConfig_mbedOS.h\"",
MACRUM 0:91c16b1711c2 4 "PAL_USER_DEFINED_CONFIGURATION=\"sotp_fs_config_MbedOS.h\"",
MACRUM 0:91c16b1711c2 5 "MBED_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
MACRUM 0:91c16b1711c2 6 "MBED_CLOUD_CLIENT_USER_CONFIG_FILE=\"mbed_cloud_client_user_config.h\"",
MACRUM 0:91c16b1711c2 7 "PAL_DTLS_PEER_MIN_TIMEOUT=5000",
MACRUM 0:91c16b1711c2 8 "MBED_CONF_APP_MAIN_STACK_SIZE=7000",
MACRUM 0:91c16b1711c2 9 "ARM_UC_USE_PAL_BLOCKDEVICE=1",
MACRUM 0:91c16b1711c2 10 "MBED_CLOUD_CLIENT_UPDATE_STORAGE=ARM_UCP_FLASHIAP_BLOCKDEVICE"
MACRUM 0:91c16b1711c2 11 ],
MACRUM 0:91c16b1711c2 12 "target_overrides": {
MACRUM 0:91c16b1711c2 13 "*": {
MACRUM 0:91c16b1711c2 14 "platform.stdio-baud-rate": 115200,
MACRUM 0:91c16b1711c2 15 "platform.stdio-convert-newlines": true,
MACRUM 0:91c16b1711c2 16 "update-client.storage-address" : "(1024*1024*64)",
MACRUM 0:91c16b1711c2 17 "update-client.storage-size" : "(1024*1024*2)",
MACRUM 0:91c16b1711c2 18 "update-client.storage-locations": "1",
MACRUM 0:91c16b1711c2 19 "mbed-trace.enable": null,
MACRUM 0:91c16b1711c2 20 "nsapi.default-wifi-security" : "WPA_WPA2",
MACRUM 0:91c16b1711c2 21 "nsapi.default-wifi-ssid" : "\"SSID\"",
MACRUM 0:91c16b1711c2 22 "nsapi.default-wifi-password" : "\"Password\""
MACRUM 0:91c16b1711c2 23 },
MACRUM 0:91c16b1711c2 24 "K64F": {
MACRUM 0:91c16b1711c2 25 "target.features_add" : ["BOOTLOADER"],
MACRUM 0:91c16b1711c2 26 "sotp-section-1-address" : "(32*1024)",
MACRUM 0:91c16b1711c2 27 "sotp-section-1-size" : "(4*1024)",
MACRUM 0:91c16b1711c2 28 "sotp-section-2-address" : "(36*1024)",
MACRUM 0:91c16b1711c2 29 "sotp-section-2-size" : "(4*1024)",
MACRUM 0:91c16b1711c2 30 "sotp-num-sections" : 2,
MACRUM 0:91c16b1711c2 31 "update-client.application-details": "(40*1024)"
MACRUM 0:91c16b1711c2 32 },
MACRUM 0:91c16b1711c2 33 "WIO_3G": {
MACRUM 0:91c16b1711c2 34 "target.features_add" : ["STORAGE", "BOOTLOADER", "LWIP"],
MACRUM 0:91c16b1711c2 35 "target.network-default-interface-type" : "CELLULAR",
MACRUM 0:91c16b1711c2 36 "target.components_add" : ["SD"],
MACRUM 0:91c16b1711c2 37 "target.app_offset" : "0x10400",
MACRUM 0:91c16b1711c2 38 "target.header_offset" : "0x10000",
MACRUM 0:91c16b1711c2 39 "target.bootloader_img" : "bootloader/mbed-bootloader-WIO_3G.bin",
MACRUM 0:91c16b1711c2 40 "sd.SPI_MOSI" : "PC_12",
MACRUM 0:91c16b1711c2 41 "sd.SPI_MISO" : "PC_11",
MACRUM 0:91c16b1711c2 42 "sd.SPI_CLK" : "PC_10",
MACRUM 0:91c16b1711c2 43 "sd.SPI_CS" : "PD_0",
MACRUM 0:91c16b1711c2 44 "update-client.application-details" : "(0x08000000+64*1024)",
MACRUM 0:91c16b1711c2 45 "sotp-section-1-address" : "(0x08008000)",
MACRUM 0:91c16b1711c2 46 "sotp-section-1-size" : "(16*1024)",
MACRUM 0:91c16b1711c2 47 "sotp-section-2-address" : "(0x0800C000)",
MACRUM 0:91c16b1711c2 48 "sotp-section-2-size" : "(16*1024)",
MACRUM 0:91c16b1711c2 49 "sotp-num-sections" : 2,
MACRUM 0:91c16b1711c2 50 "lwip.ipv4-enabled" : true,
MACRUM 0:91c16b1711c2 51 "lwip.ethernet-enabled" : false,
MACRUM 0:91c16b1711c2 52 "lwip.ppp-enabled" : true,
MACRUM 0:91c16b1711c2 53 "lwip.tcp-enabled" : true,
MACRUM 0:91c16b1711c2 54 "cellular.use-apn-lookup" : false,
MACRUM 0:91c16b1711c2 55 "apn" : "\"apn\"",
MACRUM 0:91c16b1711c2 56 "username" : "\"username\"",
MACRUM 0:91c16b1711c2 57 "password" : "\"password\""
MACRUM 0:91c16b1711c2 58 }
MACRUM 0:91c16b1711c2 59 },
MACRUM 0:91c16b1711c2 60 "config": {
MACRUM 0:91c16b1711c2 61 "format-storage-layer-on-error": {
MACRUM 0:91c16b1711c2 62 "help": "Whether to format the storage layer when it cannot be read - always disable for production devices!",
MACRUM 0:91c16b1711c2 63 "value": 1
MACRUM 0:91c16b1711c2 64 },
MACRUM 0:91c16b1711c2 65 "developer-mode": {
MACRUM 0:91c16b1711c2 66 "help": "Enable Developer mode to skip Factory enrollment",
MACRUM 0:91c16b1711c2 67 "value": 1
MACRUM 0:91c16b1711c2 68 },
MACRUM 0:91c16b1711c2 69 "sotp-section-1-address": {
MACRUM 0:91c16b1711c2 70 "help": "Flash sector address for SOTP sector 1",
MACRUM 0:91c16b1711c2 71 "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_ADDRESS",
MACRUM 0:91c16b1711c2 72 "value": null
MACRUM 0:91c16b1711c2 73 },
MACRUM 0:91c16b1711c2 74 "sotp-section-1-size": {
MACRUM 0:91c16b1711c2 75 "help": "Flash sector size for SOTP sector 1",
MACRUM 0:91c16b1711c2 76 "macro_name": "PAL_INTERNAL_FLASH_SECTION_1_SIZE",
MACRUM 0:91c16b1711c2 77 "value": null
MACRUM 0:91c16b1711c2 78 },
MACRUM 0:91c16b1711c2 79 "sotp-section-2-address": {
MACRUM 0:91c16b1711c2 80 "help": "Flash sector address for SOTP sector 2",
MACRUM 0:91c16b1711c2 81 "macro_name": "PAL_INTERNAL_FLASH_SECTION_2_ADDRESS",
MACRUM 0:91c16b1711c2 82 "value": null
MACRUM 0:91c16b1711c2 83 },
MACRUM 0:91c16b1711c2 84 "sotp-section-2-size": {
MACRUM 0:91c16b1711c2 85 "help": "Flash sector size for SOTP sector 2",
MACRUM 0:91c16b1711c2 86 "macro_name": "PAL_INTERNAL_FLASH_SECTION_2_SIZE",
MACRUM 0:91c16b1711c2 87 "value": null
MACRUM 0:91c16b1711c2 88 },
MACRUM 0:91c16b1711c2 89 "sotp-num-sections": {
MACRUM 0:91c16b1711c2 90 "help": "Number of SOTP sections",
MACRUM 0:91c16b1711c2 91 "macro_name": "PAL_INT_FLASH_NUM_SECTIONS",
MACRUM 0:91c16b1711c2 92 "value": null
MACRUM 0:91c16b1711c2 93 },
MACRUM 0:91c16b1711c2 94 "sock-type": "TCP",
MACRUM 0:91c16b1711c2 95 "sim-pin-code": {
MACRUM 0:91c16b1711c2 96 "help": "SIM PIN code",
MACRUM 0:91c16b1711c2 97 "value": "\"0000\""
MACRUM 0:91c16b1711c2 98 },
MACRUM 0:91c16b1711c2 99 "apn": {
MACRUM 0:91c16b1711c2 100 "help": "The APN string to use for this SIM/network, set to 0 if none",
MACRUM 0:91c16b1711c2 101 "value": "\"internet\""
MACRUM 0:91c16b1711c2 102 },
MACRUM 0:91c16b1711c2 103 "username": {
MACRUM 0:91c16b1711c2 104 "help": "The user name string to use for this APN, set to zero if none",
MACRUM 0:91c16b1711c2 105 "value": 0
MACRUM 0:91c16b1711c2 106 },
MACRUM 0:91c16b1711c2 107 "password": {
MACRUM 0:91c16b1711c2 108 "help": "The password string to use for this APN, set to 0 if none",
MACRUM 0:91c16b1711c2 109 "value": 0
MACRUM 0:91c16b1711c2 110 }
MACRUM 0:91c16b1711c2 111 }
MACRUM 0:91c16b1711c2 112 }