Packet receiving not reliable


I am doing some project which needs to collect inertial sensor data to laptop wirelessly. I bought two XBee PRO S2B radios, a sensor board with gyro (L3G4200D), accelerometer & magnetometer (LSM303DLM), an Arduino uno board, a XBee shield by SparkFun and a XBee Explorer Dongle by SparkFun. The sensors, one XBee radio and the Arduino board are combined together to send the sensor data wirelessly to the other XBee radio plugging into the laptop.

The baud rate of Arduino serial port is set to 115200, and the sampling rate of the sensor is 50Hz. I configure these two XBee radios in AT mode. The problem is that the XBee on the laptop side cannot correctly receive the packets from XBee on the sensor side, which means it occasionally get some packets and cannot decode correctly. I tried to set the baud rate of Arduino serial pot to 9600. Although this time the laptop side XBee can correctly decode the packets, it cannot continuously receive packets at 50Hz. It receives one or two packets, then stop for one or half second, and then receives other two or three packets.

I dont why. All the address setting is correct. I tested the two XBee with two serial port terminals, in which they can receive the messages from each other correctly. Could you help me? Thanks!

maybe,you turnoff the XBee’s CTS/RTS ?

Hi Sokui: I cannot give you a full solution but maybe some advices would help you to address the problem.

First of all, I recommend you getting the most of info about serial reading these wiki articles:

They cover the Digi serial adapter, not directly the xbee module, but consider that this adapter is just a piece of plastic covering a single Xbee module, so the most about the adapter can be applied to the xbee module itself.

Double check the physical layer to discard any problem in wiring and/or synchronization (RTS, DSR and that boring stuff).

Finally carefully set the packetization timeout parameter (RO). Consider that the remote xbee module is going to buffer all the received serial data until one of these conditions were true:

  • Time elapsed since last character was received is >= packetization_timeout*character_time
  • Buffer becomes full

if Packetization timeout (RO) is zero, no buffering is done and any character is sent to the wireless network as soon as it is received from the serial interface.

If you set a high Packetization timeout and your sensors are transmitting continously, you wont get data until buffer is full what can explain what happens when you set your configuration to 9600 bauds.

Hope it was helpful.

You mean I should turn it off? Where can I set this? I did not find such configuration in X-CTU.

maybe,you turnoff the XBee’s CTS/RTS ?