Jump to main content

##

# 3.7.17 Power Manager (PM)

The Power Manager (PM) controls the sleep modes of the device. There are two main types of sleep modes available:

- Idle sleep mode: The CPU stops executing code, no peripheral are disabled. All interrupt sources can wake up the device

- Standby sleep mode: The user can configure peripherals to be enabled or not using the respective RUNSTDBY bit. This means that power consumption is highly dependent on what functionality is enabled.

## Using The Library

The power manager peripheral library provides API to enter Idle Sleep mode and Standby Sleep mode.

Idle Mode:

The IDLE mode allows power optimization with the fastest wake-up time.

The IDLE is entered by executing the Wait For Interrupt (WFI) instruction with IDLE written to the Sleep Mode bit group in the Sleep

Configuration register (SLEEPCFG.SLEEPMODE written to 0x2). The device will exit IDLE when it detects any non-masked interrupt.

Standby Mode:

Standby mode is the lowest power configuration while keeping the state of the logic and the content of the RAM. Standby mode is entered by executing the WFI instruction with STANDBY written to the Sleep Mode bit group in the Sleep Configuration register (SLEEPCFG.SLEEPMODE written to 0x4). The device will exit STANDBY on any asynchronous interrupt.

The Peripherals can still perform tasks as long as the Run in Standby bit in the peripheral's control register is written. This will enable the peripheral to run while in STANDBY. If in addition the clock source is set to run on demand, the oscillator will only be enabled when requested by a peripheral.

## Library Interface

Power Manager peripheral library provides the following interfaces:

Functions

Name | Description
--- | ---
PM_Initialize | Initializes given instance of PM peripheral
PM_IdleModeEnter | Puts the device in Idle mode
PM_StandbyModeEnter | Puts the device in standby mode
PM_BackupModeEnter | Puts the device in backup mode
PM_OffModeEnter | Puts the device in off mode
PM_IO_RetentionSet | Turns on I/O retention when exiting HIBERNATE or BACKUP mode
PM_IO_RetentionClear | Turns off I/O retention. To be called after exiting HIBERNATE or BACKUP mode