Configure Xbee Pro Series 1 in Linux w/ stty

Hi,

I’m wondering what the recommended set-up is in Linux for an Xbee Pro Series 1 radio? For example, having configured the radios to operate at 57.6 kbaud, here is how I set up the serial port to use it (where the radio is located at /dev/xbee):

stty -F /dev/xbee sane speed 57600

In addition, I’m communicating between radios using a SLIP connection that I setup as follows:
slattach -L -s 57600 -p slip /dev/xbee &
ifconfig sl0 10.0.0.1 netmask 255.255.255.0

This generally works, but it occasionally does not (and it crashes the usb hub sometimes); and the performance isn’t great. For example, I get a ton of packet loss at 57.6 kbaud. I can mitigate that somewhat by reprogramming the radios to use a slower speed (as expected), but it really compromises the application that’s using the SLIP connection I’ve set up. Therefore, I have two questions:

  1. For anyone on here using these radios on Linux, how do you configure them/the serial port? Is sane speed xxxx good enough? What about flow control. etc?
  2. Given the above, is there any fundamental settings in the radio I should tweak to improve the performance of them (e.g. using X-CTU)?

Any help is much appreciated.

-Tony

I am no Linux expert, but you will need to enable some form of RTS/CTS (‘hardware’ flow control) (A quick google suggests adding ‘rtscts’ to the your line?) In the S1 XBee, D6/D7 enable RTC/CTS flow control.

You could also try the debug mode for SLIP - I don’t know if SLIP has any options to make it act more half-duplex, so sending less data without the appropriate ACK from the remote. Maybe the RTS/CTS solves this.

But the XBee S1 only moves data in ~100 byte packets, so I think it could get ‘behind’ if the SLIP is too agreessive at pushing data without allowing the radio time to work. ‘Aloha’ for example was designed for radio use, so probably is more graceful that SLIP which was designed for full-duplex analog modems with large buffers.

Hi, if you like?
Try gtkterm, it work fine, and has options for flowcontrol.

Thanks for the reply, lynnl. First, bear with me; I’m a little slow this morning. Ok, so I should enable flow control. That requires: 1. configuring flow control on the xbees, 2. configuring flow control in Linux (i.e. via stty). I’m a little confused about doing both. So, two questions:

  1. How do I enable flow control on the xbees? Can I do this through the X-CTU interface? Which parameter do I modify (e.g. ATBD is used to set the baud rate), and to what value do I set it?

  2. For any Linux pros: it looks like the crtscts option in stty if the way to enable flow control. True or false?

Thanks for the help,

Tony

  1. use XCTu to set both D6 and D7 to ‘1’, which means their special magic function. 0 means disable, 3/4/5 are I/O modes, but for RTS/CTS to work you want the special function of 1.

  2. you may need to check with your actual linux distro docs, since it might vary on embedded Linux.

What RTS/CTS does is allow the Xbee to say ‘Stop sending data, my buffer is full’ - which easily happens if you send 2000 bytes and the Xbee only has about 100-200 bytes of space. So Linux will send for example 200 bytes and detect via HARDWARE that no more data can be sent, so Linux pauses until the Xbee renables its signal saying “Send more”. The actual terms are fuzzy since Xbee uses DCE terms (sorry for the jargon), so usually the RTS pin on a PC or Linux is an output and ties to the RTS pin on the XBee which is an input.