nxp semiconductors | automotive, security, iot - hands-on … · 2016-11-23 · start your iot...

Post on 14-Jul-2020

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

External Use

TM

Hands-on Workshop: Using Wireless

Connectivity Stacks and Tools to Create

Multi-Protocol projects for the Internet of

Things (IoT)

FTF-SDS-F0042

A P R . 2 0 1 4

Alan Collins | Wireless Applications Engineer

Alin Lazar | Software Team Manager

Angel Corona | Connectivity Engineer

TM

External Use 1

Session Introduction

This session will:

• Provide an overview on the wireless connectivity and its challenges for the IoT

• Show Freescale innovative solutions for wireless connectivity.

• Introduce the Dual-PAN concept: single radio participating in two complex networks simultaneously. This translates into a cost effective design.

• Hands-on training using complex software stacks to enable multiple wireless protocols

TM

External Use 2

Session Objectives

After completing this session you will be able to:

Start your IoT design and development understanding

the wireless connectivity landscape & challenges.

Use complex wireless multi-protocol software stack for

embedded systems.

Locate the documentation and reference designs to help

you on your IoT product.

TM

External Use 3

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-On training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 4

Dual-PAN Concept Overview

What exactly is the Dual-PAN?

• PAN Personal Area Network

• Dual-PAN Id feature allows a single 802.15.4 radio

participate in different networks simultaneously

TM

External Use 5

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-on training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 6

The Internet of Things

M2M. Connectivity. Context.

TM

External Use 7

IoT Use cases

• Smart Connectivity

• Personalized Marketing

• Statistical behavior

• New Patterns search triggered by relevant events

• Remove/Add feature-set to existing/new products

• Others we can imagine,

• Others we will discover…

TM

External Use 8

Slices of the IoT pie: We all want a piece of it

SENSORS Compass

Magnetometer

Accelerometer

Touch sensor

Gyroscope

Altimeter/pressure

Temperature

Humidity

ACTUATORS Motors

Water Engines

Hydraulic

Motion control

Servomechanisms

MICROCONTROLLERS 8-, 16-, 32-bit

Low Power

Frequency of operation

Memory

Inputs/Outputs

Serial Interfaces & Connectivity

Built-in Analog and Sensors

CONNECTIVITY Wired & Wireless

Protocol Standards

Ethernet

USB

Wi-Fi

Bluetooth 4.1

ZigBee

ANT+

IPv6 + 6LoWPAN

TM

External Use 9

Slices of the IoT pie: We all want a piece of it

CLOUD Software, platforms and

infrastructure Services

Remotely through the internet

Share resources to achieve

coherence & economies of scale

BIG DATA & ANALYTICS Collection of data sets

Large & complex

Database management tools

Statistical analysis

SECURITY Encryption

High security across protocols and

layers

Network access

Data access

Weakest link in the chain in the most

important

FRONT-END User Interface

Smart Phones, Tablets, TV, Laptop

TM

External Use 10

CLOUD

Gateway

IoT Building blocks

Edge Node

Sensors

Actuator Microcontroller

Connectivity

Connectivity

Connectivity

Connectivity

MCU

BIG DATA & ANALYTICS

TM

External Use 11

IoT is all about the services

• Existing Business model

• New opportunities for users and service providers

Thank you for downloading

your new IoT service. It’s free

of charge, we just need your

permission to access to your

profile data. Please read the

following agreement…

More things are connecting to the Internet

than people — over 12.5 billion devices in

2010 alone. We will have 50 billion devices

connected by 2020.

Cisco’s Internet Business Solutions Group

TM

External Use 12

Wireless Connectivity for the IoT

TM

External Use 13

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-On training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 14

Dual-PAN Use Cases

RF4CE Network

Application

Profiles

802.15.4 PHY

802.15.4 MAC

RF4CE

802.15.4 PHY

802.15.4 MAC

Network

Security

Application Support

Sub-Layer

Application

Framework ZigBee

Device

Objects

ZigBee 2007/PRO

802.15.4 PHY

802.15.4 MAC

6LowPAN adaptation

IPv6, IPv4

IP stack

6LowPAN adaptation

IPv6

NWK

manage

r (ND,

RPL)

UDP

Security

ZigBee SE 2.0

802.15.4 PHY

802.15.4 MAC

TC

P

ZigBee IP

Pick two network flavors from the protocols landscape:

• Smart Energy

• Home Automation

• RF4CE

• ZigBee IP (Smart Energy 2.0)

• IPv6 through 6LoWPAN adaptation for 802.15.4

• Enable CoAP and other RESTful architecture frameworks

• 802.15.4

• Proprietary

• All others…

TM

External Use 15

