Interrupt wakeup from deepsleep



  • Hi everyone,

    As I understand it to put my lopy to deepsleep with the pysense/pytrack boards, I have to use the respective board libraries. For example: pytrack.setup_sleep() and pytrack.go_to_sleep() and not machine.deepsleep(). But opposed to the machine.deepsleep() I cant find any way to wakup from deepsleep with a hardware interrupt yet. I need to wakeup my devices with a raising edge from an input pin. Has anyone done this? Or is this something that is still missing in the current releases?

    Best,
    Chris



  • @livius said in Interrupt wakeup from deepsleep:

    Pin('P10', mode=Pin.IN, pull=Pin.PULL_DOWN)

    I also wondered how deep sleep with pysens and pytrack works, so I tested this myself:

    During deep_sleep the pyboard is not power at all! So basically the PIC of the pysens or pytrack does disconnect the supply voltage from the pyboard! The only thing which ever is able to wake the pyboard is the PIC. I guess the intention of pycom here is to provide a "software" solution which will make the PIC aware of selected interrupts. Of course this is limited to the interrupts which are physically routed to the PIC.
    So you likely have to wait for pycom to come up with their software solution till this is going to work ...



  • @dbrgn
    what if you add first

    p_in = Pin('P10', mode=Pin.IN, pull=Pin.PULL_DOWN)
    


  • @livius said in Interrupt wakeup from deepsleep:

    @cfaessler
    I didn't tried wake up by pins yet. Then the best is trying it self. I am interested about results :)

    Alright. With this code:

    import pycom
    import utime
    import machine
    from lib.pysense import Pysense
    
    py = Pysense()
    
    pycom.rgbled(0xff00ff)  # pink
    utime.sleep_ms(1000)
    
    machine.pin_deepsleep_wakeup(['P10'], mode=machine.WAKEUP_ANY_HIGH, enable_pull=True)
    py.setup_sleep(10)
    
    pycom.rgbled(0xff0000)  # red
    utime.sleep_ms(2000)
    
    py.go_to_sleep()
    

    ...the board should sleep for 10 seconds, with a way to wake it up with 3.3V on the P10 pin. I just tried it and it doesn't work. (Makes sense, since the pysense library probably controls different hardware than the machine module.)



  • @cfaessler
    I didn't tried wake up by pins yet. Then the best is trying it self. I am interested about results :)



  • @livius thank you. But does this also work when i use the pysense board librarie's deepsleep mode and not the machine.deepsleep mode?





Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.