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 # Prototype Driver for STM Wi-Fi Expansion Boards based on the SPWFxx Module for STM32 Nucleo #
chuanga 0:43ff9e3bc244 2
chuanga 0:43ff9e3bc244 3 ## Currently supported expansion boards
chuanga 0:43ff9e3bc244 4 * [X-NUCLEO-IDW01M1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw01m1.html), by setting `mbed` configuration variable `idw0xx1.expansion-board` to value `IDW01M1`
chuanga 0:43ff9e3bc244 5 * [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html), by setting `mbed` configuration variable `idw0xx1.expansion-board` to value `IDW04A1`. You might also need to define macro `IDW04A1_WIFI_HW_BUG_WA` _(see beyond)_.
chuanga 0:43ff9e3bc244 6
chuanga 0:43ff9e3bc244 7 ```diff
chuanga 0:43ff9e3bc244 8 - **The boards above are now DEPRECATED and NOT RECOMMENDED FOR NEW DESIGN.**
chuanga 0:43ff9e3bc244 9 ```
chuanga 0:43ff9e3bc244 10
chuanga 0:43ff9e3bc244 11 ## Configuration examples
chuanga 0:43ff9e3bc244 12
chuanga 0:43ff9e3bc244 13 ### Generic concepts
chuanga 0:43ff9e3bc244 14
chuanga 0:43ff9e3bc244 15 For the ones, which might be less familiar with the **"The mbed configuration system"** in general, here is a [link](https://docs.mbed.com/docs/mbed-os-handbook/en/latest/advanced/config_system/) which points to the latest version of the respective _mbed OS 5 handbook tutorial_.
chuanga 0:43ff9e3bc244 16
chuanga 0:43ff9e3bc244 17 Furthermore, with respect to this driver, pls. refer to files [`mbed_app_idw01m1.json`](https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/blob/master/mbed_app_idw01m1.json) and [`mbed_app_idw04a1.json`](https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/blob/master/mbed_app_idw04a1.json) regarding additional reference for what is explained beyond.
chuanga 0:43ff9e3bc244 18
chuanga 0:43ff9e3bc244 19 ### IDW01M1
chuanga 0:43ff9e3bc244 20
chuanga 0:43ff9e3bc244 21 Add the following lines to the `target_overrides`-section of your `mbed_app.json` file.
chuanga 0:43ff9e3bc244 22
chuanga 0:43ff9e3bc244 23 ``` json
chuanga 0:43ff9e3bc244 24 "idw0xx1.expansion-board": "IDW01M1",
chuanga 0:43ff9e3bc244 25 "drivers.uart-serial-txbuf-size": 512,
chuanga 0:43ff9e3bc244 26 "drivers.uart-serial-rxbuf-size": 512
chuanga 0:43ff9e3bc244 27 ```
chuanga 0:43ff9e3bc244 28
chuanga 0:43ff9e3bc244 29 `IDW01M1` is the default value in the [`mbed_lib.json`](https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/blob/master/mbed_lib.json) file, so setting the expansion board is not mandatory for `IDW01M1`, while setting the TX & RX buffer sizes is highly recommended.
chuanga 0:43ff9e3bc244 30
chuanga 0:43ff9e3bc244 31 ### IDW04A1
chuanga 0:43ff9e3bc244 32
chuanga 0:43ff9e3bc244 33 Add the following lines to the `target_overrides`-section of your `mbed_app.json` file.
chuanga 0:43ff9e3bc244 34
chuanga 0:43ff9e3bc244 35 ``` json
chuanga 0:43ff9e3bc244 36 "idw0xx1.expansion-board": "IDW04A1",
chuanga 0:43ff9e3bc244 37 "drivers.uart-serial-txbuf-size": 512,
chuanga 0:43ff9e3bc244 38 "drivers.uart-serial-rxbuf-size": 512
chuanga 0:43ff9e3bc244 39 ```
chuanga 0:43ff9e3bc244 40
chuanga 0:43ff9e3bc244 41 ### Further configuration macros
chuanga 0:43ff9e3bc244 42
chuanga 0:43ff9e3bc244 43 All configuration options mentioned in this section are optional and when required have to be added to the `macros`-section of your `mbed_app.json` file, e.g.:
chuanga 0:43ff9e3bc244 44
chuanga 0:43ff9e3bc244 45 ``` json
chuanga 0:43ff9e3bc244 46 "macros": [..., "IDW04A1_WIFI_HW_BUG_WA", "SPWFSAXX_RESET_PIN=D7"]
chuanga 0:43ff9e3bc244 47 ```
chuanga 0:43ff9e3bc244 48
chuanga 0:43ff9e3bc244 49 Beyond you can find the list of available configuration macros each with a short explanation:
chuanga 0:43ff9e3bc244 50 * `IDW04A1_WIFI_HW_BUG_WA`: activates the HW bug workaround for `IDW04A1`
chuanga 0:43ff9e3bc244 51 * `SPWFSAXX_WAKEUP_PIN`: defines module wakeup pin _(requires value)_
chuanga 0:43ff9e3bc244 52 * `SPWFSAXX_RESET_PIN`: defines module reset pin _(requires value)_
chuanga 0:43ff9e3bc244 53 * `SPWFSAXX_RTS_PIN`: defines RTS pin of the UART device used _(requires value)_
chuanga 0:43ff9e3bc244 54 * `SPWFSAXX_CTS_PIN`: defines CTS pin of the UART device used _(requires value)_
chuanga 0:43ff9e3bc244 55
chuanga 0:43ff9e3bc244 56 **Note**: if the values of both `SPWFSAXX_RTS_PIN` and `SPWFSAXX_CTS_PIN` are different from `NC`, hardware flow control - if available on your development board - will be enabled on the used UART device (provided you are using `mbed-os` version greater than or equal to `v5.7.0`).
chuanga 0:43ff9e3bc244 57
chuanga 0:43ff9e3bc244 58
chuanga 0:43ff9e3bc244 59 ## Module firmware
chuanga 0:43ff9e3bc244 60
chuanga 0:43ff9e3bc244 61 Please make sure that you are using the latest `major.minor` releases of the firmware available for the expansion boards as have been used for the development of this driver. The driver has been developed with the following FW versions installed:
chuanga 0:43ff9e3bc244 62 * for [X-NUCLEO-IDW01M1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw01m1.html): Version 3.5.3 (SPWF01S-170111-665d284)
chuanga 0:43ff9e3bc244 63 * for [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html): Version 1.1.0 (SPWF04S-171117-0328fe3).
chuanga 0:43ff9e3bc244 64
chuanga 0:43ff9e3bc244 65 Regarding information on how to perform a FW update you may refer to [X-CUBE-WIFI1](http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software-expansion/x-cube-wifi1.html), especially to document **"X-NUCLEO-IDW0xx1- FW upgrading over UART_v1.2.pdf"** which is contained within folder **"Documentation"** of the X-CUBE-WIFI1 software archive you need to download.
chuanga 0:43ff9e3bc244 66
chuanga 0:43ff9e3bc244 67 The actual firmware `.bin` or `.hex` files can be found under
chuanga 0:43ff9e3bc244 68 - [STSW-WIFI001](http://www.st.com/content/st_com/en/products/embedded-software/wireless-connectivity-software/stsw-wifi001.html) _for what concerns expansion board_ X-NUCLEO-IDW01M1 _and under_
chuanga 0:43ff9e3bc244 69 - [STSW-WIFI004](http://www.st.com/content/st_com/en/products/embedded-software/wireless-connectivity-software/stsw-wifi004.html) _when considering_ X-NUCLEO-IDW04A1.
chuanga 0:43ff9e3bc244 70
chuanga 0:43ff9e3bc244 71
chuanga 0:43ff9e3bc244 72 ## Known limitations
chuanga 0:43ff9e3bc244 73
chuanga 0:43ff9e3bc244 74 * Like explained in issue [#11](https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/issues/11), sockets might fail to close in case they are connected to a streaming server (e.g. a [RFC 864](https://tools.ietf.org/html/rfc864) test server).
chuanga 0:43ff9e3bc244 75 * As highlighted by issue [#13](https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/issues/13), the module FW limits the maximum segment size for TCP to 730 bytes, while the maximum UDP datagram length might even be further limited (but usually is also equal to 730 bytes).
chuanga 0:43ff9e3bc244 76