Dual-PAN Use Case: Smart Energy & Home Automation

Smart Energy

• Smart Energy

Network − Security enhanced.

− Utilities own the network

TM

External Use 16

Smart Energy Home Automation

Dual-PAN Use Case : Home Automation Network

• Smart Energy Network − Security enhanced.

− Utilities own the network

• Home Automation Network − Residential Security.

− Home owns the network

TM

External Use 17

Smart Energy Home Automation Dual PAN – SE/HA

Dual-PAN Use Case : Smart Energy and Home Automation

• Smart Energy Network − Security enhanced.

− Utilities own the network

• Home Automation Network − Residential Security.

− Home owns the network

• Dual-PAN − Smart Energy &

Home Automation

TM

External Use 18

IoT Convergence to IP Funnel

Wi-Fi, Ethernet,

BT 4.1, PLC, 802.15.4,

Etc…

Web services / EXI

CoAP, SE 2.0, HTTPS, ...etc

TCP, UDP

IP (v6, v4)

APP

Transport

Network

Link/PHY

TM

External Use 19

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-On training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 20

Multiple Radios Solution : Example One

• Two radios

• Two antennas and all RF components

• Two crystals (oscillators)

• Complex RF certification

TM

External Use 21

Multiple Radios Solution : Example Two

• MCU controls two stand – alone radios using a communication

interface

• Reduces cost, but increase the engineering complexity

• Still two antennas are needed with all RF components

TM

External Use 22

Dual-PAN Concept Overview - AGAIN

What exactly is the Dual-PAN?

PAN Personal Area Network

Dual-PAN Id feature allows a single 802.15.4 radio participate

in different networks simultaneously

TM

External Use 23

Where’s the Complexity of Dual-PAN?

TX is simple

• Just take control of the Radio and perform TX

• If ACK is required you wait in RX right after the TX

TX: PAN 0

TX: PAN 1

TX: PAN 0 TX: PAN 0

TX: PAN 1

Dual-PAN

enabled

ACK

TM

External Use 24

Where’s the Complexity of Dual-PAN?

RX

• RX requires more complexity and synchronization

Dual-PAN

enabled

TX: PAN 1

TX: PAN 0

RETRY

TM

External Use 25

Dual-PAN by SW Solution

• Dual-PAN by software

• Takes longer time to respond on each network

• Some automatic filtering features (MAC ACK, NWK address, PAN

ID and etc.) cannot be used

TM

External Use 26

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-on training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 27

Freescale Dual-PAN Feature Implementation

PAN0 PAN1

MacPANID0 (16-bit register) MacPANID1 (16-bit register)

MacShortAddrs0 (16-bit register) MacShortAddrs1 (16-bit register)

MacLongAddrs0 (64-bit registers) MacLongAddrs1 (64-bit register)

PANCORDNTR0 (1-bit register) PANCORDNTR1 (1-bit register)

Channel0 Channel1

How the Dual-PAN works

• Maintains two sets of network parameters − PAN, MAC address, Network Address, Operation Channel

• Supports manual and automatic modes for switching between networks − Manual – controlled by software

− Auto – controlled by hardware

• Device can function as a coordinator, router or end device on each network.

TM

External Use 28

Dual-PAN in Multiple Channels

2 PANs, 2 Channels

• Time to dwell on channel can be set from 0.5 ms to 3.2 seconds

− Dwell prescaler and dwell selector registers

• If PAN is active when timer expired, sequence will complete before

channel switch occurs

• Channel switch is 68 us

• Time to switch, poll, receive packet and switch back is <10ms

2 PANs, 1 Channel

• Address filtering is done simultaneously

• No channel switch is necessary

TM

External Use 29

Dual-PAN : Manual Mode

TM

External Use 30

Dual-PAN : Auto Mode

TM

External Use 31

Dual-PAN ID Demonstration

• 3 TWR-MKW2xDxxx boards

