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:
Mon May 13 13:35:18 2019 +0900
Revision:
3:6f3b402196cc
Parent:
2:aadfd874279d
Child:
4:d4caf0ec02d0
Add Wio LTE-M1/NB1(BG96) 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 3:6f3b402196cc 40 },
MACRUM 3:6f3b402196cc 41 "WIO_BG96": {
MACRUM 3:6f3b402196cc 42 "target.features_add" : ["STORAGE", "BOOTLOADER", "LWIP"],
MACRUM 3:6f3b402196cc 43 "target.network-default-interface-type" : "CELLULAR",
MACRUM 3:6f3b402196cc 44 "target.components_add" : ["SD"],
MACRUM 3:6f3b402196cc 45 "target.app_offset" : "0x10400",
MACRUM 3:6f3b402196cc 46 "target.header_offset" : "0x10000",
MACRUM 3:6f3b402196cc 47 "target.bootloader_img" : "bootloader/mbed-bootloader-WIO_3G.bin",
MACRUM 3:6f3b402196cc 48 "mbed-cloud-client.external-sst-support" : null,
MACRUM 3:6f3b402196cc 49 "sd.SPI_MOSI" : "PC_12",
MACRUM 3:6f3b402196cc 50 "sd.SPI_MISO" : "PC_11",
MACRUM 3:6f3b402196cc 51 "sd.SPI_CLK" : "PC_10",
MACRUM 3:6f3b402196cc 52 "sd.SPI_CS" : "PD_0",
MACRUM 3:6f3b402196cc 53 "update-client.application-details" : "(0x08000000+64*1024)",
MACRUM 3:6f3b402196cc 54 "update-client.storage-address" : "(64*1024*1024)",
MACRUM 3:6f3b402196cc 55 "update-client.storage-size" : "(2*1024*1024)",
MACRUM 3:6f3b402196cc 56 "update-client.storage-locations" : "1",
MACRUM 3:6f3b402196cc 57 "device-management.sotp-section-1-address" : "(0x081C0000)",
MACRUM 3:6f3b402196cc 58 "device-management.sotp-section-1-size" : "(128*1024)",
MACRUM 3:6f3b402196cc 59 "device-management.sotp-section-2-address" : "(0x081E0000)",
MACRUM 3:6f3b402196cc 60 "device-management.sotp-section-2-size" : "(128*1024)",
MACRUM 3:6f3b402196cc 61 "device-management.sotp-num-sections" : 2,
MACRUM 3:6f3b402196cc 62 "lwip.ipv4-enabled" : true,
MACRUM 3:6f3b402196cc 63 "lwip.ethernet-enabled" : false,
MACRUM 3:6f3b402196cc 64 "lwip.ppp-enabled" : false,
MACRUM 3:6f3b402196cc 65 "lwip.tcp-enabled" : true,
MACRUM 3:6f3b402196cc 66 "cellular.use-apn-lookup" : false,
MACRUM 3:6f3b402196cc 67 "nsapi.default-cellular-sim-pin" : "\"0000\"",
MACRUM 3:6f3b402196cc 68 "nsapi.default-cellular-apn" : "\"apn\"",
MACRUM 3:6f3b402196cc 69 "nsapi.default-cellular-username" : "\"username\"",
MACRUM 3:6f3b402196cc 70 "nsapi.default-cellular-password" : "\"password\""
MACRUM 0:91c16b1711c2 71 }
MACRUM 0:91c16b1711c2 72 },
MACRUM 0:91c16b1711c2 73 "config": {
MACRUM 0:91c16b1711c2 74 "format-storage-layer-on-error": {
MACRUM 0:91c16b1711c2 75 "help": "Whether to format the storage layer when it cannot be read - always disable for production devices!",
MACRUM 0:91c16b1711c2 76 "value": 1
MACRUM 0:91c16b1711c2 77 },
Osamu Koizumi 2:aadfd874279d 78 "main-stack-size": {
Osamu Koizumi 2:aadfd874279d 79 "value": 6000
Osamu Koizumi 2:aadfd874279d 80 },
Osamu Koizumi 2:aadfd874279d 81 "use-button": {
Osamu Koizumi 2:aadfd874279d 82 "help": "Whether the target has a button",
Osamu Koizumi 2:aadfd874279d 83 "macro_name": "USE_BUTTON",
Osamu Koizumi 2:aadfd874279d 84 "value": false
Osamu Koizumi 2:aadfd874279d 85 },
Osamu Koizumi 2:aadfd874279d 86 "button-pressed-state": {
Osamu Koizumi 2:aadfd874279d 87 "help": "Value of the button when pressed",
MACRUM 0:91c16b1711c2 88 "value": 1
MACRUM 0:91c16b1711c2 89 },
Osamu Koizumi 2:aadfd874279d 90 "no_led": {
Osamu Koizumi 2:aadfd874279d 91 "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 92 "value": null
MACRUM 0:91c16b1711c2 93 },
Osamu Koizumi 2:aadfd874279d 94 "tests-fs-size": {
Osamu Koizumi 2:aadfd874279d 95 "help": "Maximum size of the file system used for tests",
MACRUM 0:91c16b1711c2 96 "value": null
MACRUM 0:91c16b1711c2 97 }
MACRUM 0:91c16b1711c2 98 }
MACRUM 0:91c16b1711c2 99 }