18.3.1.6 Deep Sleep Mode
In the Deep Sleep mode, the FlexRAM (SRAM) is in the Retention mode (on demand) while the CPU and peripherals (see Table 18-2 for available peripherals as wake-up source) are OFF, and no code is executed.
Deep Sleep Mode Entry
The Deep Sleep mode is entered by performing the following steps:
- Disable all interrupts.
- Set Wireless Subsystem into the Low-Power mode.
- Set the DSEN bit in the DSCON register.
- Enable the Deep Sleep wake-up source (See Table 18-2).
- Check for any pending interrupts and if present, abort Deep Sleep mode and service the interrupt.
- If there are no pending interrupts, then issue a SLEEP/WFI command from the CPU.
To minimize the chance that Deep Sleep is spuriously entered, the SLEEP/WFI command must be issued as the next instruction following the setting of the DSCON.DSEN bit. This sequence can still be interrupted by interrupts and other system latencies but does not prevent the Deep Sleep mode being entered once the SLEEP/WFI command is executed. The DSEN bit is then automatically cleared when exiting the Deep Sleep mode.
Deep Sleep Mode Exit
The Deep Sleep mode exits on any of the following events:
- Device exits Deep Sleep due to a wake-up event.
POR event (de-assertion) on the VDD supply.
DSWDT time-out (if DSWDT is enabled). When the DSWDT timer times out, the Deep Sleep mode will be
exited.
RTCC alarm (if RTCC is enabled).
Assertion (0) of the (MCLR) pin.
- Assertion of the INT0 pin (if the interrupt was enabled before the Deep Sleep mode was entered). The polarity configuration (refer to CFGCON0.INT0P) is used to determine the assertion level (0 or 1) of the pin that causes an exit from the Deep Sleep mode.Note: Any interrupts pending when entering the Deep Sleep mode are cleared, and exiting from the Deep Sleep mode requires a change on the INT0 pin while in the Deep Sleep mode.
- The DSEN bit is automatically cleared.
- Read the Deep Sleep Status bit and clear it.
- Read the DSSEMA1 registers (optional).
When
all state-related configuration is complete, clear the DSSR bit in the DSCON register.- Device releases all held logic and/or I/Os. Until this occurs, the control and data bits for the I/Os have no effects on the actual I/O state.
- Software resumes normal operation.