(I thought I had posted this question yesterday but I can’t see it - my apologies if this becomes a duplicate.)
I have a XBee3 coordinator with the latest Zigbee firmware and an XBee3 end node (also latest Zigbee firmware). Both run Micropython programs with the end node connected to both an I2C set of sensors and a UART (for human readable text) from a sensor.
The sequence of events is:
- Coordinator starts and creates the network
- A little later the end node starts and joins the network (it spins on reading the AT command “AI” until it returns 0)
- The end node communicates with the coordinator (to get a ‘pseudo-time’ value)
- The end node gets samples and creates a binary packet that is ‘transmits’ to the coordinator
- The coordinator receives the packet and passes it to another MCU (via the USB/UART)
- The end node them uses the xbee sleep_now() function to sleep for 5 minutes with the minimal power usage (it will ultimately be battery/solar panel powered)
- the end node wakes and loops back to get the next samples
The problem is that I get about 2 or 3 samples sent to the coordinator but then the end nodes stalls because the ‘transmit’ function receives ENOCONN error. To try to reconnect to the network it again loops until the AT command 'AI" returns 0 but this doesn’t happen.
I’ve tried adding another properly configured end node but it can’t find a network to joins.
My questions are:
- what is the correct way to ensure that the coordinator keeps the network running
- what is the correct way for the coordinator/end node to recover from a lost network connection
AS this is my first question, I’m not sure what other information is required but I’m happy to provide whatever is asked for.