eXtreme Low Power - XLP

Deep Sleep

Deep Sleep is the lowest power sleep mode for Microchip's MCUs and DSCs. This mode is intended to extend battery life by minimizing power consumption during inactive periods.

In Deep Sleep mode, the system clock source and all the peripherals except the Real Time Calendar Clock (RTCC) and Deep Sleep Watchdog timer (DSWDT) are disabled. In devices with XLP technology, the DSWDT and RTCC have their own independent clock sources.

Deep Sleep mode can be entered with the option of retaining the contents of the memory. If this retention option is used, all the memory content is retained and execution resumes at the instruction, immediately following the Sleep command. If the retention option is not used, only the two Deep Sleep Retention registers (DSGPR0 and DSGPR1) are maintained. All other memory is lost. Exiting Deep Sleep mode without the retention option causes the MCU to begin executing at the reset vector.

Mode System Clock How Much Memory
is Maintained
Exit Location
Deep Sleep
With Retention
OFF 100% Next Instruction
Deep Sleep
Without Retention
OFF Two Registers Reset Vector

Deep Sleep mode is not available on all 16-bit MCUs and DSCs. Only devices with Microchip's eXtreme Low Power (XLP) technology support it. Please consult the datasheet of the device you are using to ensure the support of Deep Sleep mode.

Entering Deep Sleep Mode Without Memory Retention Set

To enter Deep Sleep mode without memory retention, the following sequence must occur:

  • The Deep Sleep Enable (DSEN) bit in the Deep Sleep Control register DSCON must be set.
  • Executing the SLEEP instruction with one to three instruction cycles of setting DSEN.

In order to minimize the possibility of inadvertently entering Deep Sleep mode, the DSEN bit is cleared in hardware after five instruction cycles have elapsed. In order to enter Deep Sleep mode, the Sleep instruction must be executed within one to three instruction cycles after setting DSEN. If DSEN is not set when the Sleep instruction is executed, the device will enter conventional Sleep mode instead.

To further minimize the possibility of inadvertently entering Deep Sleep mode, to set a bit in the Deep Sleep Control register, the write instruction MUST be executed twice. This is referred to as the Repeat Sequence.

If the appropriate INC file in .included:

BSET DSCON DSEN
NOP Writes to the DSEN bit do not need
NOP To be sequential (back-to-back)
BSET DSCON DSEN

PWRSAV #SLEEP_MODE;

The MPLAB® XC16 C Compiler has no pre-defined macros for entering Deep Sleep mode with or without memory retention.

Entering Deep Sleep Mode With Memory Retention

Deep Sleep mode with memory retention requires the use of the on-chip Low Voltage Regulator (LVR) which is controlled by the LPCFG/LVRCFG configuration bit (also designated as LVRCFG in some devices) and the Low Voltage Enable bit (RETEN/LVREN) Reset and System Control Register (RCON). The LPCFG/LVRCF configuration bit makes the LVR available to be controlled by RCON.

With the configuration bits set to enter Deep Sleep mode with memory retention, the following ordered sequence of events must occur:

  • The Low Voltage Regulator Enable bit (RETEN/LVREN) in the Reset and System Control Register (RCON) must be set.
  • The Deep Sleep Enable (DSEN) bit in the Deep Sleep Control register (DSCON) must be set. (Setting DSEN requires the write instruction to be executed twice.)
  • Executing the Sleep instruction with one to three instruction cycles of setting DSEN

If the appropriate INC file in .included:
BSET RCON LVREN

BSET DSCON DSEN
NOP Writes to the DSEN bit do not need
NOP To be sequential (back-to-back)
BSET DSCON DSEN

PWRSAV #SLEEP_MODE;

The MPLAB® XC16 C Compiler has no pre-defined macros for entering Deep Sleep mode with or without memory retention.

Exiting Deep Sleep Mode

The device can be awakened from Deep Sleep modes by any of the following:

  • Master Clear (MCLR) event
  • Power-On Reset
  • RTCC alarm
  • INT0 interrupt
  • I/O pin interrupt
  • DSWDT event

The software can determine the wake-up event source by reading the DSWAKE register. The content of DSWAKE is cleared by hardware when entering Deep Sleep mode, so the software can read this register any time after waking up.

The application software may need to check DSGPR0 and DSGPR1 to verify what steps need to be accomplished in order to restore the state of the system.

Does the Retention Mode Of Deep Sleep Always Use More Power?

When calculating total power consumption (Ptotal), one must add the power consumed in the Active state (Pactive) to the power consumed in the Sleep State (Psleep).

Ptotal = Pactive + Psleep

Deep Sleep without memory retention will always use less Psleep but may not use less total power. Waking up at the reset vector requires the MCU to execute more instructions than waking up at the next instruction. The extra power used during the wake-up period of non-retained Deep Sleep can offset the lower Psleep if the interval between the wake-up events is too short. When using the Deep Sleep mode, check your total power usage and sleep intervals before you forgo retaining the memory.

 Learn More

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.