Digi International Inc XBEEPRO2 Manual Do Utilizador

Página de 155
XBee®/XBee‐PRO® ZB RF Modules 
© 2011 Digi International, Inc.
     93
Putting it all Together
Short Sleep Periods
Pin and cyclic sleep devices that sleep less than 30 seconds can receive data transmissions at any time since 
their parent device(s) will be able to buffer data long enough for the end devices to wake and poll to receive the 
data. SP should be set the same on all devices in the network. If end devices in a network have more than one 
SP setting, SP on the routers and coordinators should be set to match the largest SP setting of any end device. 
This will ensure the RF packet buffering, poll timeout, and transmission timeouts are set correctly.
Extended Sleep Periods
Pin and cyclic sleep devices that might sleep longer than 30 seconds cannot receive data transmissions reliably 
unless certain design approaches are taken. Specifically, the end devices should use IO sampling or another 
mechanism to transmit data when they wake to inform the network they can receive data. SP and SN should be 
set on routers and coordinators such that (SP * SN) matches the longest expected sleep time. This configures 
the poll timeout so end devices are not expired from the child table unless a poll request is not received for 3 
consecutive sleep periods.
As a general rule of thumb, SP and SN should be set the same on all devices in almost all cases.
Sleep Examples
This section covers some sample XBee configurations to support different sleep modes. Several AT commands are 
listed with suggested parameter values. The notation in this section includes an '=' sign to indicate what each 
command register should be set to - for example, SM=4. This is not the correct notation for setting command values 
in the XBee. In AT command mode, each command is issued with a leading 'AT' and no '=' sign - for example ATSM4. 
In the API, the two byte command is used in the command field, and parameters are populated as binary values in 
the parameter field.
Example 1 
Configure a device to sleep for 20 seconds, but set SN such that the On/Sleep line will remain de-
asserted for up to 1 minute.
The following settings should be configured on the end device.
SM = 4 (cyclic sleep) or 5 (cyclic sleep, pin wake)
SP = 0x7D0 (2000 decimal). This causes the end device to sleep for 20 seconds since SP is measured in units of 
10ms.
SN = 3. (With this setting, the On/Sleep pin will assert once every 3 sleep cycles, or when RF data is received)
SO = 0
All router and coordinator devices on the network should set SP to match SP on the end device. This ensures 
that RF packet buffering times and transmission timeouts will be set correctly.
Since the end device wakes after each sleep period (ATSP), the SN command can be set to 1 on all routers and 
the coordinator.
Example 2 
Configure an end device to sleep for 20 seconds, send 4 IO samples in 2 seconds, and return to 
sleep.
Since SP is measured in 10ms units, and ST and IR are measured in 1ms units, configure an end device with the 
following settings:
SM = 4 (cyclic sleep) or 5 (cyclic sleep, pin wake)
SP = 0x7D0 (2000 decimal). This causes the end device to sleep for 20 seconds.
SN = 1
SO = 0
ST = 0x7D0 (2000 decimal). This sets the sleep timer to 2 seconds.