XbeeInfo
Network Overview
=============
Zigbee networks are identified by a 16bit PAN (personal area network) ID. A network is started by a coordinator. Coordinators are responsible for selecting a suitable frequency channel and PAN ID. Coordinators must route data between nodes in the network, so they can not be battery powered. Like coordinator, routers also route data across the network and must be mains powered. End point devices are battery powered and do not route data. End point devices are connected to a parent device(router or coordinator) to handle routing. All devices have a universally unique 64 bit ID. Devices on a PAN receive a 16 bit network address when connecting to a PAN. This network address is not stable, it may change if the end point device looses connectivity with its parent. The network address of the PAN coordinator is always 0
Coordinator Startup
==============
When a coordinator starts up it attmepts to create a new PAN. First different RF channels are scanned for quiet channels. Once a suitable RF channel is found, the coordinator transmits a beacon frame. Nearby coordinators or routers belonging to a different PAN responds with a beacon frame stating the PAN ID. Once a suitable RF channel and PAN ID are selected, the coordinator can then allow other devices to join the PAN.
A coordinator will retain the PAN ID and channel over power cycles and resets once it is set.
See manual page 28 for the specific AT commands for configuring an Xbee coordinator to select certain RF channels and PAN ID.
Packet Transmission
===============
To send a packet in a Zigbee network, it must be addressed. Packets can be addressed to a device using a 16 bit network address (or 64 bit UUID which will be resolved to 16 bit network address) or by application layer cluster IDs.
Broadcast Packets
Broadcast packets are propagated throughout the entire PAN. Eaching routing device retransmits the broadcast packet 3 times, caching a local copy to prevent endless transmits. This should be used sparingly as it affects every device in the PAN.
Unicast Packets
Packets can be sent to a specific device by the 64 bit ID. Zigbee will automatically perform the 64 bit UUID to 16 bit network address discovery process.
Routes between nodes are automatically discovered on demand.
Transmitted packets are automatically ACKed on both a hop-to-hop basis and an end-to-end basis. For the end-to-end case, if a transmitter fails to receive an ACK from the destination, it will retransmit the packet up to two additional times before discarding it. It is up to the endpoint devices to detect duplicate packets at the application layer.
XBee Firmware
===========
Both coordinators and routers/end devices support the following two types of firmware.
Transparent Mode
In transparent mode, the xbee works just like a serial line. Data input is buffered until a certain threshold is reached. It is then packetized and transmitted over RF. Serial AT commands are used to configure the internal Xbee parameters.
This mode will not be very useful for us.
API Mode
This mode is frame based. It allows the application running on the device to change Xbee parameters and create data payloads using frames. It also provides frames to the application in response to events (PAN association, reset, etc).
This is the mode all of our devices should be in.
Joining a PAN
===========
Routers and end point devices can be configured to join any PAN or a specific PAN ID. Once this parameter is set, it will be saved across reset and power cycles. The joining device sends a association request frame and receives an association response. The coordinator or router allowing the device on will automatically determine the 64 bit UUID to 16 bit network address mapping on association.
A coordinator/router can only support 8 child devices. If we want to support more than 8 wands, we will need to introduce routers into the PAN.
Leaving a PAN
===========
Devices will stay connected to a PAN over resets and powercycles. Only network parameter changes can cause a device to leave (security change, PAN ID change, loss of connectivity to parent, full list on page 31). AT command NR0 can force a device to disassociate from a network.
Sleeping
=======
End point devices can be configured to sleep. Data sent to the device will be buffered in the parent router or coordinator. When the device wakes up, it polls its parent, the parent responds with buffered data, and the end point device goes back to sleep.
Packets will be buffered on the parent until
- Parent runs out of buffer space
- Packet stored for a period of time (SP parameter)
- Child device polls for data
The type of sleep is controlled by the SM parameter.
Pin Sleep
Sleeping can be controlled by asserting sleep_RQ (pin 9). While asleep the xbee will not transmit nor receive data. To wake, deassert sleep_RQ. While awake the xbee will poll it’s parent for data every 100ms.
Cyclic Sleep
In cyclic sleep the xbee will start a timer on receipt of serial or RF data. While awake it will poll it’s parent for data every 100ms. If new data arrives, the timer restarts. If the timer expires (ST parameter), the module will go to sleep. The module will wake up and poll for data in a period defined by SP (see page 39). SP can be set up to 28seconds, since the parent will only buffer packets for up to 30seconds.
For reliability, SP should be set to the same value on both the parent and the end point device.

