Hi everyone !
I’m working with 3 XBee3 eval board and X2E gateway.
- X2E as coordinator
- 1 xbee3 as router
- 2 xbee3 as end node sleeping devices
The 3 XBees running with micropython, and sleeping duration is 1 minutes for now just for testing, but it will be about around a day.
My problem is that sometime XBee end devices can freeze just after wakeup. ON/SLEEP led is ON and ASSOC can be ON or OFF locked.
At this point, on REPL terminal, i can’t interrupt the code with CTRL-C, but i can read XBee value with XCTU and i have :
- AI = FF
- OP = 0
- OI = FFFF
- CH = 0
- NC = 0
I understand that XBEE is not associated, and stay in this state indefinitely.
The only way is to perform a physicaly hardware reset and xbee run properly.
That i do i my code, globally in main WHILE :
- XBEE wake up from sleeping period.
- Wait for assotiation within 60 seconds then perform a soft reboot
# Wait for association
for x in range(60):
if xbee.atcmd("AI") is 0:
break
else:
time.sleep(1)
if x is 60-1:
machine.soft_reset()
- If associated, pool to check any massage stored in parent router.
- Get data sensors
- Send data to server and wait if receive a new data from server
try:
xbee.transmit(xbee.ADDR_COORDINATOR, packet_dict)
except OSError:
print('No xbee connection')
else:
rdata = receive_data()
if rdata is not None:
use_data_in(rdata)
- Then enter in sleeping time :
if bkp_mod == 'awk':
time.sleep_ms(off_dly)
elif bkp_mod == 'slp':
print('Delay = ', off_dly, 'ms')
xbee.XBee().sleep_now(off_dly, False)
When program start during initialisation, i set ET parameter to a value greater than sleeping time.
When issue comes, i don’t know if micropython code is running or not.
What is a problem ? What i’m missing ?
If not, how can i capture this problem state and perform for exemple a machine.reset() or maybe using the watchdog ?
Thank you for help in advance,