4 Replies Latest reply on Jan 11, 2016 6:29 AM by userc_4697

    BCM20736 sleep / deep sleep

    LeCa_2156671

      Hi BCM,

       

           We try to test the power consumption of BCM20736S, when it running in sleep or deep sleep mode.

       

      Application I:

           ADV: OFF

           SCAN: OFF

           CONNECTION: none

           TIMER: none

           GPIO: GPIO0 output low, others disabled

           PUART: disable

           PWM: disable

       

           We think the BCM20736 would go to sleep automatically with above configuration.

           But the current in VBAT(3.3V) is as high as 4mA+, seems that, the BCM20736 does not enter the sleep mode after application init.

       

      Application II:

           With the configuration of Application I, we add one function for deep sleep as below:

           Register deep sleep CB function In Application II:      devlpm_registerForLowPowerQueries(devLPM_cb,0);

       

           UINT32 devLPM_cb(LowPowerModePollType type, UINT32 context)

           {

                ble_trace1("low power poll type:%d",type);

                return ~0;

           }

       

           This function does been called by application II, but when we return ~0, the power consumption does not go down. seems that, the BCM20736 does not enter the deep sleep with above function.

       

           Is there any standard applications we could refer to ?? or is there any introduction or user guide documents about sleep / deep sleep controll ??

       

           Sincerely ~~~

        • 1. Re: BCM20736 sleep / deep sleep
          BoonT_56

          The below thread may shed some details.

           

          How to set hello-sensor into power-sleep mode?

           

          Are you doing the measurement on your product board?

          • 2. Re: BCM20736 sleep / deep sleep
            LeCa_2156671

            Hi Boont,

                 Thanks for your share, and we study it carefully.

                 Below we still have the issue of power consumption when set BCM20736 into deep sleep mode.

             

                 We test the power consumption on one BCM20736 module, which is a very simple system. BCM20736 + SPI Flash. There is no any othe components.

             

             

                 We run the standard RTC application with internal clock of 128KHz

            {

              ble_trace0("Entering deep sleep.");

              gpio_configurePin(0, 0, 0x100, 0);

              // Configure the low power manager to enter deep sleep.
              devLpmConfig.disconnectedLowPowerMode = DEV_LPM_DISC_LOW_POWER_MODES_HID_OFF;

              // Configure the wake time in mS.
              devLpmConfig.wakeFromHidoffInMs = HID_OFF_WAKEUP_TIME_NONE;

              // Configure the reference clock to use.

              // Use the external 32k.
              devLpmConfig.wakeFromHidoffRefClk =HID_OFF_TIMED_WAKE_CLK_SRC_128KHZ;           // internal  128KHz

              gpio_configurePin(0, 0, 0x100, 0);

              // Enter deep-sleep now. Will not return.
              devlpm_enterLowPowerMode();
            }

             

                 After BCM20736 enter deep sleep, the current at VPP_3.3  is  90uA.

                 Consider to the spec of BCM20736, the power consuption should be 13uA when internal LPO is in use.

                 Consider to the spec of SPI flash, the power consumption should be 5uA when /CS pin keep high.

                 The theory value of current should ~20uA.

             

                 We do not know which function is still keep running, there is almost 5 times more power consumption !!!

             

                 Could U help us ? Sincerely   tks !!

            • 3. Re: BCM20736 sleep / deep sleep

              try following sample code and see if it helps. create a new app and let it includes following files:

               

              makefile.mak

              #

              # Copyright 2015, Broadcom Corporation

              # All Rights Reserved.

              #

              # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;

              # the contents of this file may not be disclosed to third parties, copied

              # or duplicated in any form, in whole or in part, without the prior

              # written permission of Broadcom Corporation.

              #

               

               

              ########################################################################

              # Application sources.

              ########################################################################

              APP_SRC = rtc_sample.c

               

               

              LIBS += $(DIR)/rtc_ext_api.a

              ########################################################################

              ################ DO NOT MODIFY FILE BELOW THIS LINE ####################

              ########################################################################

              APP_PATCHES_AND_LIBS += rtc_api.a

               

               

               

              rtc_ext_api.h

              #ifndef __RTC_EXT_API_H__

              #define __RTC_EXT_API_H__

               

               

              void rtc_resetRTCCounter (void);

               

               

              BOOL32 rtc_setRTCTime_Ext(RtcTime  *newTime);

               

               

              void rtc_RtcTime2Sec_Ext(RtcTime *rtctime, UINT32 *second);

               

               

              void rtc_setReferenceTime_Ext(RtcTime* ref_time);

               

               

              #endif // __RTC_EXT_API_H__

               

               

              rtc_sample.c

               

              #define RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE

               

               

              #include "bleprofile.h"

              #include "bleapp.h"

              #include "gpiodriver.h"

              #include "string.h"

              #include "stdio.h"

              #include "platform.h"

              #include "bleappconfig.h"

              #include "cfa.h"

              #include "rtc.h"

              #include "bleapputils.h"

              #include "bleapp.h"

              #include "devicelpm.h"

              #include "miadriver.h"

              #include "rtc_ext_api.h"

               

               

              /******************************************************

              *                      Constants

              ******************************************************/

               

               

              /******************************************************

              *               Function Prototypes

              ******************************************************/

              static void rtc_sample_create(void);

              static void rtc_sample_timeout(UINT32 arg);

              static void rtc_sample_fine_timeout(UINT32 arg);

               

               

              /******************************************************

              *               Variables Definitions

              ******************************************************/

               

               

              // Following structure defines UART configuration

              const BLE_PROFILE_PUART_CFG rtc_sample_puart_cfg =

              {

                  /*.baudrate   =*/ 115200,

                  /*.txpin      =*/ PUARTDISABLE | GPIO_PIN_UART_TX /*24*/,

                  /*.rxpin      =*/ PUARTDISABLE | GPIO_PIN_UART_RX /*25*/,

              };

               

               

              /******************************************************

              *               Function Definitions

              ******************************************************/

               

               

              // Application initialization

              APPLICATION_INIT()

              {

                  bleapp_set_cfg(NULL, 0, NULL, (void *)&rtc_sample_puart_cfg, NULL, rtc_sample_create);

              }

               

               

              // Create the RTC sample.

              void rtc_sample_create(void)

              {

                  RtcTime current_time;

                char buffer[64];

               

               

                  ble_trace0("rtc_sample_create()\n");

               

               

                  if (!mia_isResetReasonPor())

                  {

                  ble_trace0("Waking from deep sleep because the timer went off or a GPIO triggered while waiting for timer to expire.");

                  }

                  else

                  {

                  ble_trace0("Not a timed wake.");

                  }

               

               

                  // Always clear interrupts on P39, which is the interrupt pin used by the wake-from-deep-sleep HW block.

                  gpio_clearPinInterruptStatus(GPIO_PIN_P39 / GPIO_MAX_NUM_PINS_PER_PORT, GPIO_PIN_P39 % GPIO_MAX_NUM_PINS_PER_PORT);

               

               

                  blecm_configFlag |= BLECM_DBGUART_LOG;

               

               

                  bleprofile_Init(bleprofile_p_cfg);

               

               

                // If we need to use the external 32K, then configure the reference

                rtcConfig.oscillatorFrequencykHz = RTC_REF_CLOCK_SRC_128KHZ;

               

               

                // Since the 32K external LPO is connected tp P10, P11, P12, P26 and P27,

                // input and putput disable all 5 GPIOs.

              #if 0

                gpio_configurePin(0, 10, GPIO_INPUT_DISABLE, 0);

                gpio_configurePin(0, 11, GPIO_INPUT_DISABLE, 0);

                gpio_configurePin(0, 12, GPIO_INPUT_DISABLE, 0);

                gpio_configurePin(1, 10, GPIO_INPUT_DISABLE, 0);

                gpio_configurePin(1, 11, GPIO_INPUT_DISABLE, 0);

              #endif

                  // Initialize the RTC.

                  rtc_init();

               

               

                  memset(buffer, 0x00, sizeof(buffer));

                ble_trace0("Time base is:");

               

               

                // RtcTime of 0x00 is the start of RTC time.

                  memset(&current_time, 0x00, sizeof(current_time));

                rtc_ctime(&current_time, buffer);

                ble_trace0(buffer);

               

               

                // Let year = 2014.

                current_time.year = 2016;

                // Let month = july = 6 (jan = 0)

                current_time.month = 1;

                // Let day = 1st.

                current_time.day = 18;

                // Let current time be 12:00:00 Noon.

                current_time.hour = 12;

                current_time.minute = 00;

                current_time.second = 0x00;

               

               

                // If this is a power-on reset, we need to set up the reference time.

                if (mia_isResetReasonPor())

                {

                // Now set the on-chip RTC.

                if(rtc_setRTCTime_Ext(&current_time))

                {

                memset(buffer, 0x00, sizeof(buffer));

               

               

                ble_trace0("Power-on reset, set current time to:");

                rtc_ctime(&current_time, buffer);

                ble_trace0(buffer);

                }

                else

                {

                ble_trace0("Unable to set time.");

                }

                }

                else

                {

                // Set up the original reference time instead of using 01/01/2010, 00:00:00 as the reference

                // because this is a wake from deep sleep. The HW clock keeps running in deep sleep so when

                // we wake up, the FW needs to know what was used as the original reference time.

                rtc_setReferenceTime_Ext(&current_time);

                }

               

               

                  bleprofile_regTimerCb(rtc_sample_fine_timeout, rtc_sample_timeout);

                  bleprofile_StartTimer();

               

               

                  // Since we have an external 32 KHz LPO, switch to using this during sleep

                  // because this will give us a more accurate sleep clock (lower drift than the

                  // internal LPO, so the uncertainty window during a receive will be narrower).

                  // In general, base sleep current will be lower too.

                  // Switching to the external 32K with bleapputils_changeLPOSource without having

                  // initialized the RTC, the high-z'ing bonded GPIOs and not having the 32KHz oscillator physically

                  // connected to the chip will invoke undefined behavior.

                  bleapputils_changeLPOSource(LPO_MIA_LPO, FALSE, 500);

               

               

                  // Trace out number of bytes free.

                  ble_trace1("Number of free bytes in RAM: %d",  cfa_mm_MemFreeBytes());

              }

               

               

              // One second timer expired. Read the time from RTC and print.

              void rtc_sample_timeout(UINT32 arg)

              {

                RtcTime current_time;

                UINT32 seconds_since_time_base;

                char buffer[64];

                tRTC_REAL_TIME_CLOCK raw_clock;

               

               

                memset(buffer, 0x00, sizeof(buffer));

               

               

                // Get and print current time.

                rtc_getRTCTime(&current_time);

                ble_trace0("Current date/time is:");

                rtc_ctime(&current_time, buffer);

                ble_trace0(buffer);

               

               

                // Get and print time since time base in seconds.

                rtc_RtcTime2Sec(&current_time, &seconds_since_time_base);

                ble_trace1("Its been %d seconds since bigbang.", seconds_since_time_base);

               

               

                // Get and print the raw 48 bit clock value.

                rtc_getRTCRawClock(&raw_clock);

               

               

                ble_trace2("Upper and lower 32 bit values: 0x%08X, 0x%08X\n", raw_clock.reg32map.rtc32[1], raw_clock.reg32map.rtc32[0]);

               

               

              #ifdef RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE

                {

                static UINT32 num_timeouts_since_boot = 0;

               

               

                // Demo going into deep sleep with wake after 5s.

                if (num_timeouts_since_boot++ >= 10)

                {

                // If its been ~10s of ADV, configure timed wake and

                // enter deep sleep right now.

                ble_trace0("Entering deep sleep.");

               

               

                gpio_configurePin(0, 0, 0x100, 0);

               

               

                // Configure the low power manager to enter deep sleep.

                devLpmConfig.disconnectedLowPowerMode = DEV_LPM_DISC_LOW_POWER_MODES_HID_OFF;

               

               

                // Configure the wake time in mS.

                devLpmConfig.wakeFromHidoffInMs = 5000;

               

               

                // Configure the reference clock to use.

               

               

                // Use the external 32k.

                devLpmConfig.wakeFromHidoffRefClk = HID_OFF_TIMED_WAKE_CLK_SRC_128KHZ;

               

               

                gpio_configurePin(0, 0, 0x100, 0);

               

               

                // Enter deep-sleep now. Will not return.

                devlpm_enterLowPowerMode();

                }

                }

              #endif

              }

               

               

              void rtc_sample_fine_timeout(UINT32 arg)

              {

               

               

              }

              • 4. Re: BCM20736 sleep / deep sleep

                add the lib file.

                1 of 1 people found this helpful