Home/Support/Support Forum/Xbee S2 API Mode Setup
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Xbee S2 API Mode Setup

0 votes
I'm stuck. I have had success setting up Series 1s with Arduino UNO but I'm not getting anywhere with the S2. I am trying to establish communication between 1 end point and 1 coordinator. They are running the same PAN ID, AP mode and version. One is coordinator API and the other is end point API. I am using the XBee lib for Arduino and have set the AP mode to 2. In the tx code, I send a payload by address (serial) and there is know acknowledgement on either end.

What am I missing? Is there an arduino/xctu/xbee series 2 tutorial that is complete or accurate?

Thank you so much for any help.
asked Mar 15, 2016 in Other/Legacy by jeremyhise New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes
I think, When you set your XBee device to " End Device", at that time, your end device will enter into sleep mode and after some time it will wake up and this cycle repeats.

So when you send the packet, your end device is in sleep mode. So it is not able to receive the packet. Set your second device as a router instead of End device. If you are using xbee library then set it to API router and API= 2
answered Mar 16, 2016 by bhavika New to the Community (7 points)
Thank you for your reply, however, this did not work.

The relevant parts of code are:

uint8_t payload[2] = { 0,0};
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x40a9dcb0);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));

// In setup
Serial.begin(9600);
xbee.setSerial(Serial);

// in the loop()
xbee.send(zbTx);
 
if (xbee.readPacket(1000)) {
// Never makes it here


On the coordinator side, I am running:

xbee.readPacket();
if(xbee.getResponse().isAvailable()) {...
// And never get a response.

Thank you
instead of xbee.setSerial, use xbee.begin() with software serial library. It will be easy for you

#include <SoftwareSerial.h>

SoftwareSerial nss(2,3); //(Rx,Tx)
uint8_t payload[2] = { 0,0};
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x40a9dcb0);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));

// In setup
Serial.begin(9600);
nss.begin(9600)
xbee.begin(nss);

// in the loop()
xbee.send(zbTx);
 
if (xbee.readPacket(1000)) {
// Never makes it here


On the coordinator side, I am running:

xbee.readPacket();
if(xbee.getResponse().isAvailable()) {...

Use software Serial on both side, coordinator and router.
also check that your destination address is same as that of the Adress64
I think this works only for AT mode, correct? In API mode, you don't set the destination address (X-CTU wont even let you if you have API mode selected).
In this line

XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x40a9dcb0);

check that whether you have a XBee with this address? 0x40a9dcb0. If API mode, while making a frame destination address is necessary.

Otherwise code is working fine.
...