[HELP] Issue with comunication Xbee2

Hello! I have a problem with the exchange of data between xbee
modules, particularly with the reading of the RSSI signal.

Used technology:
2 “duemilanove” arduinos + xbee shield series 2

In order to capture the RSSI signal I have set the two modules so as to have a Router/End Device and a Coordinator.

So, I have loaded firmware “ZNET 2.5 coordinator API” in module 1 (http://www.joomlabay.it/sh/screenshot1.jpg) with the settings as in http://www.joomlabay.it/sh/screenshot2.gif, while in the second module (http://www.joomlabay.it/sh/screenshot3.jpg) I have loaded firmware “ZNET 2.5 router/end device API” with the settings as in http://joomlabay.it/sh/screenshot4.gif.

In the router device, on which the “ATMEGA328” arduino’s CPU is installed, I have loaded the software taken from http://code.google.com/p/xbee-arduino/ of addendum A in order to send RSSI signal to the coordinator (which is connected to the pc through USB).

When I connect the coordinator to usb and the router to 9V battery, zigbee network is created and the router sends its ID (ROUT1 string) to the coordinator which reads it correctly. The router doesn’t send any other data.

In order to understand if the problem is due to the used libraries, I have decided to load a simple program which, every 1 second, sends the “” message to the standard output. If I load API firmware I obtain the same wrong behavior which I have previously described.
But, if I load AT firmware, the transmission is correct.

Do you know how to solve this big problem?

Thanks so much.



  • Copyright (c) 2009 Andrew Rapp. All rights reserved.
  • This file is part of XBee-Arduino.
  • XBee-Arduino is free software: you can redistribute it and/or
  • it under the terms of the GNU General Public License as published
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version.
  • XBee-Arduino is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • GNU General Public License for more details.
  • You should have received a copy of the GNU General Public License
  • along with XBee-Arduino. If not, see <Licenses - GNU Project - Free Software Foundation


#include <XBee.h>
#include <NewSoftSerial.h>

This example is for Series 1 (10C8 or later firmware) or Series 2 XBee
Sends a few AT command queries to the radio and checks the status
response for success

This example uses the NewSoftSerial library to view the XBee
communication. I am using a
Modern Device USB BUB board (http://moderndevice.com/connect) and
viewing the output
with the Arduino Serial Monitor.
You can obtain the NewSoftSerial library here NewSoftSerial | Arduiniana

// Define NewSoftSerial TX/RX pins
// Connect Arduino pin 9 to TX of usb-serial device
uint8_t ssRX = 9;
// Connect Arduino pin 10 to RX of usb-serial device
uint8_t ssTX = 10;
// Remember to connect all devices to a common Ground: XBee, Arduino
and USB-Serial device
NewSoftSerial nss(ssRX, ssTX);

XBee xbee = XBee();
//seria plus
uint8_t plusCmd = {’+’,’+’,’+’};
// serial high
uint8_t shCmd = {‘S’,‘H’};
// serial low
uint8_t slCmd = {‘S’,‘L’};
// association status
uint8_t assocCmd = {‘D’,‘B’};

AtCommandRequest plusRequest = AtCommandRequest(plusCmd);

AtCommandRequest atRequest = AtCommandRequest(assocCmd);

AtCommandResponse atResponse = AtCommandResponse();

void setup() {
// start soft serial

// Startup delay to wait for XBee radio to initialize.
// you may need to increase this value if you are not getting a

void loop() {

// get SH

// set command to SL

// set command to db


void sendAtCommand() {

Serial.println(“Sending command to the XBee”);
//nss.println(“Sending command to the XBee”);

// send the command

// wait up to 5 seconds for the status response
if (xbee.readPacket(5000)) {
// got a response!
Serial.print(“Got a response”);
// should be an AT command response
if (xbee.getResponse().getApiId() == AT_COMMAND_RESPONSE) {

if (atResponse.isOk()) {
Serial.print(“Command [”);
Serial.println("] was successful!");

if (atResponse.getValueLength() > 0) {
Serial.print("Command value length is ");
Serial.println(atResponse.getValueLength(), DEC);

Serial.print("Command value: ");

for (int i = 0; i < atResponse.getValueLength(); i++) {
Serial.print(atResponse.getValue(), HEX);

  • Serial.print(" ");*
  • }*
  • Serial.println("");*
  • }*
  • }*
  • else {*
  • Serial.print("Command return error code: ");*
  • Serial.println(atResponse.getStatus(), HEX);*
  • }*
  • } else {*
  • Serial.print("Expected AT response but got ");*
  • Serial.print(xbee.getResponse().getApiId(), HEX);*
  • }*
    } else {
  • // at command failed*
  • if (xbee.getResponse().isError()) {*
  • Serial.print("Error reading packet. Error code: ");*
  • Serial.println(xbee.getResponse().getErrorCode());*
  • }*
  • else {*
  • Serial.print(“No response from radio”);*
  • }*

why do you use 9600 and 19200? try to downgrade everything to 9600

nothing change...

can you use at commands with api firmware? I'm very new with xbee but I think that you can't.

No, with AT firmware i cannot use these code