Connecting to an X2e

So in my setup I have an X2e acting as the coordinator which I am connected to via SSH, and an S2C Xbee module on a custom PCB operating in transparent mode with logic probes monitoring the TX/RX/CTS/RTS lines.

My goal, is to come up with some process by which the module on the custom PCB will prefer to connect to the X2e it has successfully connected to, but can be assigned to another X2e (through serial commands) and in the event that the previous X2e no longer exists, connect to another X2e.

Currently on all devices (written to EEPROM):
EE = 0x01
KY = 0x1234

On power-up the first time, the module looks for a Zigbee network with KY=0x1234, and upon successfully connecting (checking AI=0) I read the operating PAN (OP) and WR that value into the ID register. Once this is done, my understanding is that the module can then only connect to the PAN with that specific ID.

In the event that an X2e is removed, on powerup the module cannot find a PAN with the specified ID (there should be a new network). What I expected was to ready back 0x22 (Scan found no valid PANs based on SC and ID settings), and after seeing this response several times the module would give up and default ID back to 0 allowing it to connect to the new PAN. Once connected to the new PAN (AI=0), OP is written to ID and the circle continues.

This doesn’t work. It will connect to the first X2e it sees, and will persistently connect to that same X2e, but if you replace the X2e or assign a different PAN to that X2e ( xbee.ddo_set_param(None, ‘ID’, {newpan}) ), the modules just spin on powerup never seeing the expected 0x22s that count it up to a full reset. Instead, when I check AI I see 0x21’s (scan found no PANs) and 0xADs (Network security key not received). Yesterday in testing when I was replacing the X2e instead of just switching the PANID I also received 0xAC (Network security key received unsecured).

If anyone is familiar with the AI codes to know what is going on here and could shed some light, or maybe has a different approach to achieve similar functionality I would appreciate it.



Found a doc for troubleshooting AI codes I had seen before.

This suggests that the 0xAD I’ve been reading back from the AI register indicates a issue with the security key, but all I changed was the PAN on the X2e. I did go back and reassert that EE=0x01 and KY=0x1234. The only values that have been changed on the X2e should be that:

ID = 1122334455667788
II = 1234

The Extended PAN Identifier and PAN Identifier both reflect these new values on the X2e device configuration web interface after the change, but the end device is throwing 0xADs instead of 0x22s like expected.