The XBee ZigBee firmware uses the same 802.15.4 RF protocol used in our other (non-ZigBee) firmware versions. Even though the base RF protocol is the same the addressing and message delivery systems are very different. The ZigBee firmware uses the ZigBee stack on top of the 802.15.4 RF protocol for mesh networking.
Broadcast & Unicast
Just like the 802.15.4 firmware, ZigBee has two forms of addressing Broadcast and Unicast. ZigBee has a much more robust form of Broadcast messaging than 802.15.4. Unicast messages, because of how mesh networking works, have whats called an Extended (64 bit) Address and a Network (16 bit) Address.
A Broadcast message is a message that is meant for all modules on any given PAN (Personal Area Network). In ZigBee, a Broadcast message is sent once and then repeated by the neighboring Coordinator/Router(s). Once a Broadcast message has been repeated a certain number of times it wont be repeated anymore. In other words, a broadcast message can only propagate so many hops before it will stop being re-broadcast.
Figure 1. How a Broadcast message propagates through a ZigBee network
Anytime a router receives a broadcast packet it does two things to determine if it must retransmit that packet. First it checks the source address of who sent the broadcast packet. Then it checks the sequence number of the packet, both of these pieces of information are contained in the Broadcast messages header. If these values dont match with an internal Broadcast Transaction Table that the router keeps it will retransmit the packet.
ZigBee does allow for a more robust Broadcast than 802.15.4. Broadcast messages use a passive acknowledgement scheme, no active acknowledgements are sent. A passive acknowledgement works like this: After sending a Broadcast message the module will wait and listen for its neighbors to rebroadcast the packet. If a neighbor doesnt retransmit the packet then the module will re-Broadcast the packet again.
The extra layers of redundancy and the simple nature of the mesh system can make sending a Broadcast message a lengthy process. Care should be taken not to send Broadcast messages in quick succession.
In order to send a Broadcast message set the DH=0x0 and the DL=0xFFFF. With these settings all XBee modules on a given PAN will get the message.
A Unicast message is a more reliable method for delivering data. A Unicast message is sent from one module to any other module based on the modules addressing. Once the appropriate module (with a matching address) has been found then the message propagates through the mesh network.
Figure 2. How a Unicast message propagates through a ZigBee network
Network & Extended Addressing
- R1 is transmitting data to R10.
- MAC level ACKs are transmitted between each hop.
- One Network ACK is sent from the Destination node back to the Source node.
- Network ACK, on its return trip, gets MAC level ACKs at each hop.
The Extended Address is a static 64 bit address that is assigned at MaxStream and is guaranteed to be unique. The Extended Address is sometimes not used in ZigBee (to save memory). With MaxStream the 64 bit address is always needed and is used to add robustness to the ZigBee standard.
The Network Address is a 16 bit address that is assigned by the Coordinator when a node is joined to a network. The 16 bit address must be unique for a given network in order for the node to be identified properly. The problem is that if a node were to drop out of the network (be shut off, go out of range etc.) it could lose its 16 bit address. That is why we maintain tables of the Network and Extended Addresses.
When a message is being sent the Extended Address is absolutely required while the Network Address is a convenience. Not knowing the Network Address will cause the modem to perform a Network Address Discovery, which may add latency time.