• Software available (http://www.freescale.com/beekit)

• Demonstrates Dual-PAN ID feature in AUTOMATIC mode @

802.15.4 MAC layer

− 1 FFDC (coordinator)

− 2 RFD (End devices)

• Coordinator will create 2 networks (2 PAN IDs, 2 Channels)

• Each End Device will join one network

• The End Devices will perform Packet Error Test addressing the

Coordinator

• The Coordinator shows how many packets it received from each

End Device in different PAN ID

TM

External Use 32

Dual-PAN ID Demonstration – 802.15.4 MAC Layer

End Device Menu

Coordinator Menu

TM

External Use 33

Freescale Multi-PAN Tool

TM

External Use 34

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-On training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 35

What is KW Series?

• Extension of Kinetis line to include Wireless connectivity

• MKW2x IEEE-802.15.4 Radio for the 2.4 GHz space

• MKW01x Very flexible Radio for the Sub-GHz space

• Kinetis W is available today.

• More information available in the following link: http://www.freescale.com/webapp/sps/site/taxonomy.jsp?code=KINETIS_W_SERIES

TM

External Use 36

Choosing the Right Wireless Technology

2.4GHz Sub-GHz

• Range:

− ~ 30m indoor,

− ~ 100-300m outdoor

− Robust NWK protocols (Like ZigBee) enable multi hoping.

• High effective data rate

− 802.15.4 (250kbps)

• PWR consumption

− Less time on-air

− Years of battery life

− Quick TX/RX turnaround time

− Retries and ACKS mechanism

• Smaller Antenna Size

− 2.4 GHz ~ 3.1cm

• Global standards for the IoT

• Exhibits significantly longer range

− ~ 100m indoor,

− ~ 500-800m outdoor

− Better building penetration capability.

• Typically lower data rate

− 50 – 100kpbs

• Reduced power consumption

− Low interference = easier transmissions + fewer retries

− Years of battery life

• Antenna Size

− 433MHz ~17.3cm 915MHz ~8.2cm

• Proprietary standards Lower deployment and operating costs

TM

External Use 37

Kinetis W Series: KW2x Wireless MCUs

Device Flash RAM Feature Package

MKW21D256VHA5 256 KB 32 KB No USB 8x8 56-pin LGA

MKW22D512VHA5 512 KB 64 KB USB 8x8 56-pin LGA

MKW24D512VHA5 512 KB 64 KB USB and Smart

Energy 2.0 8x8 56-pin LGA

http://www.freescale.com/KW2x

CPU

• Up to 50 MHz Cortex®-M4

• 16-channel-DMA

• Up to 512 KB Flash, 64 KB RAM, and 4k bytes of enhanced EEPROM/FlexRAM. Up to 64K FlexNVM (MKW21D256 only)

• Typical current consume: 250 uA/Mhz run, 1.7uA RTC standby

Radio Transceiver, 2.4GHz

• Highly integrated 2.4 GHz RF transceiver

• 802.15.4 Packet processor

• Supports single ended and diversity antennas

• Dual PAN support

• 110 dBm Link budget

• Programmable output power -30 to +8 dBm

• Sensitivity -102 dBm

• Low Power: TX 15mA @ 0dBm (CPU sleep), RX 15mA (CPU sleep)

Security

• Cryptography Acceleration Unit (CAU)

• AES encryption (FIPS 140)

• External tamper detect

• 32-bit CRC

System

• SPI (1), UART (2), I²C (2), USB FS OTG (KW22 and KW24)

• 8-channel 16-bit SAR ADC, 6-bit DA

• Real-Time Clock (RTC)

• Up to 24 GPIO, Multiple KBI

• Operating temperature of –40°C to 105°C

TM

External Use 38

KW20 Development Kit

Tower Form Factor • Use standalone or in Tower System

• Boards sold individually

• Combine as many boards as needed

TWR-KW21D256 or TWR-KW24D512

USB-dongle Form Factor • Use is as sniffer hardware

• Host processors

USB-KW24D512

Available in Q2 - 2014

TM

External Use 39

RF Hardware Support

TM

External Use 40

Freescale ZigBee Stacks

Hardware Hardware Hardware

802.15.4 PHY

802.15.4 MAC

SynkroRF NWK

802.15.4 PHY

802.15.4 MAC

Customer

Defined

&

Developed

802.15.4 SynkroRF

802.15.4 PHY

802.15.4 MAC

RF4CE NWK

RF4CE Profiles

RF4CE

Customer

Defined

Customer

Developed

Hardware

802.15.4 PHY

802.15.4-2006

MAC

ZigBee IP NWK

ZigBee Profiles

ZigBee IP

Customer

Developed

Hardware

802.15.4 PHY

802.15.4 MAC

ZigBee NWK

ZigBee Profiles

ZigBee PRO

Customer

Developed

HID IP stack

TM

External Use 41

Feature SMAC 802.15.4

MAC SynkroRF®

ZigBee®

RF4CE

ZigBee®

Pro

IP stack

ZigBee®

IP

Applications Cable Replacement

Remote Control Home Control

Home Automation Health Care

Building Automation

Smart Energy

Network

Stack No No Yes Yes Yes Yes Yes

Application

Profiles No No No Yes Yes No Yes

Memory

Requirement

s

4-8K 32K <40K <40K 128-160K 256K 256K

Network

Topology

Point-to-

Point

Peer-to-

Peer

Co-existing

Star

Co-existing

Star Tree Mesh Mesh

Star Tree Mesh

Typical # of

Nodes 2-100 2-1000

32 per

Controlled

Device

32 per

Target

Device

2-1000

ZigBee

Pro

2-32 2-32

Typical Data

Throughput 50-115K 90-115K 70-100K 70-100K 30-70K <50K <50K

802.15.4 Protocol Stack Comparison

TM

External Use 42

ZigBee Test Infrastructure and Tools

TM

External Use 43

ZTC – BlackBox and Test Serial API

100s of APIs and events

available across layers

TM

External Use 44

ZigBee Test Client

TM

External Use 45

Python Test Automation

TM

External Use 46

MKW2x key differentiators

Dedicated Hardware:

Dual PAN ID Participate in two networks simultaneously

Antenna Diversity Reduce multipath fading

MCU with powerful core and energy efficiency options

Flash / RAM capacity

High radio link budget

802.15.4 hardware engine

HW and SW enablement / support

TM

External Use 47

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-On training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 48

Hands-On Objective

• Work with the Dual PAN feature of Kinetis KW2x in practice

• Use a single KW2x device with a multi-protocol network hub

(gateway) application to implement 2 Dual PAN scenarios:

1. ZigBee Home Automation + ZigBee Smart Energy

2. UDP over IPv6 / 6LoWPAN + ZigBee Home Automation

TM

External Use 49

Dual PAN ZigBee Home Automation and Smart Energy

Dual PAN Hub

ZHA Combined Interface

SE Energy Service Interface

ZigBee Home

Automation Network

ZHA

Dimmable

Light

ZigBee Smart

Energy Network

SE Meter

TM

External Use 50

Dual PAN 6LoWPAN and ZigBee Home Automation

Dual PAN Hub

ZHA Combined Interface

IPv6 Data Concentrator

ZigBee Home

Automation Network

ZHA

Dimmable

Light

UDP over

IPv6 and 6LoWPAN

IPv6

End Node

TM

External Use 51

Hands-On Steps

1. Use MSD to program Dual PAN network hub firmware to TWR-

KW24

2. Use BeeKit and IAR EWARM to export and deploy ZigBee

applications end-nodes.

3. Create ZigBee Home Automation and Smart Energy Dual PAN

networks.

4. Control and monitor ZHA and SE end-nodes from the Dual PAN

hub.

5. Deploy 6LoWPAN end-node firmware to TWR-KW24.

6. Create Home Automation and 6LoWPAN Dual PAN networks.

7. Control and monitor IPv6 and ZHA end-nodes from the Dual PAN

hub.

TM

External Use 52

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-On training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 53

STEP 1:

Program Hub Firmware to

TWR-KW2x

TM

External Use 54

TWR-KW2x Hub Board Setup

• Plug in the 1st of the 3 TWR-KW2x board to the PC using the mini-USB port

• Check that switch SW5 next to the mini-USB port is set to the position towards the exterior of the board – this allows the board to be powered via mini-USB

• If needed, wait for device to be detected by Windows and drivers to be installed.

TM

External Use 55

TWR-KW2x Hub Board Setup

TM

External Use 56

TWR-KW2x Mass Storage Device

• Launch Windows Explorer and verify that a USB Mass Storage

Device called TWRKW2xDxxx is present. This allows easy binary

firmware programming using regular file copy-paste:

TM

External Use 57

Program Hub Firmware to TWR-KW2x Using MSD

• Open the Firmware DualPAN_ZHA_SE subfolder on your desktop

• Open the TWRKW2xDxxx mass storage drive root folder

• Drag and drop (or copy-paste) DualPAN_Hub_HA_SE_StnXX.srec file from DualPAN_ZHA_SE subfolder to TWRKW2xDxxx to begin firmware programming

• Wait while KW2x flash memory is updated with new firmware. Green LED D11 will blink during the process

TM

External Use 58

Firmware Update Verification

• When the firmware update is completed successfully, blue LEDs

D5 and D7 will be blinking.

TM

External Use 59

Disconnect the Board

• Disconnect the board before proceeding with deploying the other

two end node applications. We will reconnect it once we are ready

to start the wireless network formation

TM

External Use 60

STEP 2:

Use BeeKit to deploy ZHA and

Smart Energy end nodes

TM

External Use 61

Launch BeeKit

Launch the Freescale BeeKit configuration GUI:

TM

External Use 62

Select Codebase

Choose File Select Codebase…

TM

External Use 63

Select Codebase

Select Kinetis BeeStack 4.0 Codebase and click Set Active

1

2

TM

External Use 64

Create New Project

Choose File New Project…

TM

External Use 65

Create New Project: HA Dimmable Light

1. Select ZigBee Home

Automation Applications

Project Type

2. Select Ha DimmableLight

Template

3. Enter solution name.

4. Enter solution folder

location

5. Click OK

1

2

4

3

5

TM

External Use 66

BeeKit Wizard Configuration Overview

Review default configuration and click Next

TM

External Use 67

BeeKit Wizard Target Board

Leave board settings to TWR-KW24D512 and click Next

TM

External Use 68

BeeKit Wizard Platform Modules

Uncheck NVM module for application to revert to factory defaults on reset.

1

2

TM

External Use 69

BeeKit Wizard ZTC

Enable ZTC UART interface to Test Tool.

1

2

TM

External Use 70

BeeKit Wizard Device Type

Select Router ZigBee device type.

1

2

TM

External Use 71

BeeKit Wizard Concentrator

Leave default concentrator settings.

TM

External Use 72

BeeKit Wizard Security Settings

Leave default Network Security Parameters.

TM

External Use 73

BeeKit Wizard Security Keys

Leave default Network Security Key settings.

TM

External Use 74

BeeKit Wizard Addresses

Update PAN ID to be set to format 00 XX, where XX is your work station ID.

E.g.: if your station has ID: 02, set PAN ID to be 00 02.

1

2

TM

External Use 75

BeeKit Wizard RF Channel

Update default RF channel to be the one assigned to your work station.

E.g.: if the station has ID: 2, set channel to 12.

1

2

TM

External Use 76

BeeKit Wizard OTA Upgrade

Leave OTA Upgrade default settings. Click Finish to complete wizard.

TM

External Use 77

Adding a Second Project for Smart Energy

In the BeeKit Solution Explorer, right-click on top level solution and

choose Add Project…

TM

External Use 78

Create New Project: SE Metering Device

1. Select ZigBee Smart

Energy Applications

Project Type

2. Select SE Metering

Device Template

3. Click OK

1 2

3

TM

External Use 79

BeeKit Wizard Configuration Overview

Review default configuration and click Next

TM

External Use 80

BeeKit Wizard Target Board

Leave board settings to TWR-KW24D512 and click Next

TM

External Use 81

BeeKit Wizard Platform Modules

Uncheck NVM module for application to revert to factory defaults on reset.

1

2

TM

External Use 82

BeeKit Wizard Device Type

Leave default settings for device type. Meter will be an end device.

TM

External Use 83

BeeKit Wizard Low Power Mode

Leave default settings for Low Power Mode.

TM

External Use 84

BeeKit Wizard Concentrator

Leave default settings for Concentrator Mode.

TM

External Use 85

BeeKit Wizard Security Settings

Leave default settings for security settings, including ECC.

TM

External Use 86

BeeKit Wizard Security Keys

Leave default settings for Network Security Keys.

TM

External Use 87

BeeKit Wizard Addresses

Update PAN ID to be set to format 50 XX, where XX is your work station ID.

E.g.: if your station has ID: 02, set PAN ID to be 50 02.

1

2

TM

External Use 88

BeeKit Wizard RF Channel

Update default RF channel to be the one assigned to your work station.

E.g.: if the station has ID: 2, set channel to 12.

1

2

TM

External Use 89

BeeKit Wizard OTA Upgrade

Leave OTA Upgrade default settings. Click Finish to complete wizard.

TM

External Use 90

Export Projects

Choose Solution Export and Open Solution in CodeWarrior /

IAR Embedded Workbench…

TM

External Use 91

Export Projects to IAR EWARM

Ensure IDE is set to IAR Embedded Workbench, click OK and wait

for projects to be exported and launched in IAR EWARM.

1

2

TM

External Use 92

IAR EWARM Workspace

IAR EWARM workspace launches with the 2 end node projects.

TM

External Use 93

IAR EWARM Workspace

Right click on each of the 2 projects (Ha DimmableLight and Se

MeteringDevice) in EWARM workspace and choose Make to build

the applications firmware.

1 2

TM

External Use 94

TWR-KW2x Dimmable Light Board Setup

• Plug in the 2nd of the 3 TWR-KW2x board to the PC using the mini-USB port

• Check that switch SW5 next to the mini-USB port is set to the position towards the exterior of the board – this allows the board to be powered via mini-USB

• If needed, wait for device to be detected by Windows and drivers to be installed.

TM

External Use 95

Download Firmware Using IAR EWARM

Ensure Ha DimmableLight is highlighted (in bold) in workspace

TM

External Use 96

Download Firmware Using IAR EWARM

Choose Project Download Download active application 1

2 3

4

TM

External Use 97

Download Firmware Using IAR EWARM

1. Push the SW6 Reset on the TWR-KW2x board

2. LED D5 will blink

1

2

TM

External Use 98

Disconnect the HA Dimmable Light Board

• Disconnect the board before proceeding with deploying the other

application. We will reconnect it once we are ready to start the

wireless network formation

TM

External Use 99

TWR-KW2x SE Metering Device Board Setup

• Plug in the 3rd of the 3 TWR-KW2x board to the PC using the mini-USB port

• Check that switch SW5 next to the mini-USB port is set to the position towards the exterior of the board – this allows the board to be powered via mini-USB

• If needed, wait for device to be detected by Windows and drivers to be installed.

TM

External Use 100

Set SE Metering Device to Active

Right-click Se MeteringDevice entry and select Set as Active

TM

External Use 101

Download Firmware Using IAR EWARM

Choose Project Download Download active application 1

2 3

4

TM

External Use 102

Download Firmware Using IAR EWARM

1. Push the SW6 Reset on the TWR-KW2x board

2. LED D5 will blink

1

2

TM

External Use 103

Disconnect the SE Metering Device Board

• Disconnect the board before proceeding. We will reconnect it once

we are ready to start the wireless network formation.

TM

External Use 104

STEP 3:

Create ZHA and Smart Energy

Networks

TM

External Use 105

Reconnect TWR-KW2x DualPAN Hub Board

• Reconnect the first board (programmed with Hub firmware) to the

PC.

TM

External Use 106

Start Device Manager

• In Windows, enter “Device Manager” in Start menu search box,

then select the Device Manager entry once found in search results.

1

2

TM

External Use 107

Determine Hub Device COM Port

• In Device Manger, determine hub device COM Port by determining

the Port number assigned to OpenSDA CDC device.

TM

External Use 108

Setup Connection in Terminal Application

• Setup a Connection in Putty or Tera Term to previously determined

port on baud rate 115200bps.

1

2 3

TM

External Use 109

Verify Shell Functionality

TWR-KW2x DualPAN Hub ZHA + ZSE. Build: Mar 24 2014

Copyright (c) 2014 Freescale Semiconductor

$ _

Press SW6 Reset switch on TWR-KW2x hub to show shell banner

in terminal application

TM

External Use 110

Start ZigBee HA Combined Interface on 1st PAN (zigbee0)

$zigbee0 start

ZigBee Pro with ZHA ZCL BeeStack v5.0.0.008 on PAN0

zigbee0 node ZC

zigbee0 channel 12

zigbee0 panid 0xE253

zigbee0 nwkAddr 0x0000

zigbee0 extPanId 0x0050C215857039A2

Check initial 2.4 GHz RF channel

assigned to station (11-26)

Check initial PAN ID assigned to

station.

HA Coordinator will always have

Network Address 0x0000

Extended PAN ID is randomly

generated

TM

External Use 111

Joining HA Dimmable Light Node

zigbee0 rx: transport key panid 0x0002 addr 0xE431

On Light Node: press SW3 to join

… and a transport key security indication is shown in shell interface

NWK address of Light Device

Is random Combined interface provisions

security key as a trust center to the Light

Light is joined to hub when LED D5 becomes

solid blue…

TM

External Use 112

STEP 4:

Control and Monitor ZHA and SE

End Nodes

TM

External Use 113

Discovering End Point and Setting Default Address Info

$ zcl0 find levelctrl server

zcl0: find levelctrl server...

zcl0 rx: find levelctrl server match: addr 0xE431 endpoint 0x08

$ zcl set addrinfo dstaddr 0xE431 dstep 0x08

zcl0: setaddrinfo...success

Discover Address and Endpoints for a ZHA

device that can be level controlled in the ZigBee

Network

Discovered Light Information

Use info above. Note: destaddr value

will be different in practice!!

TM

External Use 114

Controlling HA Dimmable Light Application

On Light: Press and HOLD SW4 for app mode

NWK address of Light Device

Is random

$ zcl0 send level move up

zcl0 rx: Data confirm status success

$ zcl0 send level move down

zcl0 rx: Data confirm status success

Note how LEDs D6, D7, D8

turn on and back off to emulate

a light dimming up and down

All blue LEDs will be initially off in app mode

TM

External Use 115

Starting SE Energy Service Interface Hub on 2nd PAN (zigbee1)

$ zigbee1 start

ZigBee Pro with SEP ZCL BeeStack v5.0.0.008 on PAN1

zigbee1 node ZC

zigbee1 channel 12

zigbee1 panid 0x5002

zigbee1 nwkAddr 0x0000

zigbee1 extPanId 0x0050C2C5D3A49B73

Check initial 2.4 GHz RF channel

assigned to station (11-26)

Check initial PAN ID assigned to

station.

Coordinator will always have Network

Address 0x0000

Extended PAN ID is randomly

generated

TM

External Use 116

Joining SE Metering Device Node

zigbee1 rx: transport key panid 0x5002 addr 0x96C3

On SE Metering Device Node: press SW3 to join

… and a transport key security indication is shown in shell interface

The node is joined to hub when LED D5

becomes solid blue…

TM

External Use 117

Retrieving SE Metering Data

zcl1 rx: srcaddr 0x96C3 srcep 0x08 dstep 0x08 seq 0x07 channel 12

zcl1 rx seq 0x07: report attr metering 0x0000 "Current summation dlvrd" value 0x0000000016BE

The current meter reading

• After joining, the metering device will periodically transmit meter data

• The DualPAN hub will display the data in the shell

TM

External Use 118

Changing Operating Frequency for ZigBee HA / SE

$ zigbee0 set channel 13

zigbee0 set channel 12 success

$ zigbee1 set channel 14

zigbee1 set channel 14 success

$ zcl0 send onoff toggle

zcl0 rx: Data confirm status success

$ zcl0 send onoff toggle

zcl0 rx: Data confirm status success

Pick a value between 11 and 26

different than the pre-assigned

channel. Both ZHA and SE networks

will shift to use another 2.4GHz RF frequency

channel.

ZHA commands are now sent

on different channel.

TM

External Use 119

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-On training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 120

STEP 5:

Program 6LoWPAN Firmware to

TWR-KW2x

TM

External Use 121

Reset the 3 Boards

Push the SW6 Reset on each TWR-KW2x board

TM

External Use 122

MSD Firmware Loading Exercise

Use the MSD procedure to re-flash boards #1 and #3 (currently

DualPAN Hub and SE MeteringDevice) using new firmware:

