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:
Osamu Koizumi
Date:
Thu Apr 18 13:13:04 2019 +0900
Revision:
2:aadfd874279d
Parent:
0:91c16b1711c2
Child:
3:6f3b402196cc
Pelion Ready support

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:91c16b1711c2 1 {
MACRUM 0:91c16b1711c2 2 "target_overrides": {
MACRUM 0:91c16b1711c2 3 "*": {
Osamu Koizumi 2:aadfd874279d 4 "target.components_remove" : ["FLASHIAP"],
Osamu Koizumi 2:aadfd874279d 5 "platform.stdio-baud-rate" : 115200,
Osamu Koizumi 2:aadfd874279d 6 "platform.stdio-convert-newlines" : true,
Osamu Koizumi 2:aadfd874279d 7 "mbed-trace.enable" : null
MACRUM 0:91c16b1711c2 8 },
MACRUM 0:91c16b1711c2 9 "WIO_3G": {
Osamu Koizumi 2:aadfd874279d 10 "target.device_has_remove" : ["SERIAL_FC"],
MACRUM 0:91c16b1711c2 11 "target.features_add" : ["STORAGE", "BOOTLOADER", "LWIP"],
MACRUM 0:91c16b1711c2 12 "target.network-default-interface-type" : "CELLULAR",
MACRUM 0:91c16b1711c2 13 "target.components_add" : ["SD"],
MACRUM 0:91c16b1711c2 14 "target.app_offset" : "0x10400",
MACRUM 0:91c16b1711c2 15 "target.header_offset" : "0x10000",
MACRUM 0:91c16b1711c2 16 "target.bootloader_img" : "bootloader/mbed-bootloader-WIO_3G.bin",
Osamu Koizumi 2:aadfd874279d 17 "mbed-cloud-client.external-sst-support" : null,
MACRUM 0:91c16b1711c2 18 "sd.SPI_MOSI" : "PC_12",
MACRUM 0:91c16b1711c2 19 "sd.SPI_MISO" : "PC_11",
MACRUM 0:91c16b1711c2 20 "sd.SPI_CLK" : "PC_10",
MACRUM 0:91c16b1711c2 21 "sd.SPI_CS" : "PD_0",
MACRUM 0:91c16b1711c2 22 "update-client.application-details" : "(0x08000000+64*1024)",
Osamu Koizumi 2:aadfd874279d 23 "update-client.storage-address" : "(64*1024*1024)",
Osamu Koizumi 2:aadfd874279d 24 "update-client.storage-size" : "(2*1024*1024)",
Osamu Koizumi 2:aadfd874279d 25 "update-client.storage-locations" : "1",
Osamu Koizumi 2:aadfd874279d 26 "device-management.sotp-section-1-address" : "(0x081C0000)",
Osamu Koizumi 2:aadfd874279d 27 "device-management.sotp-section-1-size" : "(128*1024)",
Osamu Koizumi 2:aadfd874279d 28 "device-management.sotp-section-2-address" : "(0x081E0000)",
Osamu Koizumi 2:aadfd874279d 29 "device-management.sotp-section-2-size" : "(128*1024)",
Osamu Koizumi 2:aadfd874279d 30 "device-management.sotp-num-sections" : 2,
MACRUM 0:91c16b1711c2 31 "lwip.ipv4-enabled" : true,
MACRUM 0:91c16b1711c2 32 "lwip.ethernet-enabled" : false,
MACRUM 0:91c16b1711c2 33 "lwip.ppp-enabled" : true,
MACRUM 0:91c16b1711c2 34 "lwip.tcp-enabled" : true,
MACRUM 0:91c16b1711c2 35 "cellular.use-apn-lookup" : false,
Osamu Koizumi 2:aadfd874279d 36 "nsapi.default-cellular-sim-pin" : "\"0000\"",
Osamu Koizumi 2:aadfd874279d 37 "nsapi.default-cellular-apn" : "\"apn\"",
Osamu Koizumi 2:aadfd874279d 38 "nsapi.default-cellular-username" : "\"username\"",
Osamu Koizumi 2:aadfd874279d 39 "nsapi.default-cellular-password" : "\"password\""
MACRUM 0:91c16b1711c2 40 }
MACRUM 0:91c16b1711c2 41 },
MACRUM 0:91c16b1711c2 42 "config": {
MACRUM 0:91c16b1711c2 43 "format-storage-layer-on-error": {
MACRUM 0:91c16b1711c2 44 "help": "Whether to format the storage layer when it cannot be read - always disable for production devices!",
MACRUM 0:91c16b1711c2 45 "value": 1
MACRUM 0:91c16b1711c2 46 },
Osamu Koizumi 2:aadfd874279d 47 "main-stack-size": {
Osamu Koizumi 2:aadfd874279d 48 "value": 6000
Osamu Koizumi 2:aadfd874279d 49 },
Osamu Koizumi 2:aadfd874279d 50 "use-button": {
Osamu Koizumi 2:aadfd874279d 51 "help": "Whether the target has a button",
Osamu Koizumi 2:aadfd874279d 52 "macro_name": "USE_BUTTON",
Osamu Koizumi 2:aadfd874279d 53 "value": false
Osamu Koizumi 2:aadfd874279d 54 },
Osamu Koizumi 2:aadfd874279d 55 "button-pressed-state": {
Osamu Koizumi 2:aadfd874279d 56 "help": "Value of the button when pressed",
MACRUM 0:91c16b1711c2 57 "value": 1
MACRUM 0:91c16b1711c2 58 },
Osamu Koizumi 2:aadfd874279d 59 "no_led": {
Osamu Koizumi 2:aadfd874279d 60 "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",
MACRUM 0:91c16b1711c2 61 "value": null
MACRUM 0:91c16b1711c2 62 },
Osamu Koizumi 2:aadfd874279d 63 "tests-fs-size": {
Osamu Koizumi 2:aadfd874279d 64 "help": "Maximum size of the file system used for tests",
MACRUM 0:91c16b1711c2 65 "value": null
MACRUM 0:91c16b1711c2 66 }
MACRUM 0:91c16b1711c2 67 }
MACRUM 0:91c16b1711c2 68 }