Managing End Devices Putting It all together
XBee/XBee-PRO ZigBee RF Modules User Guide 99
Adaptive polling
The PO command determines the regular polling rate. However, if RF data has been recently received by an end
device, it is likely that yet more RF data could be on the way. Therefore, the end device will poll at a faster rate,
gradually decreasing its adaptive poll rate until polling resumes at the regular rate as defined by the PO
command.
Transmission timeout
As mentioned in Transmission, addressing, and routing on page 53, when sending RF data to a remote router,
since routers are always on, the timeout is based on the number of hops the transmission may traverse. This
timeout it settable using the NH command. See Transmission, addressing, and routing on page 53 for details.
Since end devices may sleep for lengthy periods of time, the transmission timeout to end devices also includes
some allowance for the sleep period of the end device. When sending data to a remote end device, the
transmission timeout is calculated using the SP and NH commands. If the timeout occurs and an
acknowledgment has not been received, the source device will resend the transmission until an
acknowledgment is received, up to two more times.
The transmission timeout per attempt is:
3 * ((unicast router timeout) + (end device sleep time)), or
3 * ((50 * NH) + (1.2 * SP)), where SP is measured in 10 ms units.
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 three
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.