Does deepsleep work at all



  • I am working with the SiPy board with extension board. A very simple setup - boot without any wifi commands (seems to boot wifi anyway?)
    read sensor values using uart commands
    use s.send(xxx) to send via sigfox
    deep.sleep (600000) = 10 min.
    It is powered through USB.
    Has any one any succes with deepsleep? I know about the power issues - but I am currently more concerned about the stability of the function. For me it wakes up and runs boot.py - and not as stated in the "getting started" - in the main script. This runs around 5-8 times and then stops. It might be in the main.py - but surely a lot of wifi stuff is going on every time it wakes up.

    Anyone had succes with deepsleep? Just a simple setup.

    Best regards, Adam



  • @daniel The result is the same. Stops after (5 - 20) cycles. How do i run in more verbose way? There is no error, it's jumps into REPL.



  • @chumelnicu Hi Daniel, sorry for late update but i was in holliday until yesterday.

    I did try deepsleep with new DeepSleep library and llopy behive same. After 14-15 DS cycles program stop running.

    I use lopy with DS Shield powered from USB and nothing on Pin12.
    Condition to wake up, is time, w-up after 10 minutes.
    Do u have any ideea what is wrong?

    Thx !



  • @daniel said in Does deepsleep work at all:

    Do you have a pull-down on P17?
    I have plugged the P17 and GND to have an option to wakeup (with normally close switch) and set ds.enable_wake_on_raise('P17').

    Now tested "without plugging P17 with GND".
    Running the example from documentation:

    ...
    ds.enable_pullups('P17')  # can also do ds.enable_pullups(['P17', 'P18'])
    ds.enable_wake_on_fall('P17') # can also do ds.enable_wake_on_fall(['P17', 'P18'])
    ...
    

    With same result as before it runs 5 cycles and ends.

    At home i don't have any resistor i will let you know tomorrow.


  • administrators

    @tmz Do you have a pull-down on P17? I think what is happening is that noise is waking up the deepsleep shield before it gets to turn off the LoPy completely. Please try putting an external pull-down to P17 and disabling the internall pull-up with the deepsleep library.



  • @daniel
    I make now the execution
    Deep sleep ends after 4 cycles.

    LoPy on Expansion board with "DeepSleep Shield"
    Firmware version: 1.7.9.b1

    deepslep.py latest: https://github.com/pycom/pycom-libraries/commit/074bc7ee0181451720bbeb30d627debafc617ad8

    Run 60 seconds deepsleep interval.

    Output:

    MicroPython v1.8.6-740-g5b756011 on 2017-08-07; LoPy with ESP32
    Type "help()" for more information.
    >>>
    >>>
    >>> ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    ets Jun  8 2016 00:22:57
    
    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff9010,len:12
    ho 0 tail 12 room 4
    load:0x3fff9020,len:388
    load:0x40078000,len:11584
    load:0x4009fb00,len:848
    entry 0x4009fc9c
    
    ****DEEP SLEEP MODE****
    
    Do sem work for 3 seconds
    End work go deep sleep for 1min
    
    Brownets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    ets Jun  8 2016 00:22:57
    
    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff9010,len:12
    ho 0 tail 12 room 4
    load:0x3fff9020,len:388
    load:0x40078000,len:11584
    load:0x4009fb00,len:848
    entry 0x4009fc9c
    
    ****DEEP SLEEP MODE****
    
    Do sem work for 3 seconds
    End work go deep sleep for 1min
    
    Brownets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    ets Jun  8 2016 00:22:57
    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff9010,len:12
    ho 0 tail 12 room 4
    load:0x3fff9020,len:388
    load:0x40078000,len:11584
    load:0x4009fb00,len:848
    entry 0x4009fc9c
    
    ****DEEP SLEEP MODE****
    
    Do sem work for 3 seconds
    End work go deep sleep for 1min
    
    Brownets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    ets Jun  8 2016 00:22:57
    
    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff9010,len:12
    ho 0 tail 12 room 4
    load:0x3fff9020,len:388
    load:0x40078000,len:11584
    load:0x4009fb00,len:848
    entry 0x4009fc9c
    
    ****DEEP SLEEP MODE****
    
    Do sem work for 3 seconds
    End work go deep sleep for 1min
    MicroPython v1.8.6-740-g5b756011 on 2017-08-07; LoPy with ESP32
    Type "help()" for more information.
    >>>
    >>>
    


  • @daniel Yes, executing go_to_sleep() some cycles works and than at one point it's not enter into deep sleep mode.

    Do you have anything connected to P12?
    Nothing connected to P12.

    For debugging i was running connected over "Serial" to see what happens and for some time (cca. 5 - 20 cycles) works normally and then without errors enters into REPL.

    code:

        # Setup deep sleep mode
        ds = DeepSleep()
        ds.enable_wake_on_raise('P17')
        # Some work here
        ds.go_to_sleep(60)
    

  • administrators

    @tmz what you say is that after calling the go_to_sleep() the deepsleep shield doesn't put the LoPy to sleep?



  • @daniel The deep sleep works! But then at one point without any error it's not entering into next deep sleep cycle instead is enter into REPL.


  • administrators

    @tmz so it simply goes out to the REPL without running your code? Do you have any condition in your code that could cause that (exit the script instead of going into deepsleep)? Do you have anything connected to P12? Maybe at some point the board is booting into safe mode...



  • @daniel I have issue with "deepsleep shield" and LoPy. It's stops after cca. 20 cycles. Same if added the "exception" block to calibrate method.
    Running over serial the cycle ends into REPL and without error.



  • @daniel I am using the deep sleep shiled with lopy in breadboard (without expansion) by powering with 5V. The consumption is 500uA. Isn't it high? I thought it will be below 50uA.


  • administrators

    @athtest800 are you talking about the Pysense or the deepsleep shield?



  • @Camot
    Have you fixed the 0.4mA consumption during deep sleep?



  • This post is deleted!


  • @daniel I will try and feedback tonight

    Thx @daniel


  • administrators

    Hello,

    While we find out why sometimes less calibration pulses are received, please use the new library that has a try-except block around the calibration:

    https://github.com/pycom/pycom-libraries/commit/074bc7ee0181451720bbeb30d627debafc617ad8



  • @this.wiederkehr Ok .. maybe you right but this is beyond me , I think is beter to wait for @daniel and @bucknall opinion or fix solution.

    Thank you very much @this-wiederkehr



  • @chumelnicu said in Does deepsleep work at all:

    dont know how to do that. Can you tell me the code line who is supouse to fix that ?
    Than you ! :)

    Exchange the calibration function in deep_sleep.py with the following one, take care on the indentation (sorry I dont have a board at my hand to test right now, so use at your own risk :-)
    That is not a fix, that is a hack to catch an error (which should not be there in the first place) and retry the calibration procedure ...

    def calibrate(self):
        """ The microcontroller will send the value of CTRL_0 after setting the bit
            and then will send the following pattern through the data line:
               val | 1 | 0 | 1*| 0 | 1*| 0 | 1
               ms  | 1 | 1 | 1 | 1 | 8 | 1 | -
            The idea is to measure the real life duration of periods marked with *
            and substract them. That will remove any errors common to both measurements
            The result is 7 ms as generated by the PIC LF clock.
            It can be used to scale any future sleep value."""
    
    
        while True:
            try:
                # setbits, but limit the number of received bytes to avoid confusion with pattern
                self._magic(CTRL_0_ADDR, 0xFF, 1 << 2, 0, 7)
                self.uart.deinit()
                Pin(COMM_PIN, mode=Pin.IN)
                pulses = pycom.pulses_get(COMM_PIN, 50000)
                self.uart = UART(1, baudrate=10000, pins=(COMM_PIN,))
                self.clk_cal_factor = (pulses[3][1] - pulses[1][1]) / EXP_RTC_PERIOD
                break
            except IndexError:
                print('calibration failed')
        if self.clk_cal_factor > 1.25 or self.clk_cal_factor < 0.75:
            self.clk_cal_factor = 1
    


  • This post is deleted!

Log in to reply
 

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