How to reset XBee Pro S2B via AT command

Very frequently when I power ‘on’ an XBee S2B module it fails to successfully start and join the PAN. I’m using a micro controller to poll the local (router) XBee when it powers on using an AT command, and if “OK” then I query the “AI” command. If it’s a “0” then all is good. But most of the time I don’t get an “OK” back and have to toggle power to the XBee to have it restart.

My question is really two questions. What is the best way to (thru AT serial commands) to detect if a PAN was successfully joined? (is it via the ATAI command?) How can you tell if the XBee can see the Coordinator? And most importantly, if the XBee didn’t successfully join a known-good PAN on boot, or after it retries several times, how can the XBee be reset via AT serial command? Thanks for any help!

ATND will discover other nodes on the network. if you see anything else you’ll know you’ve joined one.

ATNR0 will reset your module.