Xbee2 problems resolved after 2 days
I have been struggling with to get my 2 Xbee2 (XB24-Z7WIT-004) modules to communicate properly with each other for the last few days.
The issue seemed to be that they were communicating but not reliably. I even wrote a little program that gave me the some debugging information
Here is what the little program should do (works over serial)
U > Sending 100 bytes in sequence (123456....) with 50 sec intervals
A > Receives 100 bytes in sequence
A > Waits till byte with value 100 is read or 10 seconds passes
A > Returns amount of valid values read
U > Reads value from A and displays it
A > Sending 100 bytes in sequence (123456....) with 50 sec intervals
A > Recieves 100 bytes in squenceA > Displays Values
Unfortunately this is what was happened
U > Sending 100 bytes in sequence (123456....) with 50 sec intervals
A > Receives 8 bytes in sequence
A > Waits till byte with value 100 is read or 10 seconds passes
A > Returns amount of valid values read (which is 8)U > Reads value from A and displays it
A > Sending 100 bytes in sequence (123456....) with 50 sec intervals
A > Recieves 100 bytes in squenceA > Displays Values
U > Reads the rest of the values from 9 - 100 (i can tell this because I blink a green led every time the arduino reads a expected value)
Source code for my testing software
I then talked to some friends and found out that X-CTU has a range tester which really would have done exactly what I needed to test my system. Here is the X-CTU result on my setup
So clearly there was a problem with my setup. It seems the Xbee modules was losing some packets somewhere.
It turns out.. not sure why but it had something to do with the firmware that I selected. I was running
XB24-B - Znet 2.5 Coordinator AT 1047
XB24-B - Znet 2.5 Router/End Device
On the default settings. I tried many variables here but in the end I could not stop packet loss without increasing the delay between packet sending to a point where it was not usable.
In the end I got it working (after TOOO many hours) using the following firmware.
XB24-ZB Zigbee Coordinator AT
I tried using just the default settings and only modifying the PANID and the Destination address high/low but that did not work. In the end I got it working by also playing with the DO setting under IO settings by changing it to digital input.
For future reference here are the setup file that you can import with X-CTU. Just be sure to update the destination address.