LoPy with deep sleep shield is unstable
I have a LoPy with the deep sleep shield.
The device does some UART communication with a sensor and sends data over LoRa, then goes to sleep, wakes up and repeats.
The LoPy goes to sleep and wakes after the defined time with the go_to_sleep(<seconds>) command. I save the lora state with lora.nvram_save() and retrieve it after waking with lora.nvram_restore(). All is well and i receive LoRa messages on the gateway.
This works for about 25 times, then the device is frozen. I'm assuming it can't be a memory issue because the device reboots after waking up. This was not the case before i added the deep sleep shield and code.
Any suggestions what could be the cause?
How do i even go about debugging this?
@Robin after how many cycles did you see this? I left it running the whole night without a single failure. The brown-out detect is normal when entering deepsleep mode. If it doesn't even go into REPL is because it never wakes up. Can you measure the power on the 3V3 pin of the LoPy when this happens?
The instability has been fixed here: https://github.com/pycom/pycom-libraries/commit/ea3e22c14884671801bcd1cfe49c703bc63c7078
We are now working on reducing the deep sleep current.
I had the same issue and solved it by using the garbage collector before sending the LoPy to sleep:
import gc from deepsleep import DeepSleep # enabling garbage collector gc.enable() # deep sleep ds = DeepSleep() # ... bunch of code ... # sending the LoPy to sleep gc.collect() ds.go_to_sleep(60)
Hope it helps!
@daniel Thank you Daniel !
My code is here: https://github.com/puthli/meet-de-klas/tree/Enable-deep-sleep-shield/micropython
Yesterday I power cycled the device and it started again. But today it had stopped after 42 cycles of deep sleep and waking.
The device is connected to a permanent usb power source to make sure there was not a battery issue (i have not measured the deep sleep current yet, and there seems to be no concrete evidence on actual power consumption in deep sleep mode yet).
My program connects to TTN with OTAA on 868 Mhz (EU).
Come on pycom! Buggy deep sleep mode is cancelling out a whole range of news-worthy use-cases right now.
Can any of the pycom guru's provide a script they know works for weeks with deep sleep enabled? Not having found any evidence of successful long term use i am dubious it actually works. Just a hello world blinky example would a good starting point.
I noticed that just before going into deep sleep mode the REPL command line says "Browno". I assume that should be "Brownout". Which leads me to think there is some component that is not switched off before sleeping. WiFi perhaps or the LoRa chip? Or completely unrelated?
At present i see the following options:
- Try and debug the deep sleep library (painful and not looking likely in the near future)
- Try and debug the deep sleep shield (not in my field of expertise)
- Move to another platform like MBed or Arduino.
Any suggestions are more than welcome!
@Robin You can see all is all abput here
@Robin My lopy do same, after 14-15 deepsleep cycles program program is intrerupt and this is it . Must do hard reset to start again.
@daniel did few think in DeepSleep library but... lopy still stop program after deepsleep
I use lopy with deepsleep shield , with *.b3 frimware , configured for lorawan APB and powered from USB