• Open Firmware DualPAN_ZHA_IPv6 subfolder on your desktop

• Open the TWRKW2xDxxx mass storage drive root folder for each

board.

• Drag and drop (or copy-paste)

DualPAN_Hub_HA_IPv6_StnXX.srec and

IPv6_EndNode_StnXX.srec to boards #1 and #3 respectively

TM

External Use 123

STEP 6:

Restart the ZigBee Network and

Create 6LoWPAN Network

TM

External Use 124

Verify Shell Functionality

TWR-KW2x DualPAN Hub ZHA + 6LoWPAN. Build: Mar 24 2014

Copyright (c) 2014 Freescale Semiconductor

$ _

Connect hub with new firmware to PC. Press SW6 Reset switch on

TWR-KW2x hub to show shell banner in terminal application:

TM

External Use 125

Restarting ZigBee Combined Interface Hub on 1st PAN

$ zigbee start

ZigBee Pro with ZHA ZCL BeeStack v5.0.0.008 on PAN0

zigbee0 node ZC

zigbee0 channel 12

zigbee0 panid 0x0002

zigbee0 nwkAddr 0x0000

zigbee0 extPanId 0x0050C22F7513C3D3

Check initial 2.4 GHz RF channel

assigned to station (11-26)

Check initial PAN ID assigned to

