Open VincBont opened 10 months ago
LTE.dettach() is non-blocking, but takes a significant amount of time. Try adding a polling/wait loop after your call to dettach() and before the sleep call, that checks LTE.isattached(), and breaks out of the loop when it's false.
Follow up: I think you also need to call LTE.deinit() after the detach.
Quick example of the whole thing:
# Detach with state check
if _lte.isattached():
detachTimeoutN = 0
_lte.dettach()
while detachTimeoutN < 10:
if not _lte.isattached():
break
utime.sleep_ms(1000)
detachTimeoutN += 1
# de-initialize the LTE module
_lte.deinit()
That was a good idea but sadly the error still persists even though I correctly detach and deinit the module.
Working on Gpy with Pyscan dev board
Firmware version : (sysname='GPy', nodename='GPy', release='1.20.2.r6', version='v1.11-c5a0a97 on 2021-10-28', machine='GPy with ESP32', pybytes='1.7.1')
I try to run a simple script where I initialize the LTE module, attached it to the network, connect it to the data stream, disconnect it from this data stream, detach the LTE module from the network and finally send the board to a deep sleep. The deep sleep is working well without the LTE code and the LTE code is running correctly. But as soon as I perform LTE action before a deep sleep, the board crash and reboot.
My code:
Complete output logs:
I do not understand this behavior, a bit of help will be appreciated. Thank you!