Xbee3 Cellular - Micropython cellular.shutdown vs. cellular.active (airplane mode)


I am updating and debugging code and I see that a new method was added to the Micropython port for shutting down the cellular modem. Specifically it is cellular.shutdown(reset=T/F) method. What the method does is pretty clear and a nice tool for doing what I previously did with putting the modem in/out of airplane mode (the cellular.active() method).

This brings up my question, how is this method different from putting the cellular modem into airplane mode? Is it doing something different? Or is it just a method of convenience over toggling airplane mode? Is it a safer method to execute over using cellular.active() method to prevent cellular firmware corruption?

Thank you,


1 Like

The new method is for powering off the device. It should help prevent the cellular components firmware from corrupting. Airplane mode should not be used for powering off the radio but for obtaining a lower power state when the cellular connection is not needed for a period of time.

Roger that. Thank you for the clarification.


Are there any recommendations on how long of wait should be programmed after Cellular.Shutdown method has been invoked? Is it needed at all? My code is something like this:

time.sleep(60)  # 60 second sleep to allow the shutdown process to occur

I tested it a few times and it appears the uPython code will wait for the shutdown to complete, but I was unsure there are any background processes occurring that a short wait should be included in the code to allow time for that to complete. Then the reset can occur.

Also, the documentation isn’t real clear, but after testing, if reset=True for the shutdown process , it appears the XBee is being reset in addition to the modem. In other words, it’s not just the modem being reset, but both the modem and the XBee (or at least the uPython script; similar to a soft reset). The documentation seems to indicate the Cellular is rebooted if reset is set to True. However the last statement on that page (last sentence in the quoted below) seems to indicate that if True, it will basically perform a machine.reset() after modem shutdown. The behavior that I am seeing would be consistent with that last statement and reset=True basically saves me from coding a machine.reset() and any wait time I was considering above.

This method will properly and safely shut down the cellular modem.


Where reset can be True or False.
If reset is set to True, the XBee Cellular will be rebooted after the cellular modem has been shut down.
If reset is set to False, the XBee Cellular will not be rebooted, but the cellular modem will have been shut down.
If False, you would typically use a machine.reset() after this command to emulate the reset=True option.

Thank you.

From what I recall, the majority of the Cellular chip manufactures have indicated that it should take no more than 2min from the time you issue the Shutdown request for the module to be safe for power down.