station.

HA Coordinator will always have

Network Address 0x0000

Extended PAN ID is randomly

generated

TM

External Use 126

Rejoining HA Dimmable Light Node

zigbee0 rx: transport key panid 0x0002 addr 0xE431

On Light Node: press SW3 to re-join

… and a transport key security indication is shown in shell interface

NWK address of Light Device

Is random Combined interface provisions

security key as a trust center to the Light

Light is joined to hub when LED D5 becomes

solid blue…

TM

External Use 127

STEP 7:

Control and Monitor ZHA and

6LoWPAN Nodes

TM

External Use 128

Discovering End Point and Setting Default Address Info

$ zcl find levelctrl server

zcl0: find levelctrl server...

zcl0 rx: find levelctrl server match: addr 0xE431 endpoint 0x08

$ zcl set addrinfo dstaddr 0xE431 dstep 0x08

zcl0: setaddrinfo...success

Discover Address and Endpoints for a ZHA

device that can be level controlled in the ZigBee

Network

Discovered Light Information

Use info above. Note: dstaddr value

will be different in practice!!

TM

External Use 129

Controlling HA Dimmable Light Application Level Control

On Light: Press and HOLD SW4 for app mode

NWK address of Light Device

Is random

$ zcl send level move up

zcl0 rx: Data confirm status success

