Flow Control On XBee/Arduino Serial Link

XBee projects like the adapter, xBee tutorials, tweetawatt/wattcher, etc. from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
LiverpoolFC
 
Posts: 20
Joined: Mon Jan 07, 2013 8:03 am

Flow Control On XBee/Arduino Serial Link

Post by LiverpoolFC »

Hi,

All of the tutorials & examples that I've seen so far have flow control turned off. But the XBee brings out the pins for flow control. Why aren't these used more frequently? The baud rate can get pretty high. When should flow control be turned on for hardware or software serial?

LiverpoolFC
YNWA J4T96

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: Flow Control On XBee/Arduino Serial Link

Post by adafruit_support_bill »

The Arduino Serial library does not support flow control. In fact the RTS pin on the FTDI chip is used to reset the processor.

waltr
 
Posts: 306
Joined: Wed Jun 12, 2013 5:01 pm

Re: Flow Control On XBee/Arduino Serial Link

Post by waltr »

Its not just the Baud rate of the XBee serial port that decides whether hardware flow control is required. Also, there is flow control in both directions.
In general Flow control is use to prevent over flowing the serial data input buffers when streaming large quantities of data.
Example:
The Arduino code sets up a 20 byte receive buffer. The other end of the XBee link sends 100 bytes.
The Ardiuno's UART receives the data a byte at a time and puts it into the data receive buffer. But the Ardiuno is also doing other processing (maybe ISR driven servo pulsing) so it can't get the data out of the buffer as fast as the data is coming in.
Therefore it would be a good idea for the Ardiuno code to tell the XBee to hold off sending more data when the Ardiuno's data receive buffer is almost full (like at 18 bytes). The XBee will then stop sending the data out its UART and wait until the Ardiuno removes data from the buffer and de-asserts the hold-off.
This can work the same way in the other direction, The XBee asserts a hold-off if its data input buffer gets close to be filled.

Locked
Please be positive and constructive with your questions and comments.

Return to “XBee products (discontinued)”