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.
Thanks!
Jeremy