$ zcl send level move down

zcl0 rx: Data confirm status success

Note how LEDs D6, D7, D8

turn on and back off to emulate

a light dimming up and down

All blue LEDs will be initially OFF in app mode

TM

External Use 130

Sending Light On/Off Cluster Toggle Commands

$ zcl send level move up

zcl0 rx: Data confirm status success

$ zcl send onoff toggle

zigbee0 rx: Data confirm status success

$ zcl send onoff toggle

zigbee0 rx: Data confirm status success

On Light Node: note LEDs toggling on/off

Repeat toggle several times.

Hint: press Up Key to re-load

command from shell history

TM

External Use 131

Pinging the 6LoWPAN Node via ICMPv6 on 2nd PAN

$ ping 2003::d0b8:8372:6354:4536:0002 1000 10

Pinging 2003::d0b8:8372:6354:4536:0002 with 32 bytes of data

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=15ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=25ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=26ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=18ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=18ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=23ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=19ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=22ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=24ms

Reply from 2003::d0b8:8372:6354:4536:0002: bytes=32 time=21ms

...

Use value assigned to the global IPv6

address of the End node for your

Work station. Example uses the value

for Station 02

TM

External Use 132

Opening and Sending Data on UDP Socket over 6LoWPAN

$ socket open udp 2003::d0b8:8372:6354:4536:0002 1234

