Unable to Receive Packets with Xbee ZB in API mode on Arduino

519 views
Skip to first unread message

KoljaM

unread,
Oct 27, 2014, 12:23:14 PM10/27/14
to xbee...@googlegroups.com
HI,

I have struggled with this for couple of days, and have to ask you here folks!

I want two Xbee ZB to communicate with each other on Arduino Due Boards, which are connected to a  PC via USB. I want the receiving XBee to print to Serial Monitor that a packet is received.

Xbees are placed on Wireless SD Shields, and then on Arduinos. I put the switch to USB position when uploading a program via Programming USB Port, and then into Micro position, when running the program.

One Xbee is Coordinator API, and another is Router API. PAN ID is the same, channel is the same (SC=4000, only channel 25 is scanned). Here are some other relevant settings in XCTU:

Zigbee Profile: ZS=2
Dest. Address High DH=0
Dest. Address Low DL=FFFF
Baud rate 9600
No Parity
One Stop bit
D7 disable (no flow control)
API Enable AP=2
API Output Mode AO=0 (Native)

The rest is standard, I think.

The Router should transmit a packet every 5 seconds:

#include <XBee.h>
XBee xbee=XBee();
uint8_t payload[]={"Z"};
//broadcast
XBeeAddress64 addr64 = XBeeAddress64(0x00000000, 0x0000ffff);

void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
xbee.setSerial(Serial1);
delay(5000);
}
 
 void loop()
{
    ZBTxRequest tx = ZBTxRequest(addr64, payload, sizeof(payload));
    xbee.send(tx);
    delay(5000);         
}



The coordinator should receive this packet and print this event to other  serial output (to see it in Serial Monitor in Arduino IDE):

#include <XBee.h>
XBee xbee = XBee();
uint8_t *data;
ZBRxResponse rx=ZBRxResponse();

void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
xbee.setSerial(Serial1);
delay(5000);
}

void loop()
{
    xbee.readPacket();
    if (xbee.getResponse().isAvailable())
       {
          Serial.println("Packet available");
          if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE)
            {
               xbee.getResponse().getZBRxResponse(rx);
               data=rx.getData();
            }          
        }
}


Now, I also have an 802.15.4 sniffer from TI and can see what happens on air. I can see that both nodes always send some messages. And it seems that the Router sends smth periodically at 5 sec. However, I cannot see  "Packet available" in the Serial Monitor on the receiving side.  It does not see any incoming packet! Any ideas what can be wrong?

Thanks a lot!






Rafael M.

unread,
Apr 29, 2018, 8:36:19 AM4/29/18
to xbee-api
Hello,

I know I posted a response very late, but I want to do it because I had a problem and thanks to this message I solved it.

The program is fine because it works fine if the XBEE have benn configured: API Coordinator and API Router. The only different thing that I have, and maybe it is for what works for me is the type of API (which is 1, not 2).
Reply all
Reply to author
Forward
0 new messages