Zigbee Foundamental
Device Type
- Coordinator
- first device in network
- scan RF env, choose a channel and a network identifier (PAN ID), then start network
- also optionally to be used to assist in setting up security and application-level bindings
- once start-up accomplished, Coordinator behaves like a Router node(or even go away)
- Router
- allow other devices to join the network
- multi-hop routing
- assisting in communication for its childs
- general expected to be active all the time, have to be mains-powered
- End-device
- can sleep and wake up as chooses, battery-powered node
- memory(RAM) requirements are lower
- in Z-Stack, device type is usually determined at compile-time with compile options (ZDO-COORDINATOR and RTR_NWK)
Stack Profile
- set of stack parameters that need to be configured to specific value. comprise the stack profile defiend by ZigBee Alliance
- All devices in a network must conform to the same stack profile
- 3 types
- ZigBee
- defined by ZigBee Alliance
- ZigBee Pro
- defined by ZigBee Alliance
- network-specific profile
- self defiend, closed network
- ZigBee and ZigBee Pro profile device can not interoperate.
- ZigBee
- ID: 0 for network specified profile; 1 for ZigBee; 2 for ZigBee Pro.
- configured by STACK_PROFILE_ID in nwk_globals.h
- Normally, a device of 1 profile (ex. ZigBee PRO) joins a network with the same profile. If a router of 1 profile (ex. ZigBee PRO) joins a network with a different profile (ex. ZigBee-2007), it will join as a non-sleeping end device. An end device of 1 profile (ex. ZigBee PRO) will always be an end device in a network with a different profile. (这一段不是太看得懂)
Addressing
- 2 types:
- 64 bits IEEE(MAC address or Extended Address)
- 16 bits network address(logical address or short address)
- used on local network
Tree Addressing
- uses a distributed addressing scheme: make sure unique; only has to communicate with its parent
- defines: ZIgBee-2007 its(5, 20, 6)
- MAX_DEPTH: max depth of network. coordinator=0,
- MAX_CHILDREN;
- MAX_ROUTERS: a subset of MAX_CHILDREN,
- (MAX_CHILDREN-MAX_ROUTERS)= end devices
- change tree addressing
- ensure new value legal
- ensure to use network-specific profile (change STACK_PROFILE_ID in nwk_globals.c to NETWORK_SPECIFIC), set MAX_DEPTH in nwk_global.s
- set array’s CskipChldrn and CskipRtrs in nwk_globals.c
Stochastic(Random) Addressing – ZigBee PRO
- random set a value, uses rest devices to unsure no duplicate
- joins process
- receives randomly addr from parent
- the new network node generates “Device Announce” (contains short and extended addr) to others
- if short addr confilct, a node(router) send out a broadcast “Network-Status - Address Conflict” to entire network
- conflicted device change its short addr, then send its own “Device Announce” to check again
- End device not participate “address conflict”, its parents do it for them
- parent issue “Rejoin Response” to end device to change end devices short addr.
- end device issues “Device Announce” to check new addr
- “Device Announce” recieved, association and binding tables updates, routing table info not updated(new router must be established).
Addressing in Z-stack
- AF_DataRequest() to send data to device. dest device is a type afAddrType_t(in zComDef.h)
- defines in Z-Stack Developer’s Guide Sec 3.3 P10
- send type
- unicast: use Addr16Bit, dest addr is in packet
- Indirect: use AddrNotPresent, dest addr is not specified. dest addr is looked up from “binding table”(in stack of sending device): its called Souce binding
- when binding table looking up, it treated as a unicast packet.
- Broadcast: use AddrBroadcast, dest addr sets as:
- NWK_BROADCAST_SHORTADDR_DEVALL (0xFFFF) – to all devices(including sleeping one)
- sleeping one, hold in its parents until wake up or time out(NWK_INDIRECT_MSG_TIMEOUT in f8wConfig.cfg)
- NWK_BROADCAST_SHORTADDR_DEVRXON (0xFFFD) all devices when idle (RXONWHENIDLE). all devices except sleeping devices
- NWK_BROADCAST_SHORTADDR_DEVZCZR (0xFFFC). to all routers(includes coordinator)
- NWK_BROADCAST_SHORTADDR_DEVALL (0xFFFF) – to all devices(including sleeping one)
- Group Addressing
- send packet to a group of device: addr mode is afAddrGroup, addr.shortAddr=group identifier
- group defination: aps_AddGroup() in the Z-Stack API doc
- group used in conjunction with indirect addressing. dest in binding table can be unicast/group addr.
Addressing functions
- NLME_GetShortAddr()
- NLME_GetExtAddr()
- NLME_GetCoordShortAddr() : get its parents addr
- NLME_GetCoordExtAddr()