Top Banner
ZigBee Workshop (Nov 2009 - Special Release) Student Guide Revision 0.97 November 2009
68

ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Mar 09, 2018

Download

Documents

truongthuan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee Workshop (Nov 2009 - Special Release)

Student Guide

Revision 0.97 November 2009

Page 2: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Important Notice

ii ZigBee Workshop - Cover Page

Important Notice Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue any product or service without notice, and advise customers to obtain the latest version of relevant information to verify, before placing orders, that information being relied on is current and complete. All products are sold subject to the terms and conditions of sale supplied at the time of order acknowledgment, including those pertaining to warranty, patent infringement, and limitation of liability.

TI warrants performance of its semiconductor products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements.

Customers are responsible for their applications using TI components.

In order to minimize risks associated with the customer’s applications, adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards.

TI assumes no liability for applications assistance or customer product design. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such semiconductor products or services might be or are used. TI’s publication of information regarding any third party’s products or services does not constitute TI’s approval, warranty or endorsement thereof.

Copyright 2005, 2008 Texas Instruments Incorporated

Mailing Address

Texas Instruments Technical Training Organization 7839 Churchill Way, M/S 3984 Dallas, Texas 75251-1903

Texas Instruments Norway AS Low Power RF Gaustadalleen 21 N-0349 Oslo, Norway

Page 3: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee Stack

Introduction This module will take a fairly comprehensive look at the ZigBee stack. We’ll delve into forming a network, descriptors, the application framework, binding and other topics. By the end of the module with its 4 labs you should be able to ask the right questions (and maybe answer them) concerning how your application will utilize the ZigBee stack.

Objectives Starting a network

Routing

Packet Sniffer

Descriptors

Application Framework

Binding

ZDO API’s

Callbacks

Multiple Endpoints

Mobility

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 1

Page 4: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Module Topics

Module Topics

ZigBee Stack .............................................................................................................................................. 8-1

Module Topics......................................................................................................................................... 8-2

ZigBee Overview..................................................................................................................................... 8-3

ZigBee 2007 Features ............................................................................................................................. 8-4

ZigBee 2007 Summary ............................................................................................................................ 8-8

ZigBee Advantages and Architecture...................................................................................................... 8-9

Mesh Networking and Components .......................................................................................................8-10

PAN Formation......................................................................................................................................8-12

Routing...................................................................................................................................................8-13

Digging into the Stack............................................................................................................................8-15

Profiles...................................................................................................................................................8-16

Clusters ..................................................................................................................................................8-17

Endpoints ...............................................................................................................................................8-18

Descriptors.............................................................................................................................................8-19

Architecture ...........................................................................................................................................8-22

Application Framework and Send/Receive Data ...................................................................................8-23

Visualizing Acknowledgements ..............................................................................................................8-25

Digging Further into the Stack ..............................................................................................................8-26

Binding...................................................................................................................................................8-27

Digging still further into the ZigBee Stack.............................................................................................8-31

ZDO .......................................................................................................................................................8-32

Configuration.........................................................................................................................................8-34

Z-Tool ....................................................................................................................................................8-35

Third Party Tools...................................................................................................................................8-38

Mobility..................................................................................................................................................8-42

Smart Energy .........................................................................................................................................8-43

8 - 2 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 5: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee Overview

ZigBee Overview

ZigBee Overview

IEEE 802.15.4-2003 defines PHY/MAC

ZigBee 2007

Two stack profiles: ZigBee and ZigBee PRO

ZigBee RF4CE

ZigBee IP …?

2

ZigBee 2007 and ZigBee PRO ZigBee 2007

Based on proven 2006 feature set plus frequency agility and optional fragmentation

Basic features require less memory & resources than PRO

ZigBee PRO

Enhanced features optimize performance and RAM utilization under select scenarios

Feature enhancements based on identified limitations of ZigBee 2006 for specific network deployments

Interoperability

PRO devices will operate as End Devices on a ZigBee ‘06 or ‘07 network, and vice versa

ZigBee ‘06 and ‘07 network seamlessly

ZigBee 2007 Features ...4

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 3

Page 6: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee 2007 Features

ZigBee 2007 Features

ZigBee 2007 Feature Set

ZigBee

CSKIP Tree Addressing

AODV Routing

Backup Tree Routing

ZigBee PRO

Stochastic Addressing

AODV Routing

Many to One / Source Routing

Asymmetric Link Handling

Fragmentation

Frequency Agility

Basic Group Addressing

Limited Broadcast Addressing

Security

High Security

Fragmentation

Frequency Agility

Basic Group Addressing

Security

Address Assignment ...5

ZigBee 2007 - Automated Address Assignment

ZigBee: Tree Addressing Basics Uses CSKIP algorithm to dynamically distribute addresses Provides well defined topology for backup tree routing

Supports mobile End Devices through Rejoin and ED Announce

ZigBee PRO: Stochastic Addressing Basics Randomly assigns addresses to joining devices Deals with potential address conflict through resolution protocol Adds extended address to network packets for resolution Supports mobile End Devices through Rejoin and ED Announce

Group Addressing ...6

8 - 4 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 7: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee 2007 Features

CSKIP() Tree Address Allocation

Home Automation Profile:

MAX_CHILDREN = 20MAX_ROUTERS = 6MAX_DEPTH = 5

Coordinator child routers and ……….. child end_devices

0xFFFF0x0000 Coordinator addressRouter 0_0 Router 0_1 Router 0_2 Router 0_3 Router 0_4

…. Router 0_0 child routers and ………... child end_devices

0x143D0x0001 Router address – Depth 1

Router 3_0 child routers and .. child end_devices

0x00170x0004 Router address – Depth 4

Parents allocate addresses

At Depth 5, a single address is allocated (if a router, no devices can join it)

This is address assignment, not routing

ZigBee Mesh Networking ...

Router 0_5

Router 1_0 Router 1_1 Router 1_2 Router 1_3 Router 1_4 Router 1_5

22

ZigBee 2007 - Group Addressing

ZigBee: Basic Group Addressing Send broadcast out to entire network and filter by group ID at the

application layer

ZigBee PRO: Basic + Limited Broadcast Group Addressing Basic group addressing is same as ZigBee Group member can send limited broadcast with restrictions on

message propagation Limited broadcast restricts non-member re-broadcasts

Limited Broadcast Group Addressing Tradeoffs Network communication is reduced in very large networks where

communication is mostly local Sleeping devices cannot participate in the group Message sender has to be a group member Ineffective in small networks or for cross-network communication

Fragmentation ...7

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 5

Page 8: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee 2007 Features

ZigBee 2007 - Fragmentation

Basics Optional in BOTH ZigBee and ZigBee PRO

