Home  >  Support  >  Support Forum  >  Programmable XBee S2B freezes after sleeping the radio

Programmable XBee S2B freezes after sleeping the radio

0 votes
I'm writing an application for a programmable S2B which in one configuration needs to sleep the radio during initialization (before entry into the main for loop). I'm seeing the application freeze inside the sys_xbee_tick() function. I traced it to the processing of a modem status == joined (2) message which calls the internal handler. The handler never returns. The handler basically sends a bunch of AT command queries to the EM250. Since the watchdog doesn't reset the CPU, I'm assuming it is stuck inside the loop in the xbee_ser_write function waiting for the bytes to go to the EM250's UART, but the radio is sleeping. As far as I can tell, this is the only loop that resets the watchdog timer, from xbee_serial_hcs08.c, line 183 and onward:
Code:
case SERIAL_PORT_SCI2: // EM250 while (length--) { // SCI2S1_TDRE -- 0 = sending, 1 = ready for byte // PTDD_PTDD6 -- 0 = clear to send, 1 = not clear while (! SCI2S1_TDRE || PTDD_PTDD6) { __RESET_WATCHDOG(); } SCI2D = *((const byte FAR *)buffer)++; } break;

How do I prevent the joined message from triggering this freeze?
asked May 6 in XBee Programmable Development by Andy III New to the Community (1 point)
edited May 6 by Andy III

Please log in or register to answer this question.

1 Answer

0 votes
 
Best answer
Try adding an end If statement having the processor query /CTS. If /CTS is not active, then do not query the radio.
answered May 6 by mvut Veteran of the Digi Community (1,625 points)
selected May 6 by Andy III
My code is not querying the radio.  That code is part of the XBee framework that handles modem status messages.  I have the modem status handler disabled in my config.xml.  This is some library code that is updating the network address and other values in the xbee device struct.
I tried as you suggested in the main for loop around sys_xbee_tick() and it worked.  Thank you very much! I added if (xbee_ser_get_cts(&(xdev.serport))) in front of sys_xbee_tick().
Contact a Digi expert and get started today! CONTACT US
...