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

    Use pin_wakeup_sleep with different pins and wakeup reasons

    Scheduled Pinned Locked Moved LoPy
    lopy4deepsleepdeepsleep wake
    4 Posts 3 Posters 36 Views 3 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.
    • D Offline
      d.alvrzx
      last edited by d.alvrzx

      I have 2 different pins that must wake up my LoPy4 from deepsleep. One of them is P14 and it must wake up when value goes LOW. The other is P23 and it must wake up when value goes HIGH.

      I thought I could just do:

      machine.pin_sleep_wakeup(['P14'], mode=machine.WAKEUP_ALL_LOW, enable_pull=False)
      machine.pin_sleep_wakeup(['P23'], mode=machine.WAKEUP_ANY_HIGH, enable_pull=False)
      

      And that would achieve the behaviour I described. Unfortunately, when doing this, it seems the first instruction is overwritten, so only P23 is able to wake the device up, not P14.

      Since each pin wakes up the device with different values (HIGH and LOW), I cannot write this in only 1 instruction... Any ideas?

      Running 1.20.2.rc6 fw.

      1 Reply Last reply Reply Quote 0
      • D Offline
        d.alvrzx
        last edited by

        Following up on this, it seems this post confirms mi suspicion that a second call to pin_sleep_wakeup() overwrites previous calls: https://forum.pycom.io/topic/5716/how-to-wake-up-the-lopy-with-the-accelerometer/5?_=1626977858609

        @Gijs do you know if this a HW limitation of the ESP32 or could this functionality be added by modifying the firmware?

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

          You can add both pins in the same tuple, but I believe you cannot select both modes at the same time, even if you set it for different pins, as you mentioned, the second command overrides the first, and I think it is not possible on the hardware level.

          1 Reply Last reply Reply Quote 1
          • J Offline
            jcaron @d.alvrzx
            last edited by

            @d-alvrzx the ESP32 has various sleep modes with various possibilities for wake up sources. The lowest power modes are indeed quite limited by design. IIRC the Pycom firmware uses ext1 wake up. You’ll find details of the different wake up sources of the ESP32 in the ESP IDF docs: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/sleep_modes.html

            1 Reply Last reply Reply Quote 1

            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