RevisionChange DecriptionDate
1.0Initial06/22/14

Hello Community Members,

 

This BLOG should be used as a "guide" for examining Sleep and Deep_Sleep techniques.

This is a compilation of Sleep and Deep Sleep questions and answers from several of our forum users and I thank you for your questions and answers.

 

Let's start out with a explanation of how to place the BCM2073x in Sleep and Deep_Sleep modes and then move to sample Q/A regarding a few use cases.

 

Sleep Deep_Sleep Modes:

 

Here's a list of the Sleep/Deep Sleep modes:

 

  • Pause
    • The processor is idle if sleep is not allowed or there is not enough time to sleep due to processor or BLE Radio Activity
    • All state information is maintained
    • Near 0 cycle latency to wake up
  • Sleep
    • When lower power consumption is required
    • All state information is maintained
    • Can be woken up by timer or GPIO/ Keyscan /Quadrature sensors
    • About 2 mS latency to wake up
  • Deep Sleep
    • No state information is maintained
    • Can be woken up by GPIO/ Keyscan /Quadrature sensors
    • Includes ability to wake after configured time
      • With internal clock, can wake anywhere from 64mS to ~36 Hrs.
      • With external 32 KHz xtal, 128mS to ~144 Hrs

 

Deep_Sleep: Known on the BCM2073x devices as HIDOFF (Taken from the Human Interface Device OFF mode from Classic Bluetooth.

 

 

Waking the Device:

 

  1. Wake by GPIO:
  2. Note that there are 14 GPIOs on the module and most can drive/sink up to 2mA and are capable of waking device from sleep or deep sleep.
  3. All GPIO interrupts are serialized to the application thread.
  4. If the device is sleeping, the latency to get to the application thread context interrupt handler will generally be under 3mS.
  5. If not sleeping and not connected, then this will be of the order of a few tens of uS.
  6. In addition, there are multiple low power modes, and in many cases the firmware automatically handles low power states (as mentioned previously).
  7. The application may choose to participate in sleep and deep sleep decisions.

 

Permanently Disable Sleep

 

  1. To permanently disable sleep, register a callback using devlpm_registerForLowPowerQueries() and then in the callback, always return 0.
  2. For an example, see ws_upgrade_uart.c in uart_firmware_upgrade sample application.
  3. Note that this will drain more power than when sleep is enabled.

 

 

Notes regarding HidOff:

 

Deep_Sleep (HIDOFF) is not supported while the connection is up.

 

However, a connection can be kept when sleep is enabled (but not when deep sleep engages).

 

When the device is connected/scanning/advertising, it will always sleep between RF activity if the application allows it and there is sufficient time before the next scheduled activity.

 

Deep_Sleep (HIDOFF) does not retain state, so the chip cannot enter deep sleep when connected.

 

The most important point in determining Sleep and Deep Sleep modes is when to do it:

 

In many of our SDK 2.0 examples, 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 - More on this later.

 

This BITES everyone - Be careful:

 

The BCM20732A0.cgs file has a Low Power Configuration section:

 

By default:
"Sleep enable" = 1

Change to 0 to disable the sleep function.


################################################################################
#  Low power configuration
###############################################################################
ENTRY "Sleep Mode Configuration"
{
    "Sleep mode" = "HIDD"
    "Sleep enable" = 1 ; Change to 0
}
##############################################################################

 

Sleep Current Consumption is roughly 24uA using the internal power management of the BCM20732.

 

In 1.5uA deep sleep, the xtal, IR and PWM blocks will be turned off.

 

The PWM does not operate in sleep or in deep sleep, and the PWM block is not capable of interrupting or waking up the processor.

 

GPIOs, peripheral uart, IR transmit, Keyscan and quadrature inputs can interrupt/wake the processor.

 

GPIOs that are output enabled will remain so and drive as configured in sleep/deep sleep.

 

Sleep operation in BLE Packet Transmissions:

 

Q: When sending packets periodically for BLE (e.g. 25 ms to 4 seconds), does the BLE stack put the 20732 in 1.5 uA deep sleep mode between the transmissions or is just the sleep mode (20+ uA)?

 

A: No, when advertising or in connection, the device will not go into deep sleep. However, it will go into other low power modes like sleep and pause based on the connection/ADV interval and other activities. If you want to ADV every few minutes, it is possible to ADV for some seconds, then configure timed wake from deep sleep and then enter deep sleep. After the configured time, the device will be woken up and then the application will be initialized.

 

Q: In deep sleep mode, the data sheet says core and base are turned off. Does that mean it loses the RAM contents? If so, where does application software store state information when it goes into deep sleep? The EE or an offboard chip?

 

A: Yes, in deep sleep the chip will lose its RAM contents. When woken up, the application will be loaded to RAM from the NV storage and re-initialized. This is very similar to a power-on-reset except that in the case of a wake from deep sleep, some HW state information is retained so that the application can find out what caused the wake.

 

Sleep Times:

 

Our BCM2073x device includes the ability to wake after configured time.

 

With the internal clock, this value is anywhere from 64mS to ~36 Hrs.

With an external 32 KHz xtal, 128mS - ~144 Hrs is possible.

 

PREVENTING THE DEVICE FROM GOING TO SLEEP WHEN USING THE P_UART:

 

If you are working with the PUART and in particular trying to Rx data with the PUART you will need to ensure that the following functions shown below are added into your PUART_Init() function.

 

You will also see these functions in the 'uart_firmware_upgrade' example.

 

The reason these are needed is otherwise the Device will put the PUART to sleep.

 

These functions disable the device from putting the PUART to sleep:

 

Put these inside of your PUART_Init() function devlpm_init();

 

// Since we are not using any flow control, disable sleep when download starts.

// If HW flow control is configured or app uses its own flow control mechanism,

// this is not required.

devlpm_registerForLowPowerQueries(Puart_device_lpm_queriable, 0);

//Callback function that is registered from function shown above:

devlpm_register...()

// Callback called by the FW when ready to sleep/deep-sleep. Disable both by returning 0

// when there is an active download ongoing.

UINT32 Puart_device_lpm_queriable(LowPowerModePollType type, UINT32 context)

{

// Disable sleep.

return 0;

}

 

 

Wake time from deep sleep:

 

Determination of Wake time from deep sleep is a combination of many factors:


Since this involves a full boot, it depends on whether you are using the BCM20732S/36S modules or BCM2073x SOC design, EEPROM or Serial flash (application + patch size), speed of NV access.

 

20732S modules:

 

The 20732S contains an EEPROM internally:

Boot Time: boot time* ~= 50ms + ~45mS/KByte of application + patch code (whats printed at the end of a build) assuming default I2C speed (400 KHz).

 

The 20732 chip-on-board design:

 

EEPROM Case:

You can increase the read speeds to 1MHz instead of the default 400 KHz.
But the boot time will not reduce by 2.5 times because there is a lot of processing involved during this process.
So this will be 50mS + ~30mS/KByte of app + patch code.

 

Serial FLASH Case:
When NV storage is serial FLASH, boot time ~= 50mS + 4mS/KByte of code.

 

BCM20736/7 modules:

 

EEPROM Case:

boot time ~= 20mS + ~35mS/KByte of app + patch code @ 400 KHz.
If I2C speed is increased to 1 MHz, this should be ~ 20mS + 23mS/KByte.

 

Serial FLASH Case:

boot time ~= 20mS + 900uS/KByte when SPI speed is 12 MHz.


Note: *boot time here is the time from wake interrupt to application create call.

 

 

Advertising and Sleep Modes:

 

When advertising (ADV) or in connection, the device will not go into deep sleep.

 

However, it will go into other low power modes like sleep and pause based on the connection/ADV interval and other activities.

 

If you want to ADV every few minutes, it is possible to ADV for some seconds, then configure timed wake from deep sleep and then enter deep sleep.

 

After the configured time, the device will be woken up and then the application will be initialized.

 

Crystal and Sleep:

 

The external 32KHz oscillator is optional with respect to timed wake from deep sleep.

 

The internal 128KHz LPO is used for sleep and timed wake from deep sleep

 

More later..

 

Please provide comments/questions

 

Thanks

 

JT