RA Flexible Software Package Documentation
Release v5.7.0
|
|
Functions | |
fsp_err_t | R_LPM_Open (lpm_ctrl_t *const p_api_ctrl, lpm_cfg_t const *const p_cfg) |
fsp_err_t | R_LPM_LowPowerReconfigure (lpm_ctrl_t *const p_api_ctrl, lpm_cfg_t const *const p_cfg) |
fsp_err_t | R_LPM_LowPowerModeEnter (lpm_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_LPM_IoKeepClear (lpm_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_LPM_Close (lpm_ctrl_t *const p_api_ctrl) |
Driver for the LPM peripheral on RA MCUs. This module implements the Low Power Modes Interface.
The low power modes driver is used to configure and place the device into the desired low power mode. Various sources can be configured to wake from standby, request snooze mode, end snooze mode or end deep standby mode.
The LPM HAL module has the following key features:
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Standby Limit |
| Disabled | If enabled, standby configuration only applies in R_LPM_LowPowerModeEnter. Otherwise, standby configuration applies to any WFI call. |
Configuration | Options | Default | Description |
---|---|---|---|
General | |||
Name | Name must be a valid C symbol | g_lpm0 | Module name. |
Low Power Mode | MCU Specific Options | Power mode to be entered. | |
Output port state in standby and deep standby | MCU Specific Options | Select the state of output pins during standby. Applies to address output, data output, and other bus control output pins. | |
Supply of SOSC clock to peripheral function in standby | MCU Specific Options | If enabled, SOSC clock is provided to peripheral functions in Software Standby and Snooze modes. | |
Startup speed of the HOCO in Standby and Snooze modes | MCU Specific Options | If enabled, the HOCO enters high-speed startup mode, shortening standby release time, and snooze transition time. | |
Flash mode in sleep or snooze | MCU Specific Options | Select flash mode in sleep mode or in snooze mode. | |
Deep Sleep and Standby Options | |||
Deep Sleep and Standby Options > Snooze Options (Not available on every MCU) | |||
Snooze Request Source | MCU Specific Options | Select the event that will enter snooze. | |
Snooze End Sources | MCU Specific Options | Enable wake from snooze from these sources. | |
DTC state in Snooze Mode | MCU Specific Options | Enable wake from snooze from this source. | |
Snooze Cancel Source | MCU Specific Options | Select an interrupt source to cancel snooze. | |
Wake Sources | MCU Specific Options | Enable wake from deep sleep and standby from these Sources. | |
Wake Sources 2 | MCU Specific Options | Enable wake from deep sleep and standby from these Sources. | |
RAM Retention Control (Not available on every MCU) | |||
RAM retention in Standby mode | MCU Specific Options | Select the memory regions that are retained in standby mode. | |
TCM retention in Deep Sleep and Standby modes | MCU Specific Options | Select if Tightly Coupled Memory (TCM) is retained in deep sleep and standby modes. | |
Standby RAM retention in Standby and Deep Standby modes | MCU Specific Options | Select if Standby RAM is retained in standby and deep standby modes. | |
Oscillator LDO Control (Not available on every MCU) | |||
PLL1 LDO State in standby mode | MCU Specific Options | Select the state PLL1 LDO state in standby mode. | |
PLL2 LDO State in standby mode | MCU Specific Options | Select the state PLL2 LDO state in standby mode. | |
HOCO LDO State in standby mode | MCU Specific Options | Select the state HOCO LDO state in standby mode. | |
Deep Standby Options (Not available on every MCU) | |||
I/O Port Retention | MCU Specific Options | Select the state of the IO Pins after exiting deep standby mode. | |
Power-Supply Control | MCU Specific Options | Select the state of the internal power supply in deep standby mode. | |
Cancel Sources | MCU Specific Options | Enable wake from deep standby using these sources. | |
Cancel Edges | MCU Specific Options | Falling edge trigger is default. Select sources to enable wake from deep standby with rising edge. |
This module does not have any selectable clock sources.
This module does not use I/O pins.
At power on, by default sleep is set as the low-power mode. Sleep mode is the most convenient low-power mode available, as it does not require any special configuration (other than configuring and enabling a suitable interrupt or event to wake the MCU from sleep) to return to normal program-execution mode. The states of the SRAM, the processor registers, and the hardware peripherals are all maintained in sleep mode, and the time needed to enter and wake from sleep is minimal. Any interrupt causes the MCU device to wake from sleep mode, including the SysTick interrupt used by the RTOS scheduler.
Deep sleep mode is similar to sleep mode with the exception that DTC and DMAC are stopped, access to TCM memory is not available, and only a subset of interrupts are available for waking the CPU.
In software-standby mode, the CPU, as well as most of the on-chip peripheral functions and all of the internal oscillators, are stopped. The contents of the CPU internal registers and SRAM data, the states of on-chip peripheral functions, and I/O Ports are all retained. Software-standby mode allows significant reduction in power consumption, because most of the oscillators are stopped in this mode. Like sleep mode, standby mode requires an interrupt or event be configured and enabled to wake up.
Snooze mode can be used with some MCU peripherals to execute basic tasks while keeping the MCU in a low-power state. Many core peripherals and all clocks can be selected to run during Snooze, allowing for more flexible low-power configuration than Software Standby mode. To enable Snooze, select "Software Standby mode with Snooze mode enabled" for the "Low Power Mode" configuration option. Snooze mode settings (including entry/exit sources) are available under "Standby Options".
The MCU always wakes from Deep Software Standby Mode by going through reset, either by the negation of the reset pin or by one of the wakeup sources configurable in the "Deep Standby Options" configuration group.
The Reset Status Registers can be used to determine if the reset occurred after coming out of deep software standby. For example, R_SYSTEM->RSTSR0_b.DPSRSTF is set to 1 after a deep software standby reset.
I/O Port Retention can be enabled to maintain I/O port configuration across a deep software standby reset. Retention can be cancelled through the R_LPM_IoKeepClear API.
Developers should be aware of the following limitations when using the LPM:
This is a basic example of minimal use of the LPM in an application. The LPM instance is opened and the configured low-power mode is entered.
Data Structures | |
struct | lpm_instance_ctrl_t |
struct lpm_instance_ctrl_t |
LPM private control block. DO NOT MODIFY. Initialization occurs when R_LPM_Open() is called.
fsp_err_t R_LPM_Open | ( | lpm_ctrl_t *const | p_api_ctrl, |
lpm_cfg_t const *const | p_cfg | ||
) |
Perform any necessary initialization
FSP_SUCCESS | LPM instance opened |
FSP_ERR_ASSERTION | Null Pointer |
FSP_ERR_ALREADY_OPEN | LPM instance is already open |
FSP_ERR_UNSUPPORTED | This MCU does not support Deep Software Standby |
FSP_ERR_INVALID_ARGUMENT | One of the following:
|
FSP_ERR_INVALID_MODE | One of the following:
|
fsp_err_t R_LPM_LowPowerReconfigure | ( | lpm_ctrl_t *const | p_api_ctrl, |
lpm_cfg_t const *const | p_cfg | ||
) |
Configure a low power mode
NOTE: This function does not enter the low power mode, it only configures parameters of the mode. Execution of the WFI instruction is what causes the low power mode to be entered.
FSP_SUCCESS | Low power mode successfuly applied |
FSP_ERR_ASSERTION | Null Pointer |
FSP_ERR_NOT_OPEN | LPM instance is not open |
FSP_ERR_UNSUPPORTED | This MCU does not support Deep Software Standby |
FSP_ERR_INVALID_ARGUMENT | One of the following:
|
FSP_ERR_INVALID_MODE | One of the following:
|
fsp_err_t R_LPM_LowPowerModeEnter | ( | lpm_ctrl_t *const | p_api_ctrl | ) |
Enter low power mode (sleep/deep sleep/standby/deep standby) using WFI macro.
Function will return after waking from low power mode.
FSP_SUCCESS | Successful. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | LPM instance is not open |
FSP_ERR_INVALID_MODE | One of the following:
|
fsp_err_t R_LPM_IoKeepClear | ( | lpm_ctrl_t *const | p_api_ctrl | ) |
Clear the IOKEEP bit after deep software standby
FSP_SUCCESS | DPSBYCR_b.IOKEEP bit cleared Successfully. |
FSP_ERR_UNSUPPORTED | Deep standby mode not supported on this MCU. |
fsp_err_t R_LPM_Close | ( | lpm_ctrl_t *const | p_api_ctrl | ) |
Close the LPM Instance
FSP_SUCCESS | LPM driver closed |
FSP_ERR_NOT_OPEN | LPM instance is not open |
FSP_ERR_ASSERTION | Null Pointer |