I'm developing some replacement firmware for an embedded application that uses Series-1 XBees. The hardware (Arduino Leonardo with built-in XBee socket) uses the XBees with no antenna (i.e. a PCB antenna). The new Arduino code has to be a drop-in replacement for the old code, which had some serious reliability issues.
When I developed the new firmware, by a lucky accident I got XBees with RPSMA antennas. I've used API mode and put one device in coordinator mode, the other in endpoint mode. I use channel and PAN ID reassignment options, as I want to be able to bring up multiple adjacent systems without them interfering. In my lab, the endpoint device associates with the coordinator and gets a modem status frame with value 2 "associated" and all is good.
The problems come when I try this firmware on the actual target hardware, with the PCB antenna. The XBees will not associate, even though they are only a couple of feet apart. In fact they do associate, eventually, but it takes a very long time (in the order of 2 to 4 hours) for them to manage it, which is not going to be acceptable in production.The exact same firmware running on my test system with the RPSMA antennae works fine and association takes less than 3 seconds.
I can sort of reproduce this situation by unscrewing the antennae from my test units. Then, they will not associate. As soon as I fit one of the antennae, they associate in under 3 seconds. Boom!
The thing is, the old firmware uses "transparent serial replacement" mode (i.e. not API mode) and manages to communicate OK, sort of, but is a bit error prone. We decided to switch to API mode for various reasons and it has proved to be a good decision, in theory at least. However, association will not work reliably on the PCB antenna variants.
I think that the signal strength might be "on the edge". So my question is twofold:
1. The data sheet suggests I should get at least a few tens of metres of range out of even the variant with the PCB antenna, so units only 2 or 3 feet apart should have no trouble associating. Is this in fact the case? What is the effective range of these modules?
2. What (if anything) can I do to improve my chances of getting a successful association?
Any help much appreciated.