Starting a Network
To create a ZigBee network, a coordinator must be started on a channel and PAN ID (64-bit and 16-bit). Once the coordinator has started, routers and end devices can join the network.
Some parameters explained in previously chapters as 'Extended PAN ID', 'Scan Channels' and 'Scan Duration' are used in network startup.
To select a correct channel and PAN ID, the coordinator performs an energy scan and PAN scan. 'Scan Channels' and 'Scan Duration' are used to determine the duration and the list of channels to scan. 'Extended PAN ID' is used to select an ID different from zero.
After completing the energy and PAN scans, the coordinator uses the results to select the channel with less energy and a PAN ID unused in other PAN. If security should be set at startup, please see chapter 13 "Synchronizing the Network".
After the coordinator has successfully started, it behaves similar to a router - it can allow devices to join the network, and it can transmit, route and receive data. The coordinator saves the selected channel and PAN ID settings into non-volatile memory so this information will persist through power cycles.
If a coordinator has successfully started a PAN and other coordinator is powered, there will be two PANs. It will perform the explained scans and will choose a channel and PAN ID to work on. A coordinator can't be part of a network if another coordinator already exists.
• Coordinator creates a network example:
Figure: Coordinator Startup
When a coordinator wakes up from a reset or power cycle, its checks its operating channel and PAN ID against 'Scan Channels' and 'Extended PAN ID' parameters. It also verifies the security policy. If some configuration parameters do not match the saved channel, PAN ID or security, it will leave the PAN and will start in other PAN matching the configuration parameters.
• Coordinator resets network example:
Figure: Coordinator Wake Up Process
There are some parameters involved in a starting a network process.
It specifies the time a Coordinator or Router allows a node to join the network. This value can be changed at run time without requiring a Coordinator or Router to restart. This time starts once the Coordinator or Router has waken up. The timer is reset on power-cycle or when 'Node Join Time' changes.
Example of use:
xbeeZB.setJoinTime(0xFF); // Set Join Time : always allows joining
xbeeZB.getJoinTime(); // Get Join Time
xbeeZB.joinTime→ stores the join time selected
It specifies the stack profile value. It must be the same in all devices that may join the network. Available values are:
- 0 : Network Specific
- 1 : ZigBee-2006
- 2 : ZigBee-Pro
Example of use:
xbeeZB.setStackProfile(2); // Set ZigBee stack profile to ZB 2007
xbeeZB.getStackProfile(); // Get ZigBee stack profile
xbeeZB.stackProfile→ stores the ZigBee stack profile