
Manage End Devices
Putting it all together
XBee/XBee-PRO® S2C ZigBee® RF Module
141
Since end devices may sleep for lengthy periods of time, the transmission timeout to end devices also
allows 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 with no
acknowledgment received, the source device re-sends the transmission until it receives an
acknowledgment, up to two more times.
The transmission timeout per attempt is:
3 * ((unicast router timeout) + (end device sleep time))
3 * ((50 *
NH
) + (1.2 *
SP
)), where
SP
is measured in 10ms 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 devices are able to buffer data long enough for the end devices to wake and
poll to receive the data. Set
SP
the same on all devices in the network. If end devices in a network
have more than one
SP
setting, set
SP
on the routers and coordinators to match the largest
SP
setting of any end device. This 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 you take certain design approaches. Specifically, the end devices should
use I/O 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 routers and coordinators do not receive a poll request for 3 consecutive sleep
periods.
As a general rule,
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.
In AT command mode, issue each command 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.
n
SM
= 4 (cyclic sleep) or 5 (cyclic sleep, pin wake)
n
SP
= 0x7D0 (2000 decimal). This causes the end device to sleep for 20 seconds since
SP
is
measured in units of 10ms.
n
SN
= 3. (With this setting, the On/Sleep pin asserts once every 3 sleep cycles, or when it
receives RF data) SO = 0