xbee-arduino
xbee-arduino copied to clipboard
Arduino + XBee S2B ZB : Failed when sending to a specific XBee address
Hello all,
My first words are to the amazing Andrew's work with the libraries to facilitate the use of XBee's. I'm a newbie using XBee's and this library is an excellent tool! Thank you Andrew!
Now, my issue is, when using Arduino, I can't address to a specific XBee address. When I try to send a packet to a specific XBee address it replies with "Failed to send packet. Status: 0xFF"
I'm using the "HelloSend.ino" sample code provided with the book Building Wireless Sensor Networks Using Arduino by Matthijs Kooijman. Thank you Matthijs.
(note: I'm using .txt extension files to be easier to post here)
Here is my code (I have changed only the addressing) to send a packet to the XCTU XBee Router address 0x0013A2004146B59A .
void sendPacket() {
// Prepare the Zigbee Transmit Request API packet
ZBTxRequest txRequest;
txRequest.setAddress64(0x0013A2004146B59A); //send packet to XCTU XBee Router
uint8_t payload[] = {'X', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!'};
txRequest.setPayload(payload, sizeof(payload));
// And send it
uint8_t status = xbee.sendAndWait(txRequest, 5000);
if (status == 0) {
DebugSerial.println(F("Succesfully sent packet"));
} else {
DebugSerial.print(F("Failed to send packet. Status: 0x"));
DebugSerial.println(status, HEX);
}
}
See full code here : HelloSend.txt
I also tried a different approach setting the address using XBeeAddress64:
XBeeAddress64 remoteAddress = XBeeAddress64(0x0013A200, 0x4146B59A);
Also gives me an error when assigning to a specific XBee address using Arduino! Could anyone help me on what I'm doing wrong?
My best regards!
This is my scenario:
- 3 XBees S2B
- Firmware (send attached profile files):
ZigBee Coordinator API (connected to Arduino Uno): 0x0013A2004146B5F2 profile_23A7_Coordinator_0x0013A2004146B5F2.txt
ZigBee Router API (connected to Arduino Uno): 0x0013A2004146B626 profile_23A7_Router_0x0013A2004146B626.txt
ZigBee Router API (connected to XCTU): 0x0013A2004146B59A profile_23A7_Router_0x0013A2004146B59A.txt
My Tests:
With XCTU XBee (ZigBee Router API ):
- All XBee's are visible between each other.
- sending message from XCTU XBee to all network XBee's (address 0x000000000000FFFF) , packets are received on all network XBee's (Arduino XBee Coordinator and XCTU XBee Router).
- sending message from XCTU XBee Router to the Arduino Xbee Coordinator (address 0x0000000000000000) packet is received on Arduino XBee Coordinator. All works fine when addressing to 0x000000000000FFFF and 0x0000000000000000 using XCTU XBee Router!
With Arduino Xbee (ZigBee Router API ):
- sending message from Arduino XBee Router to all network XBee's (address 0x000000000000FFFF) packets are received on all network XBee's (Arduino XBee Coordinator and XCTU XBee Router).
- sending message from Arduino XBee Router to Arduino Xbee Coordinator (address 0x0000000000000000) , packets are received on Arduino XBee Coordinator. All works fine when addressing to 0x000000000000FFFF and 0x0000000000000000 using Arduino Xbee Router.
With Arduino Xbee (ZigBee Coordinator API ):
- sending message from Arduino XBee Coordinator to all network XBee's (address 0x000000000000FFFF) packets are received on all network XBee's (Arduino XBee Router and XCTU XBee Router).
All works fine when addressing to 0x000000000000FFFF using Arduino Xbee Coordinator.
You should use AP=2 however I'm not convinced that explains the issue. The FF response indicates no reply from the local xbee, as if it wasn't connected. Have you looked at the docs to see if there are any changes to the api for S2B? I don't have any S2B radios so I'm unable to troubleshoot
I have read the past issues and saw that we should configure modules as API 2 👍 https://github.com/andrewrapp/xbee-arduino#configuration
that code snippet is for that
Hi, I am having the exact same problem with XBee Series 2, always getting the timeout code 0xFF if I try to address an specific router... TiksTriks, did you finally solved the problem ? Regards
Hey ! I just double checked to see which API conf I had and it was wrong !, After switching to API 2 (escaped) it works perfectly so I can use full specific addressing. Regards