Used to disassemble and reassemble large application payloads Implemented at application layer as an add-on

Tradeoffs Allows application to send large packets without concern for size Adds code complexity and application header overhead

Frequency Agil ity ...8

ZigBee 2007 - Frequency Agility

Basics Mandatory in BOTH ZigBee and ZigBee PRO Used to compensate for RF interference by monitoring network

statistics and notifying ZDO when “problem” is detected ZDO of Network Manager responds accordingly

Tradeoffs Provides solution for interference prone environments Requires additional complexity maintaining network statistics Requires resynchronization when sleeping End Devices miss

channel migration message Can be costly in terms of battery consumption Can be problematic if a Router misses the “change” message

ZDO = ZigBee Device Object (network and device management)

PAN ID Conflict Resolution ...9

8 - 6 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 9: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee 2007 Features

ZigBee 2007 PAN ID Conflict Resolution

Basics ZigBee PRO feature only Used to resolve the scenario when co-existing networks select

the same PAN_ID on the same channel All devices monitor neighbor communication during joining to

identify duplicate PAN Network Manager handles resolution, backup Manager can be

designated

Tradeoffs When commanded to change PAN_ID, devices missing the

message can become stranded Commissioning can be used to prevent this problem

PAN = Personal Area Network

Security ...10

ZigBee 2007 Security

ZigBee: Basic Security Secured network communication through AES-128 encryption

ZigBee PRO: Basic + optional High Security High Security creates a mechanism for establishing link keys

between peer to peer connections High Security adds additional security when devices on the

network may not be trusted (inside attack)

High Security Tradeoffs Requires the overhead of link key establishment Adds significant complexity consuming valuable code space SE and HA profiles chose NOT to use high security CBA will probably not use high security

AES-128 = 128-bit Advanced Encryption Standard

ZigBee 2007 Summary ...11

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 7

Page 10: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee 2007 Summary

ZigBee 2007 Summary

ZigBee (non-PRO) Summary

ZigBee is useful … In most topologies; including Peer to Peer or Sensor

Reporting

ZigBee drawbacks include: Limited address assignment capabilities in a mobile

environment

Route establishment takes time and expends energy during route establishment in many source to Concentrator scenario

ZigBee PRO Summary ...12

ZigBee PRO Summary

ZigBee PRO is useful in networks with: Large deployments with a high ratio of mobile devices Many sensor nodes reporting to Concentrator High Security Requirements

ZigBee PRO drawbacks include: Additional features increase the code size and complexity Network will suffer reduced throughput due to communication

overhead Heavy burden on the “Concentrator” device Required Network Manager becomes a Point of Failure

ZigBee Sales Pitch ...13

8 - 8 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 11: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee Advantages and Architecture

ZigBee Advantages and Architecture

ZigBee Sales Pitch

Enable low cost, low power, reliable devices for monitoring and control

Ensure that devices are efficient in their use of the available bandwidth

Provide a platform and implementation for wirelessly networked devices

Make it easy to design and develop ZigBee devices

Reduce today’s cost of building wireless solutions

Enable “out-of-the-box” interoperable devices where desired by manufacturers

Architecture ...14

ZigBee Device Software Architecture

Physical HW (PHY)

OSAL

HAL/I/O

ZigBee Stack

TI-MAC

Endpoint app 1

Userapp

Endpoint app 0

ZDO

Endpoint app 240

Userapp

Mesh Network …15

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 9

Page 12: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Mesh Networking and Components

Mesh Networking and Components

Mesh Network Devices

ZigBee CoordinatorStarts the NetworkRoutes packetsManages securityAssociates Routers and End DevicesExample: Heating Central

ZigBee RouterRoutes packets Associates Routers and End DevicesExample: Light

ZigBee End DeviceSleeps most of the time Can be battery powered Does not routeExample: Light switch

Coordinator …

Devices are pre-programmed for their network function

16

Coordinator

Starts a non-beaconed PAN

Allows other devices to join it

Buffers messages for sleeping End Devices

Provides binding and address-table services

Routes messages

Dynamically repairs routing

Can have I/O capability

Manages security

Radio always on

Router ...17

8 - 10 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 13: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Mesh Networking and Components

Router

Does not own or start PAN (Scans to find a network to join)

Allows other devices to join it after PAN has been started

Routes messages

Dynamically repairs routing

Buffers messages for sleeping End Devices

Support secure messaging

Can have I/O capability

Radio always on

End-Device ...18

End Device

Does not:

route messages

own or start network

allow other devices to join it

Scans to find a PAN to join

Polls parent to get messages (can be disabled)

Can be mobile

Radio/CPU can sleep

Forming a network …19

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 11

Page 14: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

PAN Formation

PAN Formation

PAN Formation - Coordinator

ZDO NWK MAC PHY

Form PANpassive scan

Beacon request

Scan confirmed

Energy detecteach channel

active scan open channels

Scan confirmedFormationconfirmed

Perform

Perform

Notifyapplication viaZDO_STATE_CHANGEevent

A unique PAN ID is determined either from the IEEE address or dynamically

One channel is selected

Process fully automated once started

PAN discovery ...20

PAN Discovery/Join - Router and End-Device

ZDO NWK MAC PHY

Discover PAN Beacon requestactive scan open channels

Scan confirmedDiscoveryconfirmed

Perform

Join Associate Associate

AssociateAssociateJoin confirm

Notifyapplication viaZDO_STATE_CHANGEevent

List of discovered PANs are returned

Every chip has a unique 64-bit IEEE address (used for joining ID)

ZDO determines which PAN to join by PAN ID

Process fully automated once started

responseconfirm

request

Address Allocation ...21

8 - 12 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 15: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Routing

Routing

ZigBee Mesh Routing

Mesh network routing employs AODV (Ad Hoc On Demand Distance Vector Routing) Ad Hoc (Network is unknown at start-up) On Demand (Determines the route to the destination only when needed)

Distance Vector (Only the final destination and the next hop are stored at each node. Relies on a distributed protocol to handle routing)

Self healing upon route failure Reliable and robust. Failed router will reinitiate discovery and find an

alternative path

More routing info …23

ZigBee Mesh Routing Routing is a decentralized, cooperative process Routers (and Coordinator) forward unicast messages directly to the

destination Other messages prompt the router to check its’ routing table

If an entry exists, router forwards message to the next node If none exists, route discovery takes place

Route discovery searches all possible routes using request/response packets (RREQ/RREP) “Route cost”, a function of RSSI, to all neighbors is recorded Routing algorithm selects and stores: the destination address, the next

hop node address and the link status in the routing table Routes can be invalidated due to errors, expiration, mobile nodes or by the

user, prompting a new route discovery

Pro routing includes Many-to-One routing to optimize data concentrator traffic

