MCU/WISE-1540 SDK

From ESS-WIKI
Revision as of 07:46, 11 September 2017 by Will.chen (talk | contribs)
Jump to: navigation, search

Introduction

This document is description about WISE-1540 software development kit (SDK). It includes source tree of SDK, development environment, flash programming…etc. There are some examples provided by WISE-1540 SDK the user can refer to it for how to do about connection to WISE-PaaS, communication between mote and gateway…etc., and also can refer to it for developing their application.

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

The user can find source tree as below from WISE-1540-SDK.


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

The user needs to prepare for hardware as following:
  • 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.

Step01: Please prepare boards as below.
WISE1520 SDK HW 04-6.png

WISE-1540
The user must to choose the CN1 on WISE-1540 as below is connected to WISE-ED20 or WISE-ED22 through FPC
Wise1540 cn1.png

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.


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".


Console for API

We provide the console and the user can set parameters for connectivity by command set we supported.


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. Please refer to below link for information about how to setup CLI.


Flash Programming

For flash programming, the user can do it through WISE-ED22 or WISE-ED20 with different programming tool. Please refer to the following steps for 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.

Wise1540 rogramming through ed20 01.png


Step02: Installation process.

Wise1540 programming through ed20 02.png


Step03: Finish installation.

Wise1540 programming through ed20 03.png


Programming

Step01 Set into programming mode.

Please check pin1 of SW2 to “ON” on WISE-ED20 for flash programming.

WISE1520 SDK HW Siwtch wiseed30 programming mode.png


Step02: Launch Flash Loader and select Port name "COMx" detected from your PC.

Wise1540 programming through ed20 04.png



Step03: Check device if get response from it.

Wise1540 programming through ed20 05.png



Step04: Select target as below for programming.

Wise1540 programming through ed20 06.png



Step05: Enable option "Global Erase" and programming for binary from the path you specified.

Wise1540 programming through ed20 07.png



Step06: Programming in progress.

Wise1540 programming through ed20 08.png



Step07: Check the process of programming is done and successful.

Wise1540 programming through ed20 09.png


Step08 Set into boot mode.
Please check pin1 of SW2 to “OFF” on WISE-ED20.

WISE1520 SDK HW Siwtch wiseed30 boot mode.png


Step09: Boot from flash.
Press reset button and you can see snapshot like as below.

Wise1540 programming through ed20 10.png

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

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

Wise1540 example 02-01.png


② 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.

Wise1540 example 08-01.png


③ Compile and output binary.
PC # cd wise1021_senddata_gw/
PC # make clean
PC # make

wise1540_example_03-01.png

PC # ls ipmg/

wise1540_example_09-01.png



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

wise1540_example_05-01.png


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.
Wise1540 programming through ed20 10.png


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.

Wise1540 programming through ed20 10.png


Appendix

References

Liner Dust

About SmartMesh IP Networks:

SmartMesh IP Mote CLI Guide
SmartMesh IP Mote API Guide