You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
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:
import machine
from network import LTE
_lte = LTE()
def attach_lte(lte):
if not lte.isattached():
print("Attaching to LTE network ", end='')
lte.attach(apn="sunrise.internet", type=LTE.IPV4V6)
while(True):
if lte.isattached():
print(" OK")
break
print('.', end='')
time.sleep(1)
if not lte.isconnected():
print("Connecting on LTE network ", end='')
lte.connect()
while(True):
if lte.isconnected():
print(" OK")
break
print('.', end='')
time.sleep(1)
try:
_lte.reset() # reset LTE module
print("OK")
time.sleep(1)
attach_lte(_lte) # attach LTE module to the network and connect to data stream
print("LTE work")
_lte.disconnect() # disconnect LTE module from the data stream
print("OK")
time.sleep(1)
print("Detaching LTE ... ", end='')
_lte.dettach() # detach LTE module from network
print("OK")
time.sleep(5)
print("Sleep mode...")
machine.deepsleep(1000*10) # enter deepsleep mode for 10 sec
finally:
print("Finished")
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()
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!
The text was updated successfully, but these errors were encountered: