Added support for the WNC M14A2A Cellular LTE Data Module.

Dependencies:   WNC14A2AInterface

Easy Connect

Easily add all supported connectivity methods to your mbed OS project

This project is derived from https://developer.mbed.org/teams/sandbox/code/simple-mbed-client-example/file/dd6231df71bb/easy-connect.lib. It give user the ability to switch between connectivity methods and includes support for the WNC14A2A Data Module. The `NetworkInterface` API makes this easy, but you still need a mechanism for the user to select the connection method, The selection is made by modifying the `mbed_app.json` file and using `easy_connect()` from your application.

Specifying connectivity method

To add support for the WNC14A2A, add the following to your ``mbed_app.json`` file:

mbed_app.json

{
    "config": {
        "network-interface":{
            "help": "options are ETHERNET,WIFI_ESP8266,WIFI_ODIN,MESH_LOWPAN_ND,MESH_THREAD,WNC14A2A",
            "value": "WNC14A2A"
        }
    },
}

After you choose `WNC14A2A` you'll also need to indicate if you want debug output or not by Enabling (true) or Disabling (false) WNC_DEBUG.

If WNC_DEBUG is enabled, there are 3 different levels of debug output (selected via bit settings). These debug levels are set using the following values:

ValueDescription
1Basic WNC driver debug output
2Comprehensive WNC driver debug output
4Network Layer debug output

You can have any combination of these three bit values for a total value of 0 – 7.

WNC Debug Settings

    "config": {
        "WNC_DEBUG": {
            "value": false
        },
        "WNC_DEBUG_SETTING": {
            "value": 4
        },
    }

Using Easy Connect from your application

Easy Connect has just one function which will either return a `NetworkInterface`-pointer or `NULL`:

Sample Code

#include "easy-connect.h"

int main(int, char**) {
    NetworkInterface* network = easy_connect(true); /* has 1 argument, enable_logging (pass in true to log to serial port) */
    if (!network) {
        printf("Connecting to the network failed... See serial output.\r\n");
        return 1;
    }
 
    // Rest of your program
}

Tested on

  • K64F with Ethernet.
  • AT&T Cellular IoT Starter Kit with WNC M14A2A Cellular Data Module

The WNCInterface class currently supports the following version(s):

  • MPSS: M14A2A_v11.50.164451 APSS: M14A2A_v11.53.164451

License