Routing table …24

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 13

Page 16: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Routing

8 - 14 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Routing Table

Every routing device contains a Routing Table

The table stores information needed to route packets

Routes can automatically expire if not used for ROUTE_EXPIRY_TIME seconds (f8wconfig.cfg)

Routing table entry:

Destination address

Next hop node

Link status

A Route Discovery table stores temporary information while route discovery is in process

MAX_RREQ_ENTRIES (f8wconfig.cfg) sets the maximum number of simultaneous route discoveries that can be performed

Re-routing …25

Automatic Rerouting

1. Coordinator sends msgs to R3 via R1 (blue path), then R1 fails

2. Coordinator sends msgs to R3 via R2 (green path), then R2 fails

3. Coordinator sends msgs to R3 via R4 and R5 (red path)

Coord

R1

R2

R3

R4

R5

R6

ChannelConfiguration…

26

Page 17: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Digging into the Stack

Digging into the Stack

Digging Into the ZigBee Stack

Profiles

Clusters

Endpoints

Descriptors

Application Framework Send/Receive functions and structures

Application Acknowledgements

Third Party tools

Write to the LCD

Profiles ...30

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 15

Page 18: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Digging into the Stack

Profiles

Profiles ZigBee Alliance defines Profiles as a method to ensure application level

interoperability

Defines device types in the profile

Agrees on message format, content coding, and interpretation of clusters

Specifies network stack profile

A profile ID must be unique and is issued by the alliance Proprietary profiles can be defined by the customer

limits application interoperability to devices that share th is profi le. Does not exclude network level interoperability

Status of All iance Profiles (10/2008)

Home Automation (HA)

Released for ZigBee and ZigBee PRO

Smart Energy (SE)

Formerly Advanced Metering Infrastructure (AMI)

Released for ZigBee PRO

Commercial Building Automation (CBA)

Under development

Adopted as standard for wire less BACnet

Personal Health and Hospital Care (PHHC)

Under development Clusters ...

Light

Switch

Thermostat

Blind

Pump

Sensor

31

8 - 16 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 19: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Clusters

Clusters

Clusters

Values sent or received over the network are called Clusters (data types)

The cluster library contains a complete list of these data types. For HA, see zcl_ha.h

Endpoint applications send messages to other Endpoint applications using clusters

Switch

Light

ClusterList

ClusterList

ZCL_HA_CLUSTER_ID_GEN_ON_OFF

ZCL_HA_CLUSTER_ID_GEN_ON_OFFZCL_HA_CLUSTER_ID_GEN_LEVEL_CONTROL

Endpoints ...32

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 17

Page 20: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Endpoints

Endpoints

Endpoints

An Endpoint is the address of your application

0 is the ZDO application address

Up to 240 additional applications can be supported on a device

Each endpoint is identified by its own descriptor structures

This device contain two endpoints (in addition to the ZDO)

Each endpoint contains a switch application

Descriptors ...

PHY

OSAL

HAL /I/O

ZigBee Stack

TI-MAC

1ZDO

240

33

8 - 18 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 21: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Descriptors

Descriptors

Descriptors

Simple

Endpoint

Node Power

Node

Populated in your application initialization code

Must be registered with the Application Framework

See AF.h for definitions of these structures

Simple and Endpoint descriptors provide information about the endpoint applications

Power and Node descriptors provide information about the device

Simple descriptor ...34

Simple Descriptor

One per Endpoint

Endpoint number (1 – 240)

Profile ID from Alliance

Device ID from Alliance

Version

typedef struct

{

byte EndPoint;

byte AppProfId;

byte AppDeviceId;

int AppDevVer:4;

int Reserved:4;

byte AppNumInClusters;

cId_t *pAppInClusterList;

byte AppNumOutClusters;

cId_t *pAppOutClusterList;

} SimpleDescriptionFormat_t;

Endpoint descriptor ...

Number of input clusters

Pointer to input cluster list

Number of output clusters

Pointer to output cluster list

35

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 19

Page 22: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Descriptors

Endpoint descriptor

One per Endpoint

Endpoint number (1 – 240) OSAL application task ID

Pointer to simple descriptor

0

typedef struct{ byte endPoint;byte *task_id;

SimpleDescriptionFormat_t *simpleDesc;afNetworkLatencyReq_t latencyReq;

} endPointDesc_t;

afRegister( endPointDesc_t *epDesc )

Power descriptor ...

Each Endpoint must be registered with the application framework (AF):

36

Node Power Descriptor

One per device

PowerMode

Receiver always on, periodically on or externally activated

PowerSources

Constant (Mains)

Rechargeable batteries

Disposable batteries

CurrentLevel

Critical, 33%, 66%, 100%

typedef struct{

unsigned int PowerMode:4;unsigned int AvailablePowerSources:4;unsigned int CurrentPowerSource:4;unsigned int CurrentPowerSourceLevel:4;

} NodePowerDescriptorFormat_t;

Node descriptor ...37

8 - 20 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 23: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Descriptors

Node Descriptor

One per device

Coordinator, Router or End Device

typedef struct{uint8 LogicalType:3;uint8 ComplexDescAvail:1;uint8 UserDescAvail:1;uint8 Reserved:3;uint8 APSFlags:3;uint8 FrequencyBand:5;byte CapabilityFlags;uint8 ManufacturerCode[2];uint8 MaxBufferSize;uint8 MaxInTransferSize[2];uint16 ServerMask;

uint8 MaxOutTransferSize[2];uint8 DescriptorCapability;} NodeDescriptorFormat_t;

Architecture ...

Band: 868MHz, 902MHz or 2.4GHz

Max single packet size

Network Manager, Primary/Backup Trust center, binding table, or discovery table

38

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 21

Page 24: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Architecture

Architecture

ZigBee Device Architecture

Physical HW

OSAL

HAL/I/O

ZigBee Stack

MAC

Endpoint app 1

Userapp

Endpoint app 0

ZDO

Endpoint app 240

Userapp

Application Framework …

Application Framework

39

8 - 22 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 25: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Application Framework and Send/Receive Data

Application Framework and Send/Receive Data

Application Framework (AF)

Address structure

Send data function

Receive data structure

Receive data callback

The AF provides applications with structures and functions to:

Manage endpoints

Send and receive data

Send/Receive Structuresand Functions

Address Structure ...

Endpoint app 1

Userapp

Endpoint app 0

ZDO

Endpoint app 240

Userapp

Application Framework

40

Address Structure

Addr16Bit: Unicast

AddrNotPresent: Indirect – destination address found in binding table

AddrBroadcast: Broadcast to all devices, non-sleeping devices or routers/coordinator only

AddrGroup: Devices can assign themselves to groups addressable here

