9 Replies Latest reply on Jun 27, 2014 1:06 AM by eyan

    Putting '20732S into sleep or deep sleep mode

    legic_1490776

      I saw a reference to sleep mode and deep sleep mode in another forum post, and I would like to understand how I can make my application enter these modes, and then wake up either after a set time or upon an interrupt.

       

      Are there API calls that I can use to enter a sleep mode, or do I simply need to make sure I have stopped various services to enter sleep?  If so, how do I shut down everything needed to enter sleep?

       

      For deep sleep, how do I enter it and how can I tell that I am coming back out of deep sleep mode?

       

      What 'objects' prevent entering sleep mode, and how can I disable them so that sleeping can proceed?

        • 1. Re: Putting '20732S into sleep or deep sleep mode
          jota_1939431

          Hello Idgirod,

           

          In hello_sensor.c we refer to LPM and call devlpm_init(); - Study this to know how to WAKE on a GPIO.  Enter and exit sleep modes.


          http://community.broadcom.com/message/1667#1667
          – This post has a good summary of sleep and deep sleep under certain BLE
          conditions.


          Look also at WICED-Smart-SDK/Apps/RAM/uart_firmware_upgrade /ws_upgrade_uart.c file where we talk about sleep/deep-sleep modes.

           

          Another important point is that power is automatically managed by the firmware based on input device activity. As a power-saving task, the firmware controls the disabling of the on-chip regulator when in deep sleep mode.

           

          Was this helpful?

           

          JT

           

           

          • 2. Re: Putting '20732S into sleep or deep sleep mode
            legic_1490776

            Hi JT,

             

            Thanks for the pointers.  I was confused about your reference to hello_sensor -- since the main hello_sensor project makes no mention of devlpm_init().  However you must be referring to the hello sensor version within the UART upgrade project!

             

            I have a few more questions:


            1. Power save timeout.  It appears to be the case that if you enable the "power save timeout" feature, it will override the wakeup settings.  That is, in my code I am enabling wakeup from sleep with this:

             

                devlpm_init();

                devlpm_enableWakeFrom(DEV_LPM_WAKE_SOURCE_GPIO);

             

            However if I enable the power save timeout my system no longer wakes up on GPIO interrupts. 

             

            Does the power save timeout do anything else that I would want to replicate in order to save power? 

            What does the power save timeout do other than initialize LPM? 

             

            2. Time spent in deep sleep.  I have figured out that you enter deep sleep by calling

             

                bleprofile_PrepareHidOff()

             

            Is there any way to know how long the system has been in deep sleep, or are the counters and clocks shut down?

             

            3. Overall current draw in different modes.

               Powered at 3V, i've been observing 20 microamps draw in deep sleep mode, and about 55 microamps otherwise when the system is not doing very much.  Are these the numbers you would expect?  Is the 55 microamps figure already in a sleep mode?

            • 3. Re: Putting '20732S into sleep or deep sleep mode
              MichaelF_56

              Lewis,

               

              Is this still an open issue?

              • 4. Re: Putting '20732S into sleep or deep sleep mode
                legic_1490776

                I have found answers to some of my questions:

                 

                1. Power save timeout.  It appears to be the case that if you enable the "power save timeout" feature, it will override the wakeup settings.  That is, in my code I am enabling wakeup from sleep with this:

                 

                    devlpm_init();

                    devlpm_enableWakeFrom(DEV_LPM_WAKE_SOURCE_GPIO);

                 

                However if I enable the power save timeout my system no longer wakes up on GPIO interrupts.

                 

                Does the power save timeout do anything else that I would want to replicate in order to save power?

                What does the power save timeout do other than initialize LPM?

                I don't have an answer for this one.

                 

                2. Time spent in deep sleep.  I have figured out that you enter deep sleep by calling

                 

                    bleprofile_PrepareHidOff()

                 

                Is there any way to know how long the system has been in deep sleep, or are the counters and clocks shut down?

                 

                I don't think ever got a definitive answer on this, but the answer appears to be "no", there is no way to tell the amount of time spent in an hidoff state.  When returning from either deep sleep or timed sleep, there is a way to tell whether you are returning from a sleep state, but I gather there is no way to find out how long you were there, even if you are in a timed sleep that was running a clock / counter during sleep.  If anyone knows differently I would be glad to hear it because currently my design must include an external RTC chip and crystal to address this issue.

                 

                3. Overall current draw in different modes.

                   Powered at 3V, i've been observing 20 microamps draw in deep sleep mode, and about 55 microamps otherwise when the system is not doing very much.  Are these the numbers you would expect?  Is the 55 microamps figure already in a sleep mode?

                 

                These are not numbers that anyone should expect.  Deep sleep should draw 1 or 2 microamps.  You can observe this using the BLE tag kit, although you must be sure to disable the regulator and disconnect the serial USB chip to achieve this.  In my case, the extra 20 microamps was a side effect of a problem with my layout that provided inadequate ground connections.  This caused a lot of other problems as well.  I don't know what might have been the cause, but I suspect that some slight voltage drops under load caused the power circuitry inside the module to misbehave.

                • 5. Re: Putting '20732S into sleep or deep sleep mode
                  eyan

                  I have same issues.

                   

                  First I'd like to get to sleep with timed wakeup (not deep sleep) but it does not seem to work.

                   

                  I add

                  devlpm_init() with change of  devLpmState.oldCsaGetTimeToSleep from 1000 to 2000000.

                  but the power consumption was not decreased.

                  The configuration in BCM20736A1.cgs is set to 1 in Sleep Mode Configuration.

                   

                  When I set the deep sleep mode, then power consumption was down to 20uA.

                  I'm not sure 20uA is due to enabled ADC.

                   

                  What should I do set sleep mode and sleep interval?

                  • 6. Re: Putting '20732S into sleep or deep sleep mode
                    legic_1490776

                    If you are testing using the broadcom tag board, make sure you have the board power in the proper configuration with the chip running off VCOIN, usb cable disconnected, usb serial lines disconnected (all dip switches 'off'), and VREG driven off VUSB.

                     

                    There are a few ways you can get excess current leakage, such as:

                     

                    * back driving the USB converter through the serial lines

                    * running the regulator off the coin cell even if you are not powering the chip through the regulator

                     

                    IIRC, I found that after i had plugged all those leaks i saw 3-6 uA draw when using the LPO for a timed wakeup from deep sleep.

                    • 7. Re: Putting '20732S into sleep or deep sleep mode
                      eyan

                      My board does not go entering sleep mode. Current displays 2~3mA.

                      Only if I set deep sleep mode through bleprofile_prepareHidOff() and devlpm_enterLowPowerMode(),

                      then the current goes down to 20uA.

                       

                      If you set the current 50uA, then I'd like to know how you can set the sleep mode?

                      • 8. Re: Putting '20732S into sleep or deep sleep mode
                        ArvindS_76

                        Which version of the SDK are you using?

                        • 9. Re: Putting '20732S into sleep or deep sleep mode
                          eyan

                          I found the argument of wakeup time in mia_enterHidOff was set as 0.

                          When I change it, then tag board goes to sleep mode.