MCU/WISE-1540 SDK
Contents
Introduction
Glossary
- Gateway
- The gateway like WISE-3310 has connectivity with SmartMesh IP manager responsible for communication with WISE-1540.
- Mote
- The mote is WISE-1540 that has connectivity with SmartMesh IP mote responsible for communication with gateway.
WISE-1540 Software Development Kit (SDK)
Source Tree
Directory | Description |
doc/ | Documents about WISE-1540 SDK. |
inc/ | Header files including examples, sensor driver and etc. |
lib/ | Library. |
src/ | Source files including examples, sensor driver and etc. |
tool/ | Tools. |
Setup Development Environment
Preparing for Hardware
- For mote, WISE-1540, WISE-1500 and WISE-ED20 or WISE-ED22.
- For gateway, WISE-3310.
- PC running LINUX operating systems such as Ubuntu 16.04.1.
Please refer to the following steps for setup a WISE series of boards before using WISE-1540 SDK.
①WISE-1540
The user must to choose the CN1 on WISE-1540 as below is connected to WISE-ED20 or WISE-ED22 through FPC.
②WISE-1500
③WISE-ED20
④SW2 on WISE-ED20
- Please check pin1 and pin2 to “ON” as default.
- Switch pin1 to “ON”: flash programming, “OFF”: boot from flash.
⑤CN2 on WISE-1500
- Booting into the mode of network connection when both 3.3V and GPIO0 are opened.
- Booting into the mode of console of API when both 3.3V and GPIO0 are shorted.
⑥SW3 on WISE-1500
- Please check pin1 and pin2 to “OFF” as default.
- Switch pin2 to decide whether running “backup to default” while device booting. “ON”: enabled, “OFF”: disabled.
⑦One reset button on WISE-1500 and the other on WISE-ED20
⑧Micro USB connector
- Power supplies for UART3 debug port.
⑨Com port
- No supported.
Step02: Connect the WISE-ED20 to PC using micro-USB cable.
The device will be visible in the Device Manager as below after FTDI driver installed. The user can find the FTDI driver in source tree.
Setting for Connectivity
WISE-1540 is designed in connectivity for wireless IoT communication with Linear Dust SmartMesh IP wireless sensor networks. The Linear Dust networks support a self-forming and self-healing mesh network solution complaint to 6LoWPAN Internet Protocol (IP) and IEEE802.15.4e standard. Before using WISE-1540 SDK, the user needs to check or set some parameters through the console for API.
Information and Parameters Setting
The user needs to double check connectivity setting the same as below table with SmartMesh IP networks before using WISE-1540 SDK:
Parameter | Expected Setting |
Network ID | 2001 (The same as manager on WISE-3310) |
Join Key | 4A4F494E414456414E54454348494F54 (The same as manager on WISE-3310) |
Auto Join | On |
Reset to default setting
This function can be used back to default setting the same as above section "Information and Parameters Setting". The user can refer to section "Preparing for Hardware" for how to do it on the WISE-1500.
Console for API
We provide the console and the user can set parameters for connectivity by command set we supported.
Step01: Check device connected from WISE-ED20 or WISE-ED22 to PC using micro-USB cable and choose any terminal you like. (e.g., the snapshot is setting of Tera Term.)
Step02: Check jumper.
Please check both 3.3V and GPIO0 of CN2 are shorted on WISE-1500 and press reset button on the WISE-ED20 or WISE-ED22 to restart device.
Step03: User can see snapshot as below after begin execution.
ARM mbed
The ARM mbed is IoT device platform and it has a lot of resources for IoT development. We supported ARM mbed OS on WISE-1540 to make user easily to get started and obtain great benefit from ARM mbed.
mbed CLI
The mbed CLI is command-line tool. The user needs to setup CLI for WISE-1540 SDK and please follows the steps to install related tools. For more details, please refer to mbed CLI.
Note: We expected the user setups mbed CLI in Linux as default. If the user preferred Windows, ARM mbed provides the Video tutorial for manual installation.
- Install Python
- mbed CLI supports Windows, Linux and Mac OS X operating systems. You can select the OS you prefer to work with. mbed CLI is a Python script, so you’ll need Python to use it. The version 2.7.11 of Python has been verified with mbed CLI.
- Note: mbed CLI is incompatible with Python 3.
Install python 2.7.11 $ sudo wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz $ tar zxvf Python-2.7.11.tgz $ cd Python-2.7.11 $ sudo ./configure $ sudo make altinstall Check the python version $ python --version
- (Optional) Install Git or Mercurial
- If you would like to maintain your source code in repositories, you can continue with the next step. mbed CLI supports both Git and Mercurial repositories, you can install which one you prefer:
- Git - version 1.9.5 or later.
- Mercurial - version 2.2.2 or later.
- If you don’t want to use repositories, you can just skip it.
Install Git latest $ sudo add-apt-repository ppa:git-core/ppa $ sudo apt-get update $ sudo apt install git
Mercurial install commands as follow
Install mercurial latest $ sudo add-apt-repository ppa:mercurial-ppa/releases $ sudo apt-get update $ sudo apt-get install mercurial
- Install GCC
- mbed CLI invokes the mbed OS 5 tools for various features, such as compiling, testing and exporting to industry standard toolchains. To compile your code, you will need either a compiler or an IDE:
- Compilers: GCC ARM, ARM Compiler 5, IAR.
- IDE: Keil uVision, DS-5, IAR Workbench.
- We select GCC ARM Embedded, so you can install version 4.9 of GCC ARM Embedded.
Install GCC ARM Embedded $ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa $ sudo apt-get update $ sudo apt-get install gcc-arm-embedded
- Note: When installing the Arm Compiler 5 on a 64-bit Linux machine, you may need to also install the i386 architecture package:
$ sudo dpkg --add-architecture i386 $ sudo apt-get update $ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
- Install mbed CLI
- You can get the latest stable version of mbed CLI from PyPI
$ pip install mbed-cli
- Note: On Linux or Mac, you may need to run with sudo.
- Other necessary package
$ sudo pip install colorama $ sudo pip install pyserial $ sudo pip install prettytable $ sudo pip install jinja2 $ sudo pip install intelhex $ sudo pip install junit_xml $ sudo pip install mbed_ls $ sudo pip install beautifulsoup4 $ sudo pip install fuzzywuzzy $ sudo pip install mbed_host_tests $ sudo pip install mbed_greentea
mbed CLI configuration
- GCC_ARM_PATH
- Set GCC_ARM_PATH to the binary directory of your GCC Arm installation
$ mbed config -G GCC_ARM_PATH "/home/erick/gcc-arm-none-eabi-4_9-2015q3/bin" [mbed] /home/erick/gcc-arm-none-eabi-4_9-2015q3/bin now set as global GCC_ARM_PATH
Flash Programming
Programming through WISE-ED22
Please refer to WISE-ED22 for flash programming.
Programming through WISE-ED20
Running Flash Loader Installer
Step01: Find installer flash_loader_demo_v2.9.0RC1.exe” in source tree, run it to install tool and set installation directory to default as below.
Step02: Installation process.
Step03: Finish installation.
Programming
Step01 Set into programming mode.
Please check pin1 of SW2 to “ON” on WISE-ED20 for flash programming.
Step02: Launch Flash Loader and select Port name "COMx" detected from your PC.
Step03: Check device if get response from it.
Step04: Select target as below for programming.
Step05: Enable option "Global Erase" and programming for binary from the path you specified.
Step06: Programming in progress.
Step07: Check the process of programming is done and successful.
Step08 Set into boot mode.
Please check pin1 of SW2 to “OFF” on WISE-ED20.
Step09: Boot from flash.
Press reset button and you can see snapshot like as below.
Example
There are two examples in WISE-1540 SDK. One is “Send Data” the user can refer to it for how to use connectivity to send data from mote to gateway. The other is “Exchange Data with Sensor Format” the user can refer to it for how to add sensor in mote and send data accessed from sensor to WISE-PaaS through mote and gateway.
Compile example
Please refer to WISE-1540-SDK for compilation.
Send Data
This example is demonstrated how we could send data from mote to gateway. The user needs to run two programs synchronously that one is on WISE-1540 and the other is on gateway. In example it communicates with gateway using API in “mote_api.h” that can found located at folder “inc\wsn\sm_ipmt” of source tree of WISE-1540 SDK. The API has been implemented based on SmartMesh IP Mote API Guide and the user can refer to it for getting detailed if needed.
Please refer to the following to run example between mote and gateway:
Running example on Gateway
Step01: Get IoT Gateway SDK and Setup on PC.
The IoT Gateway SDK is not provided as default and the user needs contact with Advantech to get it.
Step02: Compile example.
① Set environment variable for compilation.
PC # cd /opt/poky/1.5.3/
PC # source ./environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
② The example “wise1021_senddata_gw.tar.bz2” is located in folder “src\sample” of source tree of WISE-1540 SDK. Please extract wise1021_senddata_gw.tar.bz2 to PC.
PC # tar jxvf wise1021_senddata_gw.tar.bz.
③ Compile and output binary.
PC # cd wise1021_senddata_gw/
PC # make clean
PC # make
PC # ls ipmg/
Step03: Upload binary to WISE-3310.
The following commands are for the user reference. These commands are demonstrated how the PC’s file system can be mounted through NFS on WISE-3310 and then the user can copy binary to WISE-3310 using command “cp”.
WISE-3310 # mount -t nfs -o nolock 172.22.12.223:/tmp /mnt/
WISE-3310 # cp /mnt/wise1021_senddata_gw/ipmg/wise1021_receive_sample /tmp
Step04: Begin execution.
The user can see snapshot as below while getting data from mote
WISE-3310 # /tmp/ipmg/wise1021_receive_sample /dev/ttyUSB0
Running example on WISE-1540
Step01: Compile example and programming.
① Please refer to WISE-1540-SDK for compilation.
② Please refer to section "Programming through WISE-ED22" or "Programming through WISE-ED20" for flash programming.
Exchange Data with Sensor Format
This example is demonstrated how it could exchange data with sensor format between mote and gateway. The sensor format defined by Advantech combines IPSO data format with CoAP like protocol. By implementation the user needs to study “WISE sensor API” to know how to add sensor by self. In example it adds fake temperature sensor with sensor format and exchanges data between mote and gateway. Finally the fake temperature will be transfer to WISE-PaaS and it is presented by UI on browser, but WISE-PaaS has no more detailed in this document. Please get contact about WISE-PaaS detailed with Advantech if needed.
How to Handle Data between Mote and Gateway
Based on sensor format, the brief in bidirectional explain how it has been implemented in example as below:
From mote to gateway:
① The data accessed from sensor are encoded as packet with sensor format by mote.
② The packet is sent from mote to gateway.
③ The packet is received and decoded by gateway and then the received information will be transfer to WISE-PaaS.
From gateway to mote :
① The data and command are encoded as packet by gateway.
② The packet is sent from gateway to mote.
③ The packet is received and decoded by mote.
④ Depend on command/data received from gateway, the information about WISE-1540 and sensor data in real time are encoded by mote and send it back to gateway.
Running Example
Please refer to the following to run example between mote and gateway:
Running example on Gateway
There is nothing to do. This example is supported as default on WISE-3310.
Running example on WISE-1540
Step01: Compile example and programming.
① Please refer to WISE-1540-SDK for compilation.
② Please refer to section "Programming through WISE-ED22" or "Programming through WISE-ED20" for flash programming.
Step02: Check status.
Appendix
References
Liner Dust
About SmartMesh IP Networks: