Operation
Serial interface
XBee/XBee-PRO S2C 802.15.4 RF Module User Guide
51
Flow control
The XBee/XBee-PRO S2C 802.15.4 RF Module maintains buffers to collect serial and RF data that it
receives. The serial receive buffer collects incoming serial characters and holds them until the device
can process them. The serial transmit buffer collects the data it receives via the RF link until it
transmits that data out the serial port. The following figure shows the process of device buffers
collecting received serial data.
CTS flow control
If you enable CTS flow control (by setting
D7
to 1), when the serial receive buffer is 17 bytes away
from being full, the device de-asserts CTS (sets it high) to signal to the host device to stop sending
serial data. The device reasserts CTS after the serial receive buffer has 34 bytes of space. The
maximum space available for receiving serial data is 174 bytes, which is enough to hold 1.5 full
packets of data.
Flow control threshold
Use the
FT
parameter to set the flow control threshold. Since the receive serial buffer is 174 bytes,
you cannot set
FT
to more than 174-12 = 162 bytes. This allows up to 17 bytes of data to come in after
CTS is de-asserted before data is dropped. The default value of
FT
is 109, leaving space for an external
device that responds slowly to CTS being de-asserted. The minimum value of
FT
is 17, which is the
minimal operational level.
RTS flow control
If you send the
D6
command to enable RTS flow control, the device does not send data in the serial
transmit buffer out the DOUT pin as long as RTS is de-asserted (set high). Do not de-assert RTS for
long periods of time or the serial transmit buffer will fill. If the device receives an RF data packet and
the serial transmit buffer does not have enough space for all of the data bytes, it discards the entire
RF data packet.
If the device sends data out the UART when RTS is de-asserted (set high) the device could send up to
five characters out the UART port after RTS is de-asserted.
Cases in which the DO buffer may become full, resulting in dropped RF packets:
1. If the RF data rate is set higher than the interface data rate of the device, the device may
receive data faster than it can send the data to the host. Even occasional transmissions from a
large number of devices can quickly accumulate and overflow the transmit buffer.
2. If the host does not allow the device to transmit data out from the serial transmit buffer due to
being held off by hardware flow control.