Opening Socket on Data Concentrator... OK

Socket id is: 0

$ socket send 0 led2on

Command was sent

$ socket send 0 led2flash

Command was sent

$ socket send 0 led2off

Command was sent

Port

Send LED On/Off

commands also

over IPv6 Link.

Note LED D6 on

IP End Node Use value assigned to the global IPv6

address of the IP End node for your

station. Example uses the value for

Station 02

TM

External Use 133

Polling UDP Socket for Data

$ socket poll 0 2500

Keys:0000 Temp:29.64 Leds:1000

Keys:0000 Temp:29.59 Leds:0000

Keys:0000 Temp:29.56 Leds:1000

Keys:0000 Temp:29.56 Leds:0000

Keys:0010 Temp:29.83 Leds:1000

Keys:0010 Temp:30.19 Leds:0000

Keys:0010 Temp:29.83 Leds:1000

Keys:0010 Temp:29.75 Leds:0000

Keys:0010 Temp:29.75 Leds:0000

<Ctrl-C>

<INTERRUPT>

Temperature is read from KW2x

internal sensor. Keys pressed and

LED state is also transmitted when

polled periodically.

TM

External Use 134

Closing the UDP Socket

$ socket close 0

Socket 0 was closed

TM

External Use 135

Using Ubiqua and Test Tool for

