When I issue the ND command, the Xbee module becomes unresponsive for the time of NT. I need to wait for ND answers with nodes found. But lets say the ND command is ongoing and the master MCU just went ON and tries to send something through uart to the Xbee module. There will be a timeout. Is it possible to ask the Xbee module either he is in ND state? Or is the only option to restart the Xbee module? Or is reset not a solution as well?
I would appreciate all help.
if your processor is off, then what is sending the ND command? If it is just responding to an ND from a remote, then there is no waiting needed form your processor.
A reset will cause the module to stop doing what ever that is and restart.
The situation looks like this: mcu sends NT for 25 sec and then sends ND. Xbee is frozen for 25 sec. Meanwhile MCU resets and tries to access xbee at startup and fails, because there is ongoing ND. At the moment i reset xbee at startup to break the ND.
The xbee is not frozen for 25 seconds. It is just wanting for the response from the ND command or the timeout to occur. Issuing the reset on the line will cause the module to exit out of the command mode before the ND response is completed resulting in any response that was in the process of being received, discarded.
Yes it is waiting for timeout but from the mcu <-> xbee communication point of view it is frozen isnt it? It doesnt answer on AT commands nor queue them right?
No it is not waiting for a timeout on the mcu. The XBee has a given amount of time that it needs to wait for to complete the Node Discovery command. It is NOT frozen. You must simply wait for the command to complete. One it completes the command it will move on to the next command you issue.
You are right, but I am talking about a situation, when Xbee is during ND and the external MCU turns on and is trying to communicate with it. He cannot know that Xbee is in ND state, as he was just turned on. In this case, it seems to me that the only reasonable solution is for MCU to reset the Xbee module. Otherwise I would have to assume that Xbee might be in ND state, wait at least 25 sec and then try to communicate or reset.
Are you referring to an XBee responding to an ND request? If you are referring to the local XBee issuing an ND command that the processor is connected to, I would have to ask, what put the radio in command mode and issued the command to begin with? That is not something that the XBee can do on its own.
Yes I am reffering to local uart message. Please consider such situation:
Xbee is connected via uart to main MCU.
The MCU issued ND command to Xbee.
Xbee begins ND.
MCU got reset for some reason.
In the startup routine, the MCU tries to talk to Xbee.
Xbee is unresponsive, as it is still issuing the ND.
Then you simply trigger the rest line on the XBee from the mcu.
Yes thats what I was trying to tell- reset is the only way to break the ND.
That is correct. Until the command times out or complete, the module is not going to respond. It is NOT locked up. It is just busy completing the last request.