Xbee Series 2 API-AT association problem

, ,

Hello, I’m a new user and a newbie with XBee.

I’ve got 2 XBee Series 2. The controller is connected to Arduino, the router is placed on a simple xbee shield. I have to switch the status of a digital pin in the router, and also send some serial data.

I know that with XBee Series 1 I can do this in AT mode. Unfortunately I own 2 XBee Series 2 and I’ve read that I can do this only in API mode.

My problem is that when I configure the controller in API mode, the router can’t associate with the controller, the ASSOC led blink, the RSSI remain off.
Instead if I configure both xbee in AT mode I can send serial data from controller to router.

I’ve tried to configure both xbee in api mode, but the result is the same, there isn’t no connection between the two xbee.

Those are the firmware used:

Modem: XB24-B

  1. First case, only serial working:
    Arduino connected: ZNET 2.5 COORDINATOR AT (1047)
    Remote: ZNET 2.5 ROUTER/END DEVICE AT (1247)

  2. Second case, no connection:
    Arduino connected: ZNET 2.5 COORDINATOR API (1147)
    Remote: ZNET 2.5 ROUTER/END DEVICE AT (1247)

  3. Third case, no connection:
    Arduino connected: ZNET 2.5 COORDINATOR API (1147)
    Remote: ZNET 2.5 ROUTER/END DEVICE API (1347)

In every case I’ve restored the default configuration, so I think that it’s right. I don’t understand why there’s no connection. I have to do some extra configuration if the coordinator is in API mode?

This is the code that I use to switch the pin in the remote xbee. I use this library: http://code.google.com/p/xbee-arduino/


#include 

XBee xbee = XBee();

uint8_t pinCommand[] = {'D','4'};
uint8_t dOnValue[] = { 0x5 };
uint8_t dOffValue[] = { 0x4 };

XBeeAddress64 remoteAddress = XBeeAddress64(0x0013A200, 0x408C58A5);

void setup()
{
  xbee.begin(9600);
  // Give the XBee a few seconds to start and join the network
   delay(5000);
}

void loop()
{
  RemoteAtCommandRequest remoteAtRequest = RemoteAtCommandRequest(
                                      remoteAddress,
                                      pinCommand,
                                      dOnValue,
                                      sizeof(dOnValue));
  xbee.send(remoteAtRequest);
  
  delay(1000);
  
  remoteAtRequest.clearCommandValue();
  remoteAtRequest.setCommand(pinCommand);
  remoteAtRequest.setCommandValue(dOffValue);
  remoteAtRequest.setCommandValueLength(sizeof(dOffValue));
  xbee.send(remoteAtRequest);
  
  delay(1000);
}

Thank you.
Fabio

If you use th USB port of your Arduino to powered your arduino, shield and XBEE, the datas in Rx and Tx is only take by the arduino.

You should use another power supply and the data in Rx and Tx works with your Xbee

If you use th USB port of your Arduino to powered your arduino, shield and XBEE, the datas in Rx and Tx is only take by the arduino.

You should use another power supply and the data in Rx and Tx works with your Xbee

Really?
It’s very strange because when the controller is in AT mode, it works perfectly. In addition the documentation says:

You can use any of the standard Arduino serial commands with the Xbee shield. With the shield’s jumpers in the Xbee position, the print and println commands will send data over the Xbee shield and the USB connection (i.e. to other Xbee shields and to the computer at the same time).

Maybe in API mode is different?

Sorry, i don’t know the type of your shields.

Mine is described in this link :
http://arduino.cc/en/Main/ArduinoWirelessProtoShield

And see the chapter “Switch setting”

I soved setting AP=2 in the controller.

1 Like

What do you mean you set AP = 2 ?

In the main page of the library:

Note: This software requires API mode, by setting AP=2. If you are using Series 2 XBee, you’ll need to install API Firmware (they ship with AT firmware), then set AP=2. This software will not work correctly with AP=1 Refer to XBeeConfiguration and WhyApiMode for more info.

Set AP =2. means - setting in X-CTU in Host setup page (first page). Right? Please advise.

In X-CTU, Modem Configuration tab, in the tree, Serial Interfacing -> AP - API Enable, set = 2 (api enabled with escaping)