How to reset Radio Buffer Xbee Programmable

i would to reset my XBee when it receive “11” value from controller. i have wrote this code:

int xbee_transparent_rx(const wpan_envelope_t FAR *envelope, void FAR *context) {
	uint8_t *rx = envelope->payload;
	if (*rx == 11) {
	return 0;

I receive correctly the message and my app reboots itself, but after reboot it handles again the same message from coordinator,
it is as if the radio buffer wasn’t been resetted, so, my application reboots just three times.
An orrible workaround is to use at least 3 printf (it will slow down application and it will reboot itself just one time).

I try to use a Remote AT Command FR but it seam not works.

Any ideas?


Just a thought, and I have no idea if it will help but I would suggest.

Change the code in the RX frame handler so it sets a global variable to TRUE to request a reset. Exit from the handler with the standard return. Then in the main loop that is calling the Xbee_tick, check the global variable and issue the reset there.

I suspect that you may need to allow the handler to exit cleanly so that the received message is cleared from the buffer, befor you try to do the reset.

Hope it helps