This library is released under the Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License and may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Committer:
group-Avnet
Date:
Wed Apr 19 01:08:11 2017 +0000
Revision:
0:478cfd88041f
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-Avnet 0:478cfd88041f 1 Getting Started with Contiki for STM32 Nucleo equipped with sub-1GHz SPIRIT1 expansion boards
group-Avnet 0:478cfd88041f 2 =============================================================================================
group-Avnet 0:478cfd88041f 3
group-Avnet 0:478cfd88041f 4 This guide explains how to get started with the STM32 Nucleo and expansion boards port to Contiki.
group-Avnet 0:478cfd88041f 5
group-Avnet 0:478cfd88041f 6 Port Feature
group-Avnet 0:478cfd88041f 7 ============
group-Avnet 0:478cfd88041f 8
group-Avnet 0:478cfd88041f 9 The port supports the following boards from ST:
group-Avnet 0:478cfd88041f 10 - NUCLEO-L152RE board, based on the STM32L152RET6 ultra-low power microcontroller
group-Avnet 0:478cfd88041f 11 - X-NUCLEO-IDS01A4 based on sub-1GHz SPSGRF-868 SPIRIT1 module (operating at 868 MHz)
group-Avnet 0:478cfd88041f 12 - X-NUCLEO-IDS01A5 based on sub-1GHz SPSGRF-915 SPIRIT1 module (operating at 915 MHz)
group-Avnet 0:478cfd88041f 13 - X-NUCLEO-IKS01A1 featuring motion MEMS and environmental sensors (optional)
group-Avnet 0:478cfd88041f 14
group-Avnet 0:478cfd88041f 15 The following drivers are included:
group-Avnet 0:478cfd88041f 16 - LEDs and buttons (user, reset)
group-Avnet 0:478cfd88041f 17 - USB
group-Avnet 0:478cfd88041f 18 - SPIRIT1 sub-1GHz transceiver
group-Avnet 0:478cfd88041f 19 - HTS221, LIS3MDL, LPS25HB, LSM6DS0 sensors
group-Avnet 0:478cfd88041f 20
group-Avnet 0:478cfd88041f 21
group-Avnet 0:478cfd88041f 22 Hardware Requirements
group-Avnet 0:478cfd88041f 23 =====================
group-Avnet 0:478cfd88041f 24
group-Avnet 0:478cfd88041f 25 * NUCLEO-L152RE development board
group-Avnet 0:478cfd88041f 26
group-Avnet 0:478cfd88041f 27 >The NUCLEO-L152RE board belongs to the STM32 Nucleo family.
group-Avnet 0:478cfd88041f 28 It features an STM32L152RET6 ultra-low power microcontroller based on ARM Cortex M3 MCU.
group-Avnet 0:478cfd88041f 29 Detailed information on the NUCLEO-L152RE development board can be found at:
group-Avnet 0:478cfd88041f 30 http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260002
group-Avnet 0:478cfd88041f 31
group-Avnet 0:478cfd88041f 32
group-Avnet 0:478cfd88041f 33 * X-NUCLEO-IDS01Ax sub-1GHz expansion board
group-Avnet 0:478cfd88041f 34
group-Avnet 0:478cfd88041f 35 >The X-NUCLEO-IDS01A4 and X-NUCLEO-IDS01A5 are STM32 Nucleo expansion boards that use
group-Avnet 0:478cfd88041f 36 the module SPSGRF-868 or SPSGRF-915 based on SPIRIT1 low data rate, low power sub-1 GHz transceiver.
group-Avnet 0:478cfd88041f 37
group-Avnet 0:478cfd88041f 38 >The user can select the X-NUCLEO-IDS01A4 board to operate the SPIRIT1 transceiver at 868MHz or the X-NUCLEO-IDS01A5 board to operate the SPIRIT1 transceiver at 915MHz.
group-Avnet 0:478cfd88041f 39
group-Avnet 0:478cfd88041f 40 >Detailed information on the X-NUCLEO-IDS01A4 expansion board can be found at:
group-Avnet 0:478cfd88041f 41 http://www.st.com/web/catalog/tools/FM146/CL2167/SC2006/PF261982
group-Avnet 0:478cfd88041f 42
group-Avnet 0:478cfd88041f 43 >Detailed information on the X-NUCLEO-IDS01A5 expansion board can be found at:
group-Avnet 0:478cfd88041f 44 http://www.st.com/web/catalog/tools/FM146/CL2167/SC2006/PF261983
group-Avnet 0:478cfd88041f 45
group-Avnet 0:478cfd88041f 46 >Detailed information on the SPIRIT1 sub-1GHz transceiver can be found at:
group-Avnet 0:478cfd88041f 47 http://www.st.com/web/catalog/sense_power/FM2185/SC1845/PF253167
group-Avnet 0:478cfd88041f 48
group-Avnet 0:478cfd88041f 49 * X-NUCLEO-IKS01A1, motion MEMS and environmental sensors expansion board (OPTIONAL)
group-Avnet 0:478cfd88041f 50
group-Avnet 0:478cfd88041f 51 >The X-NUCLEO-IKS01A1 is a motion MEMS and environmental sensor evaluation board.
group-Avnet 0:478cfd88041f 52 The use of this board is optional in the stm32nucleo-spirit1 Contiki platform.
group-Avnet 0:478cfd88041f 53
group-Avnet 0:478cfd88041f 54 >Detailed information on the X-NUCLEO-IKS01A1 expansion board can be found at:
group-Avnet 0:478cfd88041f 55 http://www.st.com/web/catalog/tools/FM146/CL2167/SC2006/PF261191
group-Avnet 0:478cfd88041f 56
group-Avnet 0:478cfd88041f 57
group-Avnet 0:478cfd88041f 58 * USB type A to Mini-B USB cable, to connect the STM32 Nucleo board to the PC
group-Avnet 0:478cfd88041f 59
group-Avnet 0:478cfd88041f 60 Software Requirements
group-Avnet 0:478cfd88041f 61 =====================
group-Avnet 0:478cfd88041f 62
group-Avnet 0:478cfd88041f 63 The following software are needed:
group-Avnet 0:478cfd88041f 64
group-Avnet 0:478cfd88041f 65 * ST port of Contiki for STM32 Nucleo and expansion boards.
group-Avnet 0:478cfd88041f 66
group-Avnet 0:478cfd88041f 67 >The port is automatically installed when both the Contiki and the submodule repository are cloned: the former hosts the Contiki distribution and the ST platform interface, the latter hosts the actual library. The following commands are needed to download the full porting:
group-Avnet 0:478cfd88041f 68
group-Avnet 0:478cfd88041f 69 git clone https://github.com/STclab/contiki.git
group-Avnet 0:478cfd88041f 70 cd contiki/
group-Avnet 0:478cfd88041f 71 git checkout stm32nucleo-spirit1
group-Avnet 0:478cfd88041f 72 git submodule init
group-Avnet 0:478cfd88041f 73 git submodule update
group-Avnet 0:478cfd88041f 74
group-Avnet 0:478cfd88041f 75
group-Avnet 0:478cfd88041f 76 Note: the first and third steps are required only if using the STclab GitHub repository, they won't be needed any more once the Pull Request is accepted.
group-Avnet 0:478cfd88041f 77
group-Avnet 0:478cfd88041f 78 The platform name is: stm32nucleo-spirit1
group-Avnet 0:478cfd88041f 79
group-Avnet 0:478cfd88041f 80 * A toolchain to build the firmware: The port has been developed and tested with GNU Tools
group-Avnet 0:478cfd88041f 81 for ARM Embedded Processors.
group-Avnet 0:478cfd88041f 82 >The toolchain can be found at: https://launchpad.net/gcc-arm-embedded
group-Avnet 0:478cfd88041f 83 The port was developed and tested using this version: gcc-arm-none-eabi v4.8.3
group-Avnet 0:478cfd88041f 84
group-Avnet 0:478cfd88041f 85
group-Avnet 0:478cfd88041f 86 Examples
group-Avnet 0:478cfd88041f 87 ========
group-Avnet 0:478cfd88041f 88
group-Avnet 0:478cfd88041f 89 The following examples have been successfully tested:
group-Avnet 0:478cfd88041f 90
group-Avnet 0:478cfd88041f 91 * examples/stm32nucleo-spirit1/sensor-demo
group-Avnet 0:478cfd88041f 92 * examples/ipv6/simple-udp-rpl (multicast, rpl-border-router, simple-udp-rpl)
group-Avnet 0:478cfd88041f 93
group-Avnet 0:478cfd88041f 94
group-Avnet 0:478cfd88041f 95 Build an example
group-Avnet 0:478cfd88041f 96 ================
group-Avnet 0:478cfd88041f 97 In order to build an example go to the selected example directory (see a list of tested
group-Avnet 0:478cfd88041f 98 examples in the previous section).
group-Avnet 0:478cfd88041f 99
group-Avnet 0:478cfd88041f 100 For example, go to examples/ipv6/simple-udp-rpl directory.
group-Avnet 0:478cfd88041f 101
group-Avnet 0:478cfd88041f 102
group-Avnet 0:478cfd88041f 103 If the X-NUCLEO-IDS01A4 sub-1GHz RF expansion board is used, the following must be run:
group-Avnet 0:478cfd88041f 104
group-Avnet 0:478cfd88041f 105 make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A4 clean
group-Avnet 0:478cfd88041f 106 make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A4
group-Avnet 0:478cfd88041f 107
group-Avnet 0:478cfd88041f 108 If the X-NUCLEO-IDS01A5 sub-1GHz RF expansion board is used, the following must be run:
group-Avnet 0:478cfd88041f 109
group-Avnet 0:478cfd88041f 110 make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A5 clean
group-Avnet 0:478cfd88041f 111 make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A5
group-Avnet 0:478cfd88041f 112
group-Avnet 0:478cfd88041f 113
group-Avnet 0:478cfd88041f 114 This will create executables for UDP sender and receiver nodes.
group-Avnet 0:478cfd88041f 115
group-Avnet 0:478cfd88041f 116 In order to generate binary files that can be flashed on the STM32 Nucleo the following command must be run:
group-Avnet 0:478cfd88041f 117
group-Avnet 0:478cfd88041f 118 arm-none-eabi-objcopy -O binary unicast-sender.stm32nucleo-spirit1 unicast-sender.bin
group-Avnet 0:478cfd88041f 119 arm-none-eabi-objcopy -O binary unicast-receiver.stm32nucleo-spirit1 unicast-receiver.bin
group-Avnet 0:478cfd88041f 120
group-Avnet 0:478cfd88041f 121 These executables can be programmed on the nodes using the procedure described hereafter.
group-Avnet 0:478cfd88041f 122
group-Avnet 0:478cfd88041f 123
group-Avnet 0:478cfd88041f 124 In case you need to build an example that uses the additional sensors expansion board
group-Avnet 0:478cfd88041f 125 (for example, considering a system made of NUCLEO-L152RE, X-NUCLEO-IDS01A4 and X-NUCLEO-IKS01A1)
group-Avnet 0:478cfd88041f 126 then the command to be run would be:
group-Avnet 0:478cfd88041f 127
group-Avnet 0:478cfd88041f 128 make TARGET=stm32nucleo-spirit1 USE_SUBGHZ_BOARD=IDS01A4 USE_SENSOR_BOARD=1
group-Avnet 0:478cfd88041f 129
group-Avnet 0:478cfd88041f 130 System setup
group-Avnet 0:478cfd88041f 131 ============
group-Avnet 0:478cfd88041f 132
group-Avnet 0:478cfd88041f 133 1. Check that the jumper on the J1 connector on the X-NUCLEO-IDS01Ax expansion board is connected.
group-Avnet 0:478cfd88041f 134 This jumper provides the required voltage to the devices on the board.
group-Avnet 0:478cfd88041f 135
group-Avnet 0:478cfd88041f 136 2. Connect the X-NUCLEO-IDS01Ax board to the STM32 Nucleo board (NUCLEO-L152RE) from the top.
group-Avnet 0:478cfd88041f 137
group-Avnet 0:478cfd88041f 138 3. If the optional X-NUCLEO-IKS01A1 board is used, connect it on top of the X-NUCLEO-IDS01Ax board.
group-Avnet 0:478cfd88041f 139
group-Avnet 0:478cfd88041f 140 4. Power the STM32 Nucleo board using the Mini-B USB cable connected to the PC.
group-Avnet 0:478cfd88041f 141
group-Avnet 0:478cfd88041f 142 5. Program the firmware on the STM32 Nucleo board.
group-Avnet 0:478cfd88041f 143 This can be done by copying the binary file on the USB mass storage that is
group-Avnet 0:478cfd88041f 144 automatically created when plugging the STM32 Nucleo board to the PC.
group-Avnet 0:478cfd88041f 145
group-Avnet 0:478cfd88041f 146 6. Reset the MCU by using the reset button on the STM32 Nucleo board
group-Avnet 0:478cfd88041f 147
group-Avnet 0:478cfd88041f 148
group-Avnet 0:478cfd88041f 149
group-Avnet 0:478cfd88041f 150
group-Avnet 0:478cfd88041f 151
group-Avnet 0:478cfd88041f 152
group-Avnet 0:478cfd88041f 153
group-Avnet 0:478cfd88041f 154
group-Avnet 0:478cfd88041f 155