An XBee Series 2 is set to Router AT
whose TX
and RX
pins are connected to an Arduino Nano's Rx
and Tx
pins respectively. The Arduino is connected to a Mac OSX via USB.
A second XBee Series 2 is connected to a Windows system via USB. It is set to Coordinator API
mode.
Using the sketch below on the Arduino, a packet is sent from the Router AT
XBee to the Coordinator API
XBee, which is seen by XCTU
as a Explicit RX frame. However the Arduino LED should blink once if it received a reply packet (should it?)
On another test, I wrote a script to send a frame for the Coordinator API
XBee to send to the Router AT
XBee. Once again the Arduino LED does not blink, and nothing is seen using Arduino's Serial Monitor.
Testing the Coordinator API
XBee
Using the same script to send a packet from Coordinator API
XBee to itself, the packet was received as well as a delivery confirmation packet. This shows that both the Coordinator API
XBee and the script are working.
// Delivery confirmation
received: { type: 144,
remote64: '0013a20040a74613',
remote16: '0000',
receiveOptions: 1,
data: [ 116 ] }
// Received the packet sent to itself
received: { type: 139,
id: 1,
remote16: '0000',
transmitRetryCount: 0,
deliveryStatus: 0,
discoveryStatus: 0 }
Testing the Arduino Sketch Code
Using the same Arduino sketch which continuously sends API frames to the Coordinator
, I connected the Router AT
XBee's RX
pin to Arduino's RX
pin, so the frames the Arduino are sending out are going back into its RX
pin.
This causes the Arduino's LED to light up! So there is nothing wrong with the code.
Problem: Does this mean the Router AT
XBee is not configured properly? I do not think its TX
pin is damaged because XCTU
can still read the settings off this XBee. Any ideas on how we can troubleshoot this?
Arduino Sketch (Connected to Router Xbee)
#include <XBee.h>
XBee xbee = XBee();
uint8_t payload[] = { 0, 0 };
// SH + SL Address of receiving XBee
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x40a74613);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
ZBTxStatusResponse txStatus = ZBTxStatusResponse();
void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
xbee.setSerial(Serial);
}
void loop() {
xbee.send(zbTx);
delay(1000);
xbee.readPacket();
if (xbee.getResponse().isAvailable()) {
// Response received, blink LED once
Serial.println('resposne!');
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
}
Router AT
packet to theCoordinator
inAPI
mode. Sending out via AT is aSerial.print("sample");
. Whereas the sketch you have above only shows us the Coordinator's outwards bound packet. Does that library handleAT
mode as well? And what about addresses? You don't need to explicitly set the address outwards of the Coordinator (although it wouldn't hurt), the Coordinator should/can broadcast it's message. Can you confirm theATDL
of the Router is0x0
or0xFFFF
if ATDH is0x0
.ATAP=2
so that's something else to check.Router AT
Xbee, notCoordinator
XBee. Made the change in the question