typedef struct{

union{

uint16 shortAddr;

ZLongAddr_t extAddr;

} addr;

afAddrMode_t addrMode;

byte endPoint;

} afAddrType_t;

Unicast to 16-bit short or

64-bit extended destination address

Mode Parameter

Address Structure

Send data interface ...

Addressing mode

Endpoint number

41

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 23

Page 26: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Application Framework and Send/Receive Data

Send Data Function

afStatus_t AF_DataRequest(

afAddrType_t *dstAddr,

endPointDesc_t *srcEP,

uint16 cID,

uint16 len,

uint8 *buf,

uint8 *transID,

uint8 options,

uint8 radius );

Pointer to address structure

Endpoint descriptor of sending endpoint

Cluster ID for this message

Message length in bytes

Pointer to message data

Transaction sequence number

Transmit options (i.e. ack request)

Max propagation radius in hops

Return parametersdefined in ZComDef.h

afStatus_SUCCESS

afStatus_FAILED

afStatus_MEM_FAIL

afStatus_INVALID_PARAMETER

Receive data interface ...42

Receiving Data

void GenericApp_MessageMSGCB( afIncomingMSGPacket_t *pkt ){ switch ( pkt->clusterId ){ case GENERICAPP_CLUSTERID:

#if defined( LCD_SUPPORTED )HalLcdWriteScreen( (char*)pkt->cmd.Data, "rcvd" );

#endifbreak;

}}

typedef struct{osal_event_hdr_t hdr;uint16 groupId;uint16 clusterId;afAddrType_t srcAddr;byte endPoint;byte wasBroadcast;byte LinkQuality;byte SecurityUse;uint32 timestamp;afMSGCommandFormat_t cmd;

} afIncomingMSGPacket_t;

Received Data Structures

Visualizing Acknowledgments ...

afRegister( &GenericApp_epDesc );

1. After you register the Endpoint with the AF:

you can receive incoming OTA message callbacks at that Endpoint

case AF_INCOMING_MSG_CMD:GenericApp_MessageMSGCB( MSGpkt );break;

2. Your Task event handler is triggered bythe SYS_EVENT_MSG event:

3. Now your message callback routine can processand act on the message:

typedef struct{byte TransSeqNumber;uint16 DataLength;byte *Data;

} afMSGCommandFormat_t;

43

8 - 24 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 27: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Visualizing Acknowledgements

Visualizing Acknowledgements

Acknowledgments

Switch

Network

MAC

Network

MAC

Light

Network

MAC

End Device RouterCoord

MAC-level acknowledgements & retries are default and automatic regardless of service used. Destination app is unaware and uninvolved

Specifying ACK generates an ACK by the destination AF task

If you are using application level acknowledgments, AF_DATA_CONFIRM will notify you of the complete transmissions' success/failure

If you are not using application level acknowledgments,AF_DATA_CONFIRM will notify the app of the first hops’ success/failure

MAC Ack MAC Ack

App MsgApp Msg

MAC AckMAC Ack

App Ack App Ack

52

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 25

Page 28: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Digging Further into the Stack

Digging Further into the Stack

Digging Further Into the ZigBee Stack

Binding Binding table

Automatic binding

Assisted binding

Centralized binding

Application binding

Z-Tool

Z-Tool scripting

A binding example ...64

A Simple Network

The light switch device has 2 endpoints

The lamp device has 4 endpoints

Binding can be one to one, one to many or many to many

Radio1 2 3 4

Lamps

LightSwitchDevice

Lamp Device

Binding ...65

8 - 26 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 29: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Binding

Binding

Binding Applications bind with other applications Simple and Endpoint descriptors (covered later) are used to

determine who can talk to who IN clusters and OUT clusters must have the same profile ID and be

compatible Documented in Z-Stack API Guide and in Z-Stack Developer’s Guide

There are 4 types of binding:

Automatic

Assisted

Centralized

ApplicationBinding Table ...

66

Binding Table Defined in RAM, but can be saved in Flash if the NV_RESTORE

compiler option is used

Stored on source node (REFLECTOR compiler option required)

Entries map messages to their intended destination

Each entry in the binding table contains the following:

typedef struct

{

uint16 srcIdx; // Source index

uint8 srcEP; // Source endpoint

uint8 dstGroupMode; // Specifies normal or group addressing

uint16 dstIdx; // Destination index or group address

uint8 dstEP; // Destination endpoint

uint8 numClusterIds; // Number of cluster IDs in the clusterIdList below

uint16 clusterIdList[MAX_BINDING_CLUSTER_IDS];

} BindingEntry_t;

Automatic Binding ...67

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 27

Page 30: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Binding

Automatic Binding

I’m ZCL_HA_CLUSTER_ID_GEN_ON_OFF (OUT)

Sending device broadcasts a “personal ad” on the network with:

Address, Profile ID, Cluster Lists

Match Description Request - ZDP_MatchDescReq()

Compatible devices respond

Response handled and validated by the ZDO

Sender application stores binding record in binding table

Sometimes called “Service discovery”, “AutoFind” or “AutoMatch”

Assisted Binding ...

I’m ZCL_HA_CLUSTER_ID_GEN_ON_OFF (IN)!Let’s talk!

68

Assisted Binding

That’s me!Me too! I’ll store the record!

I need this switch and that light to bind

External device initiated binding (“external” meaning not a participant of the resultant binding)

External device application calls ZDP_BindReq() with 2 applications (addresses and endpoints) and the cluster ID to bind. The first parameter is where the binding record will be stored

Make sure you have REFLECTOR compile flag enabled

Centralized Binding ...69

8 - 28 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 31: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Binding

Centralized BindingI’m ZCL_HA_CLUSTER_ID_GEN_ON_OFF (IN)

I’m ZCL_HA_CLUSTER_ID_GEN_ON_OFF (OUT)

You guys should talk to each other

Application initiates ZDP_EndDeviceBindReq() (i.e. via button press)with 2 applications (addresses and endpoints) and the cluster ID to bind. The first parameter is where the binding record will be stored (sender)

Coordinator receives and holds the request until a request from another node is received (10 seconds is the default)

Profile IDs must match, clusters must be compatible Make the REFLECTOR compile flag enabled Known as “source binding” in ZigBee 2007

Application Binding …

I’ll store the record

70

Application Binding Applications can manage the binding table itself, adding

and removing entries

Which binding method should you use?

bindAddEntry() – Add entry to binding table

bindRemoveEntry() – Remove entry from binding table

bindRemoveClusterIdFromList() – Remove a cluster ID from an existing binding table entry

bindAddClusterIdToList() – Add a cluster ID to an existing binding table entry

bindRemoveDev() – Remove all entries with an address reference

bindRemoveSrcDev() – Remove all entries with a referenced source address

bindUpdateAddr () – Update entries to another address

