STM32L443xx HAL User Manual
|
Low Power modes configuration functions. More...
Functions | |
HAL_StatusTypeDef | HAL_PWR_ConfigPVD (PWR_PVDTypeDef *sConfigPVD) |
Configure the voltage threshold detected by the Power Voltage Detector (PVD). | |
void | HAL_PWR_EnablePVD (void) |
Enable the Power Voltage Detector (PVD). | |
void | HAL_PWR_DisablePVD (void) |
Disable the Power Voltage Detector (PVD). | |
void | HAL_PWR_EnableWakeUpPin (uint32_t WakeUpPinPolarity) |
Enable the WakeUp PINx functionality. | |
void | HAL_PWR_DisableWakeUpPin (uint32_t WakeUpPinx) |
Disable the WakeUp PINx functionality. | |
void | HAL_PWR_EnterSLEEPMode (uint32_t Regulator, uint8_t SLEEPEntry) |
Enter Sleep or Low-power Sleep mode. | |
void | HAL_PWR_EnterSTOPMode (uint32_t Regulator, uint8_t STOPEntry) |
Enter Stop mode. | |
void | HAL_PWR_EnterSTANDBYMode (void) |
Enter Standby mode. | |
void | HAL_PWR_EnableSleepOnExit (void) |
Indicate Sleep-On-Exit when returning from Handler mode to Thread mode. | |
void | HAL_PWR_DisableSleepOnExit (void) |
Disable Sleep-On-Exit feature when returning from Handler mode to Thread mode. | |
void | HAL_PWR_EnableSEVOnPend (void) |
Enable CORTEX M4 SEVONPEND bit. | |
void | HAL_PWR_DisableSEVOnPend (void) |
Disable CORTEX M4 SEVONPEND bit. | |
__weak void | HAL_PWR_PVDCallback (void) |
PWR PVD interrupt callback. |
Low Power modes configuration functions.
=============================================================================== ##### Peripheral Control functions ##### =============================================================================== [..] *** PVD configuration *** ========================= [..] (+) The PVD is used to monitor the VDD power supply by comparing it to a threshold selected by the PVD Level (PLS[2:0] bits in PWR_CR2 register). (+) PVDO flag is available to indicate if VDD/VDDA is higher or lower than the PVD threshold. This event is internally connected to the EXTI line16 and can generate an interrupt if enabled. This is done through __HAL_PVD_EXTI_ENABLE_IT() macro. (+) The PVD is stopped in Standby mode. *** WakeUp pin configuration *** ================================ [..] (+) WakeUp pins are used to wakeup the system from Standby mode or Shutdown mode. The polarity of these pins can be set to configure event detection on high level (rising edge) or low level (falling edge). *** Low Power modes configuration *** ===================================== [..] The devices feature 8 low-power modes: (+) Low-power Run mode: core and peripherals are running, main regulator off, low power regulator on. (+) Sleep mode: Cortex-M4 core stopped, peripherals kept running, main and low power regulators on. (+) Low-power Sleep mode: Cortex-M4 core stopped, peripherals kept running, main regulator off, low power regulator on. (+) Stop 0 mode: all clocks are stopped except LSI and LSE, main and low power regulators on. (+) Stop 1 mode: all clocks are stopped except LSI and LSE, main regulator off, low power regulator on. (+) Stop 2 mode: all clocks are stopped except LSI and LSE, main regulator off, low power regulator on, reduced set of waking up IPs compared to Stop 1 mode. (+) Standby mode with SRAM2: all clocks are stopped except LSI and LSE, SRAM2 content preserved, main regulator off, low power regulator on. (+) Standby mode without SRAM2: all clocks are stopped except LSI and LSE, main and low power regulators off. (+) Shutdown mode: all clocks are stopped except LSE, main and low power regulators off. *** Low-power run mode *** ========================== [..] (+) Entry: (from main run mode) (++) set LPR bit with HAL_PWREx_EnableLowPowerRunMode() API after having decreased the system clock below 2 MHz. (+) Exit: (++) clear LPR bit then wait for REGLP bit to be reset with HAL_PWREx_DisableLowPowerRunMode() API. Only then can the system clock frequency be increased above 2 MHz. *** Sleep mode / Low-power sleep mode *** ========================================= [..] (+) Entry: The Sleep mode / Low-power Sleep mode is entered thru HAL_PWR_EnterSLEEPMode() API in specifying whether or not the regulator is forced to low-power mode and if exit is interrupt or event-triggered. (++) PWR_MAINREGULATOR_ON: Sleep mode (regulator in main mode). (++) PWR_LOWPOWERREGULATOR_ON: Low-power sleep (regulator in low power mode). In the latter case, the system clock frequency must have been decreased below 2 MHz beforehand. (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction (+) WFI Exit: (++) Any peripheral interrupt acknowledged by the nested vectored interrupt controller (NVIC) or any wake-up event. (+) WFE Exit: (++) Any wake-up event such as an EXTI line configured in event mode. [..] When exiting the Low-power sleep mode by issuing an interrupt or a wakeup event, the MCU is in Low-power Run mode. *** Stop 0, Stop 1 and Stop 2 modes *** =============================== [..] (+) Entry: The Stop 0, Stop 1 or Stop 2 modes are entered thru the following API's: (++) HAL_PWREx_EnterSTOP0Mode() for mode 0 or HAL_PWREx_EnterSTOP1Mode() for mode 1 or for porting reasons HAL_PWR_EnterSTOPMode(). (++) HAL_PWREx_EnterSTOP2Mode() for mode 2. (+) Regulator setting (applicable to HAL_PWR_EnterSTOPMode() only): (++) PWR_MAINREGULATOR_ON (++) PWR_LOWPOWERREGULATOR_ON (+) Exit (interrupt or event-triggered, specified when entering STOP mode): (++) PWR_STOPENTRY_WFI: enter Stop mode with WFI instruction (++) PWR_STOPENTRY_WFE: enter Stop mode with WFE instruction (+) WFI Exit: (++) Any EXTI Line (Internal or External) configured in Interrupt mode. (++) Some specific communication peripherals (USART, LPUART, I2C) interrupts when programmed in wakeup mode. (+) WFE Exit: (++) Any EXTI Line (Internal or External) configured in Event mode. [..] When exiting Stop 0 and Stop 1 modes, the MCU is either in Run mode or in Low-power Run mode depending on the LPR bit setting. When exiting Stop 2 mode, the MCU is in Run mode. *** Standby mode *** ==================== [..] The Standby mode offers two options: (+) option a) all clocks off except LSI and LSE, RRS bit set (keeps voltage regulator in low power mode). SRAM and registers contents are lost except for the SRAM2 content, the RTC registers, RTC backup registers and Standby circuitry. (+) option b) all clocks off except LSI and LSE, RRS bit cleared (voltage regulator then disabled). SRAM and register contents are lost except for the RTC registers, RTC backup registers and Standby circuitry. (++) Entry: (+++) The Standby mode is entered thru HAL_PWR_EnterSTANDBYMode() API. SRAM1 and register contents are lost except for registers in the Backup domain and Standby circuitry. SRAM2 content can be preserved if the bit RRS is set in PWR_CR3 register. To enable this feature, the user can resort to HAL_PWREx_EnableSRAM2ContentRetention() API to set RRS bit. (++) Exit: (+++) WKUP pin rising edge, RTC alarm or wakeup, tamper event, time-stamp event, external reset in NRST pin, IWDG reset. [..] After waking up from Standby mode, program execution restarts in the same way as after a Reset. *** Shutdown mode *** ====================== [..] In Shutdown mode, voltage regulator is disabled, all clocks are off except LSE, RRS bit is cleared. SRAM and registers contents are lost except for backup domain registers. (+) Entry: The Shutdown mode is entered thru HAL_PWREx_EnterSHUTDOWNMode() API. (+) Exit: (++) WKUP pin rising edge, RTC alarm or wakeup, tamper event, time-stamp event, external reset in NRST pin. [..] After waking up from Shutdown mode, program execution restarts in the same way as after a Reset. *** Auto-wakeup (AWU) from low-power mode *** ============================================= [..] The MCU can be woken up from low-power mode by an RTC Alarm event, an RTC Wakeup event, a tamper event or a time-stamp event, without depending on an external interrupt (Auto-wakeup mode). (+) RTC auto-wakeup (AWU) from the Stop, Standby and Shutdown modes (++) To wake up from the Stop mode with an RTC alarm event, it is necessary to configure the RTC to generate the RTC alarm using the HAL_RTC_SetAlarm_IT() function. (++) To wake up from the Stop mode with an RTC Tamper or time stamp event, it is necessary to configure the RTC to detect the tamper or time stamp event using the HAL_RTCEx_SetTimeStamp_IT() or HAL_RTCEx_SetTamper_IT() functions. (++) To wake up from the Stop mode with an RTC WakeUp event, it is necessary to configure the RTC to generate the RTC WakeUp event using the HAL_RTCEx_SetWakeUpTimer_IT() function.
HAL_StatusTypeDef HAL_PWR_ConfigPVD | ( | PWR_PVDTypeDef * | sConfigPVD | ) |
Configure the voltage threshold detected by the Power Voltage Detector (PVD).
sConfigPVD,: | pointer to a PWR_PVDTypeDef structure that contains the PVD configuration information. |
None |
Definition at line 311 of file stm32l4xx_hal_pwr.c.
References __HAL_PWR_PVD_EXTI_DISABLE_EVENT, __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE, __HAL_PWR_PVD_EXTI_DISABLE_IT, __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE, __HAL_PWR_PVD_EXTI_ENABLE_EVENT, __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE, __HAL_PWR_PVD_EXTI_ENABLE_IT, __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE, assert_param, IS_PWR_PVD_LEVEL, IS_PWR_PVD_MODE, PWR_PVDTypeDef::Mode, PVD_FALLING_EDGE, PVD_MODE_EVT, PVD_MODE_IT, PVD_RISING_EDGE, and PWR_PVDTypeDef::PVDLevel.
void HAL_PWR_DisablePVD | ( | void | ) |
Disable the Power Voltage Detector (PVD).
None |
Definition at line 366 of file stm32l4xx_hal_pwr.c.
void HAL_PWR_DisableSEVOnPend | ( | void | ) |
Disable CORTEX M4 SEVONPEND bit.
None |
Definition at line 622 of file stm32l4xx_hal_pwr.c.
void HAL_PWR_DisableSleepOnExit | ( | void | ) |
Disable Sleep-On-Exit feature when returning from Handler mode to Thread mode.
None |
Definition at line 595 of file stm32l4xx_hal_pwr.c.
void HAL_PWR_DisableWakeUpPin | ( | uint32_t | WakeUpPinx | ) |
Disable the WakeUp PINx functionality.
WakeUpPinx,: | Specifies the Power Wake-Up pin to disable. This parameter can be one of the following values:
|
None |
Definition at line 412 of file stm32l4xx_hal_pwr.c.
References assert_param, and IS_PWR_WAKEUP_PIN.
void HAL_PWR_EnablePVD | ( | void | ) |
Enable the Power Voltage Detector (PVD).
None |
Definition at line 357 of file stm32l4xx_hal_pwr.c.
void HAL_PWR_EnableSEVOnPend | ( | void | ) |
Enable CORTEX M4 SEVONPEND bit.
None |
Definition at line 609 of file stm32l4xx_hal_pwr.c.
void HAL_PWR_EnableSleepOnExit | ( | void | ) |
Indicate Sleep-On-Exit when returning from Handler mode to Thread mode.
None |
Definition at line 582 of file stm32l4xx_hal_pwr.c.
void HAL_PWR_EnableWakeUpPin | ( | uint32_t | WakeUpPinPolarity | ) |
Enable the WakeUp PINx functionality.
WakeUpPinPolarity,: | Specifies which Wake-Up pin to enable. This parameter can be one of the following legacy values which set the default polarity i.e. detection on high level (rising edge):
|
None |
Definition at line 391 of file stm32l4xx_hal_pwr.c.
References assert_param, IS_PWR_WAKEUP_PIN, and PWR_WUP_POLARITY_SHIFT.
void HAL_PWR_EnterSLEEPMode | ( | uint32_t | Regulator, |
uint8_t | SLEEPEntry | ||
) |
Enter Sleep or Low-power Sleep mode.
Regulator,: | Specifies the regulator state in Sleep/Low-power Sleep mode. This parameter can be one of the following values:
|
SLEEPEntry,: | Specifies if Sleep mode is entered with WFI or WFE instruction. This parameter can be one of the following values:
|
None |
Definition at line 444 of file stm32l4xx_hal_pwr.c.
References assert_param, HAL_PWREx_DisableLowPowerRunMode(), HAL_PWREx_EnableLowPowerRunMode(), IS_PWR_REGULATOR, IS_PWR_SLEEP_ENTRY, PWR_MAINREGULATOR_ON, and PWR_SLEEPENTRY_WFI.
void HAL_PWR_EnterSTANDBYMode | ( | void | ) |
Enter Standby mode.
None |
Definition at line 556 of file stm32l4xx_hal_pwr.c.
void HAL_PWR_EnterSTOPMode | ( | uint32_t | Regulator, |
uint8_t | STOPEntry | ||
) |
Enter Stop mode.
Regulator,: | Specifies the regulator state in Stop mode. This parameter can be one of the following values:
|
STOPEntry,: | Specifies Stop 0 or Stop 1 mode is entered with WFI or WFE instruction. This parameter can be one of the following values:
|
None |
Definition at line 523 of file stm32l4xx_hal_pwr.c.
References assert_param, HAL_PWREx_EnterSTOP0Mode(), HAL_PWREx_EnterSTOP1Mode(), IS_PWR_REGULATOR, and PWR_LOWPOWERREGULATOR_ON.
void HAL_PWR_PVDCallback | ( | void | ) |
PWR PVD interrupt callback.
None |
Definition at line 636 of file stm32l4xx_hal_pwr.c.
Referenced by HAL_PWREx_PVD_PVM_IRQHandler().