Digi International Inc XBEEPRO2 Manual Do Utilizador

Página de 155
XBee®/XBee‐PRO® ZB RF Modules 
© 2011 Digi International, Inc.
     41
6. Reading the AI command (association status) will return a value of 0, indicating a successful 
startup.
7. Reading the MY command (16-bit address) will return a value of 0, the ZigBee-defined 16-bit 
address of the coordinator.
After startup, the coordinator will allow joining based on its NJ value.
Example: Replacing a Coordinator (security disabled)
1. Read the OP, OI, CH, and ZS commands on the running coordinator.
2. Set the ID, SC, and ZS parameters on the new coordinator, followed by WR command to save 
these parameter values.
3. Turn off the running coordinator. 
4. Set the II parameter on the new coordinator to match the read OI value on the old coordinator.
5. Wait for the new coordinator to start (AI=0).
Router Operation
Routers must discover and join a valid ZigBee network before they can participate in a ZigBee network. After a 
router has joined a network, it can allow new devices to join the network. It can also route data packets and 
communicate with other devices on the network. 
Discovering ZigBee Networks
To discover nearby ZigBee networks, the router performs a PAN (or active) scan, just like the coordinator does 
when it starts a network. During the PAN scan, the router sends a beacon request (broadcast) transmission on 
the first channel in its scan channels list. All nearby coordinators and routers operating on that channel (that are 
already part of a ZigBee network) respond to the beacon request by sending a beacon back to the router. The 
beacon contains information about the PAN the nearby device is on, including the PAN identifier (PAN ID), and 
whether or not joining is allowed. The router evaluates each beacon received on the channel to determine if a 
valid PAN is found. A router considers a PAN to be valid if the PAN:
•Has a valid 64-bit PAN ID (PAN ID matches ID if ID > 0)
•Has the correct stack profile (ZS command)
•Is allowing joining.
If a valid PAN is not found, the router performs the PAN scan on the next channel in its scan channels list and 
continues scanning until a valid network is found, or until all channels have been scanned. If all channels have 
been scanned and a valid PAN was not discovered, all channels will be scanned again. 
The ZigBee Alliance requires that certified solutions not send beacon request messages too frequently. To meet 
certification requirements, the XBee firmware attempts 9 scans per minute for the first 5 minutes, and 3 scans 
per minute thereafter. If a valid PAN is within range of a joining router, it should typically be discovered within a 
few seconds.
Joining a Network
Once the router discovers a valid network, it sends an association request to the device that sent a valid beacon 
requesting a join on the ZigBee network. The device allowing the join then sends an association response frame 
that either allows or denies the join. 
When a router joins a network, it receives a 16-bit address from the device that allowed the join. The 16-bit 
address is randomly selected by the device that allowed the join.
Authentication
In a network where security is enabled, the router must then go through an authentication process. See the 
Security chapter for a discussion on security and authentication.
After the router is joined (and authenticated, in a secure network), it can allow new devices to join the network.