bindFindExisting () – Find a binding table entry

bindIsClusterIDinList() – Check for an existing cluster ID in a table entry

bindNumBoundTo() – Number of entries with the same address (source or destination)

bindNumOfEntries() – Number of table entries

bindCapacity() – Maximum entries allowed

BindWriteNV() – Update table in NV

71

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 29

Page 32: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Binding

Which Binding Method To Use?

Z-Tool ...

Au

tom

atic

Ass

iste

dC

entr

aliz

ed

+ no user interaction required+ no tool cost

- development time knowledge- non-configurable

+ install-time decisions (site-specific knowledge)+ analysis, maintenance, modification, visualization

can be under installers control

- cost of tool

+ allows user to decide+ cost of tool minimal

- few, if any, configurable parameters- requires a user interface on each device

Ap

p + maximum flexibility

- you must write all the code

72

8 - 30 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 33: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Digging still further into the ZigBee Stack

Digging still further into the ZigBee Stack

Digging Still Further Into the ZigBee Stack

ZDO APIs

Network Startup

Autostart / Start modes

Registering for ZDO Callback

Mobility

ZDO ...80

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 31

Page 34: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZDO

ZDO

ZDO APIs

Network startup ...

ZDO APIs provide application level control and monitoring of thefollowing services through the ZigBee Device Profile (ZDP):

Device and Service Discovery

Ability to discover services offered by other network devices

End Device Bind, Bind and Unbind Service

Creation and deletion of binding table entries mapping messages to their destination

Network Management Service

Allows user or commissioning tools to manage the network

Device Network Startup

ZDApp_Init() in ZDApp.c provides network startup by default

Your application can override this behavior by including the HOLD_AUTO_START compile option (NV_RESTORE also recommended)

81

ZDO Network Startupvoid ZDApp_Init( uint8 task_id )

{

ZDAppTaskID = task_id;

ZDAppNwkAddr.addrMode = Addr16Bit;

ZDAppNwkAddr.addr.shortAddr = INVALID_NODE_ADDR;

(void)NLME _GetExtAddr();

ZDAppCheckForHoldKey(); / / Check for manual "Hold Auto S tart"

ZDO_Init();

afRegister( (endPointDesc_t *)&ZDApp_epDesc );

#if defined( ZDO_USERDESC_RESPONSE )

ZDApp_InitUserDesc();

#endif // ZDO_USERDESC_RESPONSE

/ / Start the device?

i f ( devState != DEV_HOLD )

{ ZDO Ini tDevice( 0 );

} else

{ HalLedBlink ( HAL_LED_4, 0, 50, 500 );

} ZDApp_RegisterCBs();

} /* ZDApp_Init() */ZDO Status ...

This is the default network start code (minus some comments)

Inits network

Registers endpoint

Inits device (NV_RESTORE optional)

Registers for ZDO callbacks based on compiler options set anddevice type (C/R/ED)

82

8 - 32 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 35: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZDO

typedef enum

{

DEV_HOLD, // Initialized - not started automatically

DEV_INIT, // Initialized - not connected to anything

DEV_NWK_DISC, // Discovering PAN's to join

DEV_NWK_JOINING, // Joining a PAN

DEV_NWK_REJOIN, // Rejoining a PAN, only for end devices

DEV_END_DEVICE_UNAUTH, // Joined but not yet authenticated by trust center

DEV_END_DEVICE, // Started as device after authentication

DEV_ROUTER, // Device joined, authenticated and is a router

DEV_COORD_STARTING, // Started as Zigbee Coordinator

DEV_ZB_COORD, // Started as Zigbee Coordinator

DEV_NWK_ORPHAN // Device has lost information about its parent..

} devStates_t;

ZDO Status IndicatordevState provides the user app with the ZDO status:

Registering for ZDO callback ...83

Registering for a ZDO Callback

You can register for ZDO over-the-air (OTA) message (request or receive) callbacks

These messages would normally be transparent to your application

ZDO_RegisterForZDOMsg()

Message is sent to the application as an OSAL message (ZDO_CB_MSG)

zdoIncomingMsg_t contains the OTA message body

Mobility …84

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 33

Page 36: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZDO

Configuration

Configure the Channel in f8wConfig.cfg

and the PAN ID ...

Multiple channelsmay be selected

27

Configuring PAN ID in f8wConfig.cfg

Lab time ...

If PAN_ID = 0xFFFF and device = Coordinator:Device uses IEEE address to choose a PAN_ID (last 2 bytes)

If PAN_ID = 0xFFFF and device = Router or End DeviceDevice will join any available PAN

If PAN_ID ? 0xFFFF and device = CoordinatorDevice will use the set value for the PAN_ID

If PAN_ID ? 0xFFFF and device = Router or End DeviceDevice will ONLY join a PAN that has this PAN_ID

28

8 - 34 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 37: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Z-Tool

Z-Tool

Z-Tool

A PC application for sending and receiving commands to/from programs on the target board using the RS-232 port (transceiver required)

Requires MT_TASK Compiler option

Sending commands ...

RS-232

FETEmulatorUSB

EmulatorPort

RS-232X CVR

SmartRF05EB

UART

MS P430

CCMSP

CC2520EM

CC2520

73

Sending Commands from Z-Tool

Receiving commands in app ...74

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 35

Page 38: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Z-Tool

Receiving Commands In Applicationbyte MTProcessApp Msg( b yte *pData, byte len )

{ b yte ret = ZFailure;

byte en dpoint ;

endPo in tDesc_t *epDesc;

mtSysApp Msg_t *msg;

// Get the endpoin t and skip past it .

endpoint = *pData++;

len --;

// Look up the endpo int

epDesc = afFindEndPointDesc( endpoint );if ( epDesc )

{ // Build and send the message to the APP

msg = (mtSysApp Msg_t *)osal_msg _allocate( sizeof ( mtSysApp Msg_t ) + len );

if ( msg )

{ msg->hd r.even t = MT_SYS_APP_MSG;

msg->endpoint = en dpoint;

msg->appDataLen = len ;

msg->appData = (uint8*)(msg +1) ;

osal_memcpy( msg->appData, pData, len );

osal_msg_send ( *(epDesc->task_id), (u in t8 *)msg );

ret = ZSuccess;

} } retu rn ret;

}

Message handler takes the incoming MT message and constructs an OSAL message for the application

Handler code is automatically included when enabled

Sending messages from app ...75

Sending Messages From Application

Use debug_str to send a null-terminated string from within app

Include Debugtool.h to your project

Values can be converted for display using _ltoa() [defined in osal.c] Converts a long value to ascii Declare: unsigned char buf[8];

#if defined( BN_DISPLAY_TEST ) && defined( MT_TASK )_ltoa((unsigned long) ValueToConvert, &buf[0], 10);

