Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy with deep sleep shield is unstable

    Scheduled Pinned Locked Moved Issues & Bugs
    deep sleephangsdeepsleep
    12 Posts 4 Posters 4.3k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      Robin
      last edited by Robin

      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?

      C 2 Replies Last reply Reply Quote 0
      • C Offline
        chumelnicu @Robin
        last edited by

        @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

        1 Reply Last reply Reply Quote 0
        • C Offline
          chumelnicu @Robin
          last edited by

          @Robin You can see all is all abput here

          https://forum.pycom.io/topic/1083/does-deepsleep-work-at-all

          1 Reply Last reply Reply Quote 1
          • R Offline
            Robin
            last edited by

            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:

            1. Try and debug the deep sleep library (painful and not looking likely in the near future)
            2. Try and debug the deep sleep shield (not in my field of expertise)
            3. Move to another platform like MBed or Arduino.

            Any suggestions are more than welcome!

            1 Reply Last reply Reply Quote 0
            • D Offline
              daniel
              last edited by

              @Robin @chumelnicu apologies for the delay. We will check on this issue today and provide a solution within the next couple of days.

              R C 2 Replies Last reply Reply Quote 0
              • R Offline
                Robin @daniel
                last edited by

                Thanks @daniel
                My code is here: https://github.com/puthli/meet-de-klas/tree/Enable-deep-sleep-shield/micropython

                1 Reply Last reply Reply Quote 0
                • C Offline
                  chumelnicu @daniel
                  last edited by

                  @daniel Thank you Daniel !

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jojo
                    last edited by jojo

                    Hi,

                    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!

                    1 Reply Last reply Reply Quote 1
                    • D Offline
                      daniel
                      last edited by

                      Hello,

                      The instability has been fixed here: https://github.com/pycom/pycom-libraries/commit/ea3e22c14884671801bcd1cfe49c703bc63c7078

                      We are now working on reducing the deep sleep current.

                      Cheers,
                      Daniel

                      R 1 Reply Last reply Reply Quote 1
                      • R Offline
                        Robin @daniel
                        last edited by

                        Hi @daniel
                        Thanks for the all nighter!
                        I have installed the new deepsleep.py but it introduces a new worse problem. The board goes into deepsleep mode, but when it wakes i see "Brownout detect" in the console and then the program quits without returning into REPL.

                        Any ideas?

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          daniel
                          last edited by

                          @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?

                          R 1 Reply Last reply Reply Quote 0
                          • R Offline
                            Robin @daniel
                            last edited by

                            @daniel the failure is on the first wake-up. I don't have a multimeter handy, but can do that this evening.

                            I added @jojo suggestion and the board wakes now. I have left it in a sleep wake cycle and will see how long it runs.

                            1 Reply Last reply Reply Quote 0

                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                            With your input, this post could be even better 💗

                            Register Login
                            • 1 / 1
                            • First post
                              Last post

                            Pycom on Twitter

                            Pycom