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

    Light sleep: crash on wakeup

    Scheduled Pinned Locked Moved LoPy
    2 Posts 1 Posters 38 Views 1 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.
    • J Offline
      Jean-François Milants
      last edited by

      Hi!

      I'm working on a project using a Lopy (wifi/ble/lora) board. The board is a bit old, but I upgraded the firmware yesterday (1.20.2.r1).

      I would like to put the Lopy into light sleep (maybe deep sleep later) and wake it up every 1 minutes or when a button is pushed.
      The button is connected on P23 (G10 on the base board) and GND.

      Here is my code:

      import pycom
      from machine import Pin
      import machine
      
      pycom.heartbeat(False)
      
      print("Initializing input pin...")
      p_in = Pin('P23', mode=Pin.IN, pull=Pin.PULL_UP)
      machine.pin_sleep_wakeup(['P23'], machine.WAKEUP_ALL_LOW, True)
      
      print("Entering main loop...")
      while True:
          print("RUN")
          machine.sleep(60000)
          print("WAKE")
      

      It works fine when I run the file interactively using Pymakr, but it doesn't work when I upload the file to the lopy, and reset it to run it at boot : it crashes and reboots every time it wakes up (either after 60s or when I push the button):

      Initializing input pin...
      Entering main loop...
      RUN
      Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.
      Core 0 register dump:
      PC      : 0x40095eb3  PS      : 0x00060e33  A0      : 0x80088f34  A1      : 0x3ffb7130  
      A2      : 0x00000000  A3      : 0x00060e20  A4      : 0x00000001  A5      : 0x0000cdcd  
      A6      : 0xb33fffff  A7      : 0x3ffdc6f4  A8      : 0x0000abab  A9      : 0x3ffb7130  
      A10     : 0x00000003  A11     : 0x0000cdcd  A12     : 0x00060e20  A13     : 0x00000000  
      A14     : 0x3ffb2740  A15     : 0x3ffb2d91  SAR     : 0x00000000  EXCCAUSE: 0x0000001d  
      EXCVADDR: 0x00000000  LBEG    : 0x40092cd4  LEND    : 0x40092d02  LCOUNT  : 0xffffffff  
      
      ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000
      
      Backtrace: 0x40095eb3:0x3ffb7130 0x40088f31:0x3ffb7160 0x40086d09:0x3ffb7180 0x401432c6:0x3ffb71c0 0x400d249c:0x3ffb71e0
      
      ================= CORE DUMP START =================
      7DMAAAEAAAAPAAAAbAEAAA==
      fHL7P3Bw+z90cvs/
      << GARBAGE >>
      

      Do I need to do something special to make it work correctly?

      Thanks!

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        Jean-François Milants @Jean-François Milants
        last edited by

        I've just changed the version to Pycom MicroPython 1.20.0.rc13 [v1.9.4-94bb382] on 2019-08-22; LoPy with ESP32 (legacy firmware) and light sleep works as expected. I'm not sure I understand the difference between different driver types, but I don't use pybyte, so it should be ok.

        Could it be a bug in the pybyte firmware?

        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