debug_str( buf );

#if defined( BN_DISPLAY_TEST ) && defined( MT_TASK )debug_str( "Not Sorted" );

Receiving in Z-Tool ...76

8 - 36 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 39: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Z-Tool

Receiving Messages in Z-Tool

Z-Tool automatically formats and displays incoming andoutgoing messages

Z-stack is instrumented to automatically provide system status at startup (when enabled)

Scripting ...77

Z-Tool Scripting Provides automated testing support

JScript based script compiled by Z-Tool

See Z-Tool Help filefunction MessageHandler(zportName:S tring, id:MES SAG E_ID, msg:Object)

{

switch(currentState)

{

case TEST_S TATE.STATE1:

{

/ / set state to STATE 2

cur rentState = TEST_S TATE.STATE 2;

/ / send SY S_LED_CONTROL command to Device2

var req : S YS_LED_CONTROL = new SYS _LED_CONTROL();

req.LedID = SY S_LED_CONTROL.LED_NUM.LE D_1;

req.Mode = SYS_LED_CONTROL.LED_MODE.BLINK;

ZEngine.S end("Device2", req);

}

Lab time ...

Note: Code snippet only

Run Script fromScript browser inZ-Tool

78

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 37

Page 40: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Third Party Tools

Third Party Tools

Daintree Sensor Network AnalyzerZigBee can be a bit confusing when you’re getting started. The SNA shows the network in an easy-to-understand format with devices and interactions shown graphically, and ability to drill down for additional detail to provide a more complete picture of what is going on.

55

Keeping you up to date

The SNA stays up to date, not only with the latest ZigBee standards, but also with the latest functionality offered by TI.

For example, recent releases of the SNA support commissioning, binding, and TI-specific features including over-the-air firmware upgrades and locationing. The SNA provides full support for ZigBee 2006, 2007 and PRO.

56

8 - 38 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 41: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Third Party Tools

Complete and Compliant

Help to ensure your products pass ZigBee certification at the first attempt.

The Daintree SNA is used by the ZigBee test houses as the primary platform-independent means of visualizing, recording and verifying conformance to ZigBee specifications and test plans.

Your TI ZigBee development kit, including the SNA, provides everything you need for development, testing and field trials ofZigBee devices.

The Basic edition of the SNA comes standard with the TI kits, together with 30-day trial versions of the enhanced Standard and Professional editions. Find out more at www.daintree.net

Atalum ...57

Atalum Manage & Commission Suite

Graphical Representation of Multiple Networks

Network Summary at a Glance

Easy to use Windows tool for Commissioning Made 1-2-3

Reports & Statistics

Synch-up

58

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 39

Page 42: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Third Party Tools

Atalum enables companies to maximize a ZigBee infrastructure by minimizing maintenance & management costs.

A ZigBee infrastructure provides a standard wireless means to control AND monitor ANY thing in ANY place.

To realize the potential of a ZigBee infrastructure companies should have the means to remotely access & automate what’s going on in the network.

Plus, commissioning & on-going management must be at least as economical as existing systems.

Companies should also be able to integrate the information from ZigBee networks with existing systems and seamlessly interface the data across applications, locations & users.

Also, installers require a way to quickly commission ZigBee devices without any special expertise.

Regardless of the phase in the life-cycle Atalum’s GREENsuiteprovides the necessary functionality to deploy, manage and maintain a ZigBee network in a cost-effective and easy way.

Maximize a ZigBee Infrastructure

59

Atalum’s GREENsuite provides the tools required by installers, SIs & OEMs.

Atalum offers a Web network management application along with a Windows commissioning tool. Information can be synched between the two applications. APIs for integration with legacy or othersystems can also be used.

Atalum’s intuitive GUIs make it easy to deploy and maintain multiple hardware platforms.

GREENsuite allows companies to: Set-up Networks & Configure Sensors Register Devices Schedule Events Define Triggers & Alarms View Network Diagnostics & Performance Obtain Reports & Statistics (User Defined Queries or Default) Manage Users (Access & Privileges) Obtain System Logs (Summary or Detail) Export Information (Multiple Formats) Integrate with Legacy, Billing or Other Systems

Fully Loaded Application Suite

Developer network …60

8 - 40 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 43: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Third Party Tools

Low Power RF Developer Network

Go to www.ti.com/zigbee and click on:

Writing to the LCD ...

Modules

EngineeringServices

DevelopmentTools

61

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 41

Page 44: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Mobility

Mobility

Mobile End Devices

End devices are automatically mobile. No extra compile flags needed

An end device detects that a parent isn’t responding either through polling failures and/or through data message failures

MAX_POLL_FAILURE_RETRIES controls the number of consecutive failures. See f8wConfig.cfg (higher = less sensitive)

When a child network layer detects that its parent isn’t responding, it will initiate a rejoin by calling ZDO_SyncIndicationCB()

The rejoin process will first scan for an existing parent, then scan for a new parent and join that network

In a secure network, it’s assumed that the device already has a key and a new key isn’t issued

Let's do a lab ...85

8 - 42 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 45: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Mobility

Smart Energy

ZigBee Smart Energy

Why …88

Why Smart Energy?

Policies such as the Energy Policy Act of 2005 and California’s Title 24

Require utility companies to adopt “green” technologies

Promote awareness of energy conservation

Push standardization of wireless protocols such as ZigBee’s Smart Energy

Help establish National and International market acceptance

Drive trial deployments to prove feasibility early

What …89

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 43

Page 46: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Mobility

What is “Smart Energy”

Metering

Multiple commodities including electric, gas, water, and thermal

Real-time consumption / production information

Historical price information

Support for meter-as-gateway and meter-as-device on a ZigBee network

Demand Response and Load Control

Scheduling of multiple events

Built in support for customer override

Text Messaging

Security

Elliptic curve support via 3rd party library

Solution …90

TI’s Smart Energy Solution

TI / Chipcon has been driving the Alliance since inception TI has implemented the full Smart Energy Profile

Available free for download today

Supports SETestApp Sample Application Code Supports Elliptic Curve Cryptology (ECC) stubs

TI can deliver quality parts of significant volume in a timely manner

TI is well positioned in ZigBee, 6LoWPAN, or wherever the Metering market takes us

TI supports Over the Air Download for remote firmware upgrades

TI will release an SoC based complete Smart Energy solution for 2009

Security …91

8 - 44 Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack

Page 47: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Mobility

SE Security

Elliptic Curve Cryptology (ECC)

TI provides the code for hooking Certicom’s ECC solution into our stack. We do not provide hooks for any other ECC solution

TI does NOT provide the ECC code itself

Certicom charges customers for their development kit and does not provide ECC for free. Please check with Certicomfor pricing.

www.Certicom.com

Demos …92

Low Power Wireless and ZigBee Networking Workshop - ZigBee Stack 8 - 45

Page 48: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

ZigBee Security

Introduction Whether you’re a homeowner or a manager of a mission critical automatic industrial production line, security is an issue that you should be concerned about. Tech savvy burglars can use the unsecured transmission from your garage door remote to easily enter your home. Saboteurs can cripple a production line by targeting an unsecured wireless control system. Security is an issue for every wireless system.

Objectives Security modes

Cryptographic key, transport, establishment

Joining a secure network

Low Power RF Solutionsp - ZigBee Security 10 - 1

Page 49: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Module Topics

Module Topics

ZigBee Security.........................................................................................................................................10-1

Module Topics........................................................................................................................................10-2 Security and Modes ...........................................................................................................................10-3

Frames with Security .............................................................................................................................10-4

Trust Center ...........................................................................................................................................10-5

Cryptographic Keys ...............................................................................................................................10-6

Joining a Secure Network ......................................................................................................................10-7

Features .................................................................................................................................................10-9

10 - 2 Low Power RF Solutions - ZigBee Security

Page 50: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Module Topics

Security and Modes

802.15.4 Security

Defined security services include:

Access Control Communications based on received frame address

Data Encryption Frames can be encrypted with a symmetric key

Frame Integrity Prevents messages from being altered in transit

Sequential Freshness Counters prevent replay attacks

22Security Modes ...

Security Modes

Unsecured Messages are sent in

the clear

Access Control List Only listed senders will

be communicated with

Secured Mode

YES(16)ONENC-MIC-32

YES(8)ONENC-MIC-64

YES (4)ONENC-MIC-32

NOONENC

YES(16)OFFMIC-128

YES(8)OFFMIC-64

YES (4)OFFMIC-32

NOOFFnone

Frame Integrity(length of MIC in bytes)

Data Encryption

Security Attributes

MIC=Message Integrity Code

ENC=AES Encryption (CCM – Combined encryption and authentication block Cipher Mode)

33Frames ...

Low Power RF Solutions - ZigBee Security 10 - 3

Page 51: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Frames with Security

Frames with Security

IEEE 802.15.4 Frames with Security

Preamble PHYHDR

MACHDR

AUXHDR Encrypted App Payload MIC

Security adds Auxiliary Header and Message Integrity Code (MIC)

Data in front of the MIC is integrity protected

27 byte overhead (Depending on security Level selected)

Security Enabled Frame Control Field – Bit Field

FCS

Frame Type SecurityEnable Sequence

Src Addr

Mode

Frame Control Field - FCF

44Trust Center ...

10 - 4 Low Power RF Solutions - ZigBee Security

Page 52: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Trust Center

Trust Center

Trust Center

Coordinator

Router

End Device

Coordinator is assumed to be the Trust Center (TC) and provides: Cryptographic key establishment

Key transport

Frame protection

Device management

Two security modes Standard – TC maintains a standard

network key and controls network admittance. Memory required does not scale with network size (ex: Residential)

High – TC maintains a list of devices and keys. It provides network key updates. Memory required scales with network size.(ex: Commercial)

55Keys ...

Low Power RF Solutions - ZigBee Security 10 - 5

Page 53: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Cryptographic Keys

Cryptographic Keys

Cryptographic Keys

Master – Basis for long term security Used for symmetric key establishment (1,3)

Link – Shared exclusively between two network peers for Unicast communication (1,2,3)

Network - Used for broadcast communication security (1,3)Alternate Network key employed for key rotation

Keys are obtained by:

1. Key-transport (key is sent from one device to another)

2. Key-establishment (key is derived locally)

3. Pre-installation (during programming)

66Joining a Secure Network ...

10 - 6 Low Power RF Solutions - ZigBee Security

Page 54: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Joining a Secure Network

Joining a Secure Network

Joining a Secure Network

Coordinator

Router

End Device

Keys need to be set with new devices that join the network

NewDevice

Secure Network

77

Joining a Secure Network

Coordinator

Router

End Device

Keys need to be set with new devices that join the network

Over the air key setup is unsecured and vulnerable to a one time eavesdropper attack

NewDevice

Secure Network

88

Low Power RF Solutions - ZigBee Security 10 - 7

Page 55: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Joining a Secure Network

Joining a Secure Network

Coordinator

Router

End Device

Keys need to be set with new devices that join the network Over the air key setup is unsecured and vulnerable to a one

time eavesdropper attack After joining, device may need to store multiple keys Solutions: out of band programming

controlled joiningdevice deactivation

Secure Network

Security features ...99

10 - 8 Low Power RF Solutions - ZigBee Security

Page 56: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Features

Features

Security Features

Freshness Prevents replay attacks

Incoming/Outgoing freshness counters

Message Integrity Message cannot be modified in transit

0, 32, 64 or 128-bit integrity

Authentication Assurance of Originator

Access Control

Confidentiality Prevents eavesdropping – 128-bit AES encryption

Can be turned off without affecting freshness, integrity or authentication

1010Lab time ...

Low Power RF Solutions - ZigBee Security 10 - 9

Page 57: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Manufacturing Issues

Introduction You need to be aware of the various problems that can arise as you move towards production. This module presents some of the most important issues.

Objectives ZigBee Alliance Issues

IEEE Numbers

Production Programming

Low Power RF Solutionsp - Manufacturing Issues 11 - 1

Page 58: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Module Topics

Module Topics

Manufacturing Issues...............................................................................................................................11-1

Module Topics........................................................................................................................................11-2 ZigBee Alliance.................................................................................................................................11-3

Membership ...........................................................................................................................................11-4

Certification and Compliance................................................................................................................11-5

Private Profiles ......................................................................................................................................11-7

IEEE Addresses......................................................................................................................................11-8

Production Programming ......................................................................................................................11-9

11 - 2 Low Power RF Solutions - Manufacturing Issues

Page 59: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Module Topics

ZigBee Alliance

The ZigBee Alliance

What is the ZigBee Alliance?

The ZigBee Alliance is an association of companies working together to enable reliable, cost-effective, low-power, wirelessly networked, monitoring and control products based on an open global standard.

Joining the ZigBee Alliance

There are three levels of membership in the ZigBee Alliance withdifferent entitlements:

Adopter ($3,500USD/year): Offers access to final, approved specifications, use of the ZigBee Alliance logo, participation in interoperability events, and access to application Profile Task Group documents and activities.

Participant ($9,500USD/year):Offers full participation in ZigBee Alliance working groups and member meetings, ability to earn voting rights in work groups, and early access to ZigBee Alliance specification.

Promoter: ($50,000USD/year) Offers automatic voting rights in all working groups, final approval rights on all specifications, and a seat on the Alliance Board of Directors

Member benefits ...3

Low Power RF Solutions - Manufacturing Issues 11 - 3

Page 60: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Membership

Membership

ZigBee Membership Benefits

As a ZigBee Alliance member, you can:

Use ZigBee Alliance intellectual property for commercial gain, royalty free.

Leverage the global marketing efforts promoting the use of ZigBee technology.

Depending on the membership level selected, you can participate in member meetings, committees, and working groups that shape the future of ZigBee technology

www.zigbee.org

What are certified products?4

ZigBee Alliance Membership

NoSub-contractor to ZigBee member companyNoInterior DesignerNoArchitectNoInstallerNoRetailer

NoHomeowner

NoCompanies using ZigBee certified products designed by others

NoCompanies offering services and reselling ZigBee products

YesCompanies creating/designing products for sale using the ZigBee Alliance specification

ZigBee Membership Required?

Organization Scenario

Under current ZigBee Alliance rules, the company is only required to be a member in the year the product is initially created. However, if you update/modify/etc. your product in later years you must be a member during that year as well.

6Certification process ...

11 - 4 Low Power RF Solutions - Manufacturing Issues

Page 61: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Certification and Compliance

Certification and Compliance

What are ZigBee Certified Products?

The ZigBee Alliance promotes the development of products that are fully compliant with the ZigBee standard. Through certification testing, you can ensure your products successfully co-exist or interoperate with other ZigBee Certified Products. ZigBee products are certified with either a Manufacturer Specific Application Profile or a Public Application Profile.

A Manufacturer Specific Application Profile is an application developed by a member.

A Public Application Profile is developed by the Alliance and is available to all members (HA or SE at this time).

Both Manufacturer Specific Application Profiles and Public Application Profiles must be implemented on ZigBee Compliant Platforms.

Note that ZigBee compliance testing does not include ETSI/FCC/ARIB testing. There are a number of test houses in this business.

Membership ...5

ZigBee Certification Process

1. Join the ZigBee Alliance

2. Apply for certification

3. Submit product(s) to test provider

4. Test provider notifies Alliance of success

5. Member company provides declaration of conformity

6. Alliance conformation of membership, review, audit and approval

7. Notification & publication of certification

8. Certification Logo

Compliance and certification ...7

Low Power RF Solutions - Manufacturing Issues 11 - 5

Page 62: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Certification and Compliance

Compliance and Certification ZigBee Qualification Group (ZQG) is responsible for:

Establish an independent test house program

Select test houses

– National Technical Systems of Culver City, California

– TÜV Rheinland of North America of Pleasanton, California

ZigFest

Informal multi-vendor interoperability testing

Proving ground for new designs

An invaluable pre-certification testing opportunity

Your profile ...

New public profiles in the works:

CBA Commercial Building Automation(completed/ratified/NOT tested)

PHHC Personal Health & Hospital Care (in study)

8

11 - 6 Low Power RF Solutions - Manufacturing Issues

Page 63: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Private Profiles

Private Profiles

Your Own Profile

You can maintain ZigBee compliance without allowing others access to your network via a Manufacturer Specific Application Profile

Hundreds of Manufacturer Specific Application Profiles are already registered

Public profiles, like the Home Automation Profile and Smart Energy allow interoperability between products

Proprietary profiles are intended to limit interoperability at the application level, but can also limit network interoperability

Profile IDs are distributed by the Alliance to members. You must request a profile ID for your proprietary profile

IEEE addresses ...9

Low Power RF Solutions - Manufacturing Issues 11 - 7

Page 64: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

IEEE Addresses

IEEE Addresses

IEEE Addresses

IEEE registers Organizationally Unique Identifiers (OUI) world-wide. A subset of these addresses is called Individual Address Block (IAB).

OUI costs$1650 for 2^40 addresses

IAB costs $550 for 2^12 addresses

http://standards.ieee.org/regauth/index.html

Production Programming ...

Note: An OUI allocates enough IEEE numbers to place 2 devices on every square meter of land and sea on Earth.

10

11 - 8 Low Power RF Solutions - Manufacturing Issues

Page 65: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Production Programming

Production Programming

Production Programming

Use development tools for programming

Elprotronic www.elprotronic.com

E-Lab www.e-lab.de

BP micro www.bpmicro.com

Elnec www.elnec.com

11

Production Board Layout

CC2520

14 pin JTAG emulation port

Add traces and pads for 14-pin emulation port to production board

Add traces and pads for UART connection to Z-Tool (external transceiver may be needed)

Populate with DIP pins header for emulation and test

Production board

MSP430

UART port

12

Low Power RF Solutions - Manufacturing Issues 11 - 9

Page 66: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Production Programming

USB Flash Programming Adapter (FPA) with programmable Vdd2.2 to 3.6 V, Idd up to 100 mA.

Supplied GUI software and Multi-FPA API-DLL.

IEEE Address and Serial Number assignment with GUI software.

Six devices programmed simultaneously from one Gang FPA.

Up to 8 USB-FPA can be controlled via Multi-FPA API-DLL that allows to program simultaneously up to 48 devices, e.g. to program one panel with up to 48 boards on the panel.

GangPro-CC and FlashPro-CCUSB Flash Programmers

Six CC2431F128 can be erased, blank checked, programmed and verified in 12 seconds.

Lock setup capability useful in production.

Custom defined programming sequence (from the script file).

13

GangPro-CC GUICode formats:

TI hex (txt)

Intel (hex)

Motorola (s19, s28, s37)

IEEE Address and Serialization

Auto incremented

From the custom defined file

IEEE Address

Serialization14

11 - 10 Low Power RF Solutions - Manufacturing Issues

Page 67: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Production Programming

GangPro-CC Multi-FPA API-DLL

Application Software (C++, LabVIEW etc.)

API-DLL API-DLL API-DLL

FPA-1 FPA-2 FPA-8

Device-1Device-1

Device-1Device-1

Device-1Device-6

Device-1Device-1

Device-1Device-1

Device-1Device-12

Device-1Device-1

Device-1Device-1

Device-1Device-48

Multi-FPA DLL Selector and Task Manager

USB-1 USB-2 USB-8

Mu

lti-

FP

A A

PI-

DL

L

Simultaneous process

15

Contronix Programmers

16

Low Power RF Solutions - Manufacturing Issues 11 - 11

Page 68: ZigBee Workshop (Nov 2009 - Special Release)processors.wiki.ti.com/images/e/e7/ZigBeeWorkshop_v2_Part2.pdf · ZigBee Workshop (Nov 2009 - Special Release) Student Guide ... ZigBee

Production Programming

Contronix

17

11 - 12 Low Power RF Solutions - Manufacturing Issues