Protocol Analysis

TM

External Use 136

Adding a Sniffer Device

• Launch Ubiqua

• Plug-in Sniffer device such as MC1322x-USB or KW2x-USB

• Select Device Add Device…

TM

External Use 137

Adding a Sniffer Device

1. Select Vendor: Freescale

2. Select COM port number in

device list. This example uses

MC1322x

3. Select Application: Sniffer

4. Click: Add Device

1

2

3

4

TM

External Use 138

Select RF Channel to Monitor

In Ubiqua Device Manager: right click sniffer device, choose Channel then select the channel to use

1

2

3

TM

External Use 139

Select Protocol to Decode

In Ubiqua Device Manager: right click sniffer device, choose

Protocol Stack then select the protocol to use (e.g.: ZigBee for

ZHA and SE, or IETF 6LoWPAN) 1

2

3

3

TM

External Use 140

Starting the Capture

In Ubiqua Device Manager: Set the Capture Knob to On

Status will change from Idle to Capturing…

TM

External Use 141

ZHA Capture Example

TM

External Use 142

Decoding ZCL Level Control Command: Move Up

TM

External Use 143

6LoWPAN Capture Example

TM

External Use 144

Test Tool ZigBee Test Client (ZTC) Serial Command Console

Double click

Ha Dimmable

Light

COM on

baudrate

38400

All ZigBee

commands

Command and

Macro

Shortcuts

Parameters

for Each

Command

Serial TX/RX

ZTC Message

Log

Send Command

TM

External Use 145

Agenda

• IoT overview

• Multiple-protocol networks

− Use cases

− Solutions

• Dual-PAN

• Freescale Kinetis W series MCUs

• Hands-on training

− Dual-PAN example 1: ZigBee HA + ZigBee SE

− Dual-PAN example 2: ZigBee HA + IP stack

• Summary

TM

External Use 146

Summary

• The IoT challenge of multi-protocols landscape

• Dual-PAN feature allows a single 802.15.4 radio to participate in two networks

simultaneously

− Dual-PAN is flexible enough to support different application requirements

− Dual-PAN translates into a cost efficient design while maintaining good

performance

• Kinetis W series

− Adding Wireless Connectivity to powerful MCUs

− Low Power oriented

− Terrific enablement tools and Software support

• EASE of USE of complex software stacks

top related