Reading xBee with Arduino Wireless Proto Shield

Hi.
I’m trying to read RSSI of received signal from xBee.
I wrote this code for Arduino:

#include ;
SoftwareSerial mySerial(10, 11); // RX, TX

int rssi;

void serialFlush()
{
while(mySerial.available() > 0)
char t = mySerial.read();
}

void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}

void loop()
{
rssi=0;
if(mySerial.available())
{
serialFlush();
mySerial.print(“+++”);
while(!mySerial.available());
serialFlush();
mySerial.println(“ATDB”);

while(mySerial.available())
{
  rssi = mySerial.read();
  Serial.print(rssi);
  Serial.print("   ");
}
Serial.println("");

mySerial.print("ATCN");

}
delay(1000);
}

And i see these output from serial monitor:

26 57 13
13 156 195
26 156 13
26 78 195
26 57 13
26 57 13
26 80 195
26 156 13
26 57 13
26 50 68 13
26 50 67 13
26 153 81 195
26 50 65 13
26 50 56 13
26 50 56 13
26 50 57 13
26 51 48 13
26 49 57 13
26 76
26 49 65 13

Which is absolute non-sense. It should return only one byte (usually negative integer)
On other xbee i’m just posting “hi” messege to the air and also i’m changing the module’s position but i could not find any sequance (during the experiment, the distance is always increased.).
and als ATCN command is not working. I need to wait about 3-5 (no sure) seconds to receive another message.
can anyone help me?

What XBee modules are you working with?

Are you in transparent mode or API mode on them?

What firmware version is running on your XBee modules?

Hi.
Thanks for quick answer.
My modules are: XBee Pro Series 2C XBP24-CZ7WIT-004.
Coordinator and end device has the latest firmware of ZigBee (4059) and both of them on transparent mode (not API). Coordinator module sends “hi” and end device responds with measuring its rssi via the code.
Waiting for your help.
Regards…

Do yourself a favor, if this is a simple point to point network, change your firmware over on both module to the 802.15.4 versions. Then if you wanted, you could simply put the receiving module into API mode and get the RSSI level directly with the receive frame.

Hello again sir.
Thanks for suggestion but i need to create a network that has one coordinator and many end devices.
So there will be a changing message like “hi1” and first end device will listen and get rssi. second message will be “hi2” and second end device will listen and get the rssi and so on.
Thanks again.
If you have a solution, please share with me.
Best regards…

The 802.15.4 protocol and firmware I am referring to is a Peer to peer, point to point, point to multi-point protocol which the Zigbee mesh protocol runs on top of.

So you can do a Point to multi-point with 1 coordinator (802.15.4) and many end devices just as I described above.

thank you sir.
i will try your solution and come back with results.
have a great day.