STM32L4xx_HAL_Driver  1.14.0
Peripheral Control functions

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). More...
 
void HAL_PWR_EnablePVD (void)
 Enable the Power Voltage Detector (PVD). More...
 
void HAL_PWR_DisablePVD (void)
 Disable the Power Voltage Detector (PVD). More...
 
void HAL_PWR_EnableWakeUpPin (uint32_t WakeUpPinPolarity)
 Enable the WakeUp PINx functionality. More...
 
void HAL_PWR_DisableWakeUpPin (uint32_t WakeUpPinx)
 Disable the WakeUp PINx functionality. More...
 
void HAL_PWR_EnterSLEEPMode (uint32_t Regulator, uint8_t SLEEPEntry)
 Enter Sleep or Low-power Sleep mode. More...
 
void HAL_PWR_EnterSTOPMode (uint32_t Regulator, uint8_t STOPEntry)
 Enter Stop mode. More...
 
void HAL_PWR_EnterSTANDBYMode (void)
 Enter Standby mode. More...
 
void HAL_PWR_EnableSleepOnExit (void)
 Indicate Sleep-On-Exit when returning from Handler mode to Thread mode. More...
 
void HAL_PWR_DisableSleepOnExit (void)
 Disable Sleep-On-Exit feature when returning from Handler mode to Thread mode. More...
 
void HAL_PWR_EnableSEVOnPend (void)
 Enable CORTEX M4 SEVONPEND bit. More...
 
void HAL_PWR_DisableSEVOnPend (void)
 Disable CORTEX M4 SEVONPEND bit. More...
 
void HAL_PWR_PVDCallback (void)
 PWR PVD interrupt callback. More...
 

Detailed Description

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.

Function Documentation

◆ HAL_PWR_ConfigPVD()

HAL_StatusTypeDef HAL_PWR_ConfigPVD ( PWR_PVDTypeDef *  sConfigPVD)

Configure the voltage threshold detected by the Power Voltage Detector (PVD).

Parameters
sConfigPVDpointer to a PWR_PVDTypeDef structure that contains the PVD configuration information.
Note
Refer to the electrical characteristics of your device datasheet for more details about the voltage thresholds corresponding to each detection level.
Return values
None

Definition at line 312 of file stm32l4xx_hal_pwr.c.

313 {
314  /* Check the parameters */
315  assert_param(IS_PWR_PVD_LEVEL(sConfigPVD->PVDLevel));
316  assert_param(IS_PWR_PVD_MODE(sConfigPVD->Mode));
317 
318  /* Set PLS bits according to PVDLevel value */
319  MODIFY_REG(PWR->CR2, PWR_CR2_PLS, sConfigPVD->PVDLevel);
320 
321  /* Clear any previous config. Keep it clear if no event or IT mode is selected */
322  __HAL_PWR_PVD_EXTI_DISABLE_EVENT();
323  __HAL_PWR_PVD_EXTI_DISABLE_IT();
324  __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();
325  __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();
326 
327  /* Configure interrupt mode */
328  if((sConfigPVD->Mode & PVD_MODE_IT) == PVD_MODE_IT)
329  {
330  __HAL_PWR_PVD_EXTI_ENABLE_IT();
331  }
332 
333  /* Configure event mode */
334  if((sConfigPVD->Mode & PVD_MODE_EVT) == PVD_MODE_EVT)
335  {
336  __HAL_PWR_PVD_EXTI_ENABLE_EVENT();
337  }
338 
339  /* Configure the edge */
340  if((sConfigPVD->Mode & PVD_RISING_EDGE) == PVD_RISING_EDGE)
341  {
342  __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();
343  }
344 
345  if((sConfigPVD->Mode & PVD_FALLING_EDGE) == PVD_FALLING_EDGE)
346  {
347  __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();
348  }
349 
350  return HAL_OK;
351 }
return HAL_OK
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_PWR_DisablePVD()

void HAL_PWR_DisablePVD ( void  )

Disable the Power Voltage Detector (PVD).

Return values
None

Definition at line 367 of file stm32l4xx_hal_pwr.c.

368 {
369  CLEAR_BIT(PWR->CR2, PWR_CR2_PVDE);
370 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ HAL_PWR_DisableSEVOnPend()

void HAL_PWR_DisableSEVOnPend ( void  )

Disable CORTEX M4 SEVONPEND bit.

Note
Clear SEVONPEND bit of SCR register. When this bit is set, this causes WFE to wake up when an interrupt moves from inactive to pended.
Return values
None

Definition at line 623 of file stm32l4xx_hal_pwr.c.

624 {
625  /* Clear SEVONPEND bit of Cortex System Control Register */
626  CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
627 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ HAL_PWR_DisableSleepOnExit()

void HAL_PWR_DisableSleepOnExit ( void  )

Disable Sleep-On-Exit feature when returning from Handler mode to Thread mode.

Note
Clear SLEEPONEXIT bit of SCR register. When this bit is set, the processor re-enters SLEEP mode when an interruption handling is over.
Return values
None

Definition at line 596 of file stm32l4xx_hal_pwr.c.

597 {
598  /* Clear SLEEPONEXIT bit of Cortex System Control Register */
599  CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
600 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ HAL_PWR_DisableWakeUpPin()

void HAL_PWR_DisableWakeUpPin ( uint32_t  WakeUpPinx)

Disable the WakeUp PINx functionality.

Parameters
WakeUpPinxSpecifies the Power Wake-Up pin to disable. This parameter can be one of the following values:
  • PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3, PWR_WAKEUP_PIN4, PWR_WAKEUP_PIN5
Return values
None

Definition at line 413 of file stm32l4xx_hal_pwr.c.

414 {
415  assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx));
416 
417  CLEAR_BIT(PWR->CR3, (PWR_CR3_EWUP & WakeUpPinx));
418 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_PWR_EnablePVD()

void HAL_PWR_EnablePVD ( void  )

Enable the Power Voltage Detector (PVD).

Return values
None

Definition at line 358 of file stm32l4xx_hal_pwr.c.

359 {
360  SET_BIT(PWR->CR2, PWR_CR2_PVDE);
361 }

◆ HAL_PWR_EnableSEVOnPend()

void HAL_PWR_EnableSEVOnPend ( void  )

Enable CORTEX M4 SEVONPEND bit.

Note
Set SEVONPEND bit of SCR register. When this bit is set, this causes WFE to wake up when an interrupt moves from inactive to pended.
Return values
None

Definition at line 610 of file stm32l4xx_hal_pwr.c.

611 {
612  /* Set SEVONPEND bit of Cortex System Control Register */
613  SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
614 }

◆ HAL_PWR_EnableSleepOnExit()

void HAL_PWR_EnableSleepOnExit ( void  )

Indicate Sleep-On-Exit when returning from Handler mode to Thread mode.

Note
Set SLEEPONEXIT bit of SCR register. When this bit is set, the processor re-enters SLEEP mode when an interruption handling is over. Setting this bit is useful when the processor is expected to run only on interruptions handling.
Return values
None

Definition at line 583 of file stm32l4xx_hal_pwr.c.

584 {
585  /* Set SLEEPONEXIT bit of Cortex System Control Register */
586  SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
587 }

◆ HAL_PWR_EnableWakeUpPin()

void HAL_PWR_EnableWakeUpPin ( uint32_t  WakeUpPinPolarity)

Enable the WakeUp PINx functionality.

Parameters
WakeUpPinPolaritySpecifies 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):
  • PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3, PWR_WAKEUP_PIN4, PWR_WAKEUP_PIN5
or one of the following value where the user can explicitly specify the enabled pin and the chosen polarity:
  • PWR_WAKEUP_PIN1_HIGH or PWR_WAKEUP_PIN1_LOW
  • PWR_WAKEUP_PIN2_HIGH or PWR_WAKEUP_PIN2_LOW
  • PWR_WAKEUP_PIN3_HIGH or PWR_WAKEUP_PIN3_LOW
  • PWR_WAKEUP_PIN4_HIGH or PWR_WAKEUP_PIN4_LOW
  • PWR_WAKEUP_PIN5_HIGH or PWR_WAKEUP_PIN5_LOW
Note
PWR_WAKEUP_PINx and PWR_WAKEUP_PINx_HIGH are equivalent.
Return values
None

Definition at line 392 of file stm32l4xx_hal_pwr.c.

393 {
394  assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinPolarity));
395 
396  /* Specifies the Wake-Up pin polarity for the event detection
397  (rising or falling edge) */
398  MODIFY_REG(PWR->CR4, (PWR_CR3_EWUP & WakeUpPinPolarity), (WakeUpPinPolarity >> PWR_WUP_POLARITY_SHIFT));
399 
400  /* Enable wake-up pin */
401  SET_BIT(PWR->CR3, (PWR_CR3_EWUP & WakeUpPinPolarity));
402 
403 
404 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_PWR_EnterSLEEPMode()

void HAL_PWR_EnterSLEEPMode ( uint32_t  Regulator,
uint8_t  SLEEPEntry 
)

Enter Sleep or Low-power Sleep mode.

Note
In Sleep/Low-power Sleep mode, all I/O pins keep the same state as in Run mode.
Parameters
RegulatorSpecifies the regulator state in Sleep/Low-power Sleep mode. This parameter can be one of the following values:
  • PWR_MAINREGULATOR_ON Sleep mode (regulator in main mode)
  • PWR_LOWPOWERREGULATOR_ON Low-power Sleep mode (regulator in low-power mode)
Note
Low-power Sleep mode is entered from Low-power Run mode. Therefore, if not yet in Low-power Run mode before calling HAL_PWR_EnterSLEEPMode() with Regulator set to PWR_LOWPOWERREGULATOR_ON, the user can optionally configure the Flash in power-down monde in setting the SLEEP_PD bit in FLASH_ACR register. Additionally, the clock frequency must be reduced below 2 MHz. Setting SLEEP_PD in FLASH_ACR then appropriately reducing the clock frequency must be done before calling HAL_PWR_EnterSLEEPMode() API.
When exiting Low-power Sleep mode, the MCU is in Low-power Run mode. To move in Run mode, the user must resort to HAL_PWREx_DisableLowPowerRunMode() API.
Parameters
SLEEPEntrySpecifies if Sleep mode is entered with WFI or WFE instruction. This parameter can be one of the following values:
  • PWR_SLEEPENTRY_WFI enter Sleep or Low-power Sleep mode with WFI instruction
  • PWR_SLEEPENTRY_WFE enter Sleep or Low-power Sleep mode with WFE instruction
Note
When WFI entry is used, tick interrupt have to be disabled if not desired as the interrupt wake up source.
Return values
None

Definition at line 445 of file stm32l4xx_hal_pwr.c.

446 {
447  /* Check the parameters */
448  assert_param(IS_PWR_REGULATOR(Regulator));
449  assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry));
450 
451  /* Set Regulator parameter */
452  if (Regulator == PWR_MAINREGULATOR_ON)
453  {
454  /* If in low-power run mode at this point, exit it */
455  if (HAL_IS_BIT_SET(PWR->SR2, PWR_SR2_REGLPF))
456  {
458  {
459  return ;
460  }
461  }
462  /* Regulator now in main mode. */
463  }
464  else
465  {
466  /* If in run mode, first move to low-power run mode.
467  The system clock frequency must be below 2 MHz at this point. */
468  if (HAL_IS_BIT_SET(PWR->SR2, PWR_SR2_REGLPF) == RESET)
469  {
471  }
472  }
473 
474  /* Clear SLEEPDEEP bit of Cortex System Control Register */
475  CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
476 
477  /* Select SLEEP mode entry -------------------------------------------------*/
478  if(SLEEPEntry == PWR_SLEEPENTRY_WFI)
479  {
480  /* Request Wait For Interrupt */
481  __WFI();
482  }
483  else
484  {
485  /* Request Wait For Event */
486  __SEV();
487  __WFE();
488  __WFE();
489  }
490 
491 }
HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode(void)
Exit Low-power Run mode.
return(brrresult)
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
void HAL_PWREx_EnableLowPowerRunMode(void)
Enter Low-power Run mode.

◆ HAL_PWR_EnterSTANDBYMode()

void HAL_PWR_EnterSTANDBYMode ( void  )

Enter Standby mode.

Note
In Standby mode, the PLL, the HSI, the MSI and the HSE oscillators are switched off. The voltage regulator is disabled, except when SRAM2 content is preserved in which case the regulator is in low-power mode. 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. The BOR is available.
The I/Os can be configured either with a pull-up or pull-down or can be kept in analog state. HAL_PWREx_EnableGPIOPullUp() and HAL_PWREx_EnableGPIOPullDown() respectively enable Pull Up and Pull Down state, HAL_PWREx_DisableGPIOPullUp() and HAL_PWREx_DisableGPIOPullDown() disable the same. These states are effective in Standby mode only if APC bit is set through HAL_PWREx_EnablePullUpPullDownConfig() API.
Return values
None

Definition at line 557 of file stm32l4xx_hal_pwr.c.

558 {
559  /* Set Stand-by mode */
560  MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, PWR_CR1_LPMS_STANDBY);
561 
562  /* Set SLEEPDEEP bit of Cortex System Control Register */
563  SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
564 
565 /* This option is used to ensure that store operations are completed */
566 #if defined ( __CC_ARM)
567  __force_stores();
568 #endif
569  /* Request Wait For Interrupt */
570  __WFI();
571 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ HAL_PWR_EnterSTOPMode()

void HAL_PWR_EnterSTOPMode ( uint32_t  Regulator,
uint8_t  STOPEntry 
)

Enter Stop mode.

Note
This API is named HAL_PWR_EnterSTOPMode to ensure compatibility with legacy code running on devices where only "Stop mode" is mentioned with main or low power regulator ON.
In Stop mode, all I/O pins keep the same state as in Run mode.
All clocks in the VCORE domain are stopped; the PLL, the MSI, the HSI and the HSE oscillators are disabled. Some peripherals with the wakeup capability (I2Cx, USARTx and LPUART) can switch on the HSI to receive a frame, and switch off the HSI after receiving the frame if it is not a wakeup frame. In this case, the HSI clock is propagated only to the peripheral requesting it. SRAM1, SRAM2 and register contents are preserved. The BOR is available. The voltage regulator can be configured either in normal (Stop 0) or low-power mode (Stop 1).
When exiting Stop 0 or Stop 1 mode by issuing an interrupt or a wakeup event, the HSI RC oscillator is selected as system clock if STOPWUCK bit in RCC_CFGR register is set; the MSI oscillator is selected if STOPWUCK is cleared.
When the voltage regulator operates in low power mode (Stop 1), an additional startup delay is incurred when waking up. By keeping the internal regulator ON during Stop mode (Stop 0), the consumption is higher although the startup time is reduced.
Parameters
RegulatorSpecifies the regulator state in Stop mode. This parameter can be one of the following values:
  • PWR_MAINREGULATOR_ON Stop 0 mode (main regulator ON)
  • PWR_LOWPOWERREGULATOR_ON Stop 1 mode (low power regulator ON)
STOPEntrySpecifies Stop 0 or Stop 1 mode is entered with WFI or WFE instruction. This parameter can be one of the following values:
  • PWR_STOPENTRY_WFI Enter Stop 0 or Stop 1 mode with WFI instruction.
  • PWR_STOPENTRY_WFE Enter Stop 0 or Stop 1 mode with WFE instruction.
Return values
None

Definition at line 524 of file stm32l4xx_hal_pwr.c.

525 {
526  /* Check the parameters */
527  assert_param(IS_PWR_REGULATOR(Regulator));
528 
529  if(Regulator == PWR_LOWPOWERREGULATOR_ON)
530  {
531  HAL_PWREx_EnterSTOP1Mode(STOPEntry);
532  }
533  else
534  {
535  HAL_PWREx_EnterSTOP0Mode(STOPEntry);
536  }
537 }
void HAL_PWREx_EnterSTOP1Mode(uint8_t STOPEntry)
Enter Stop 1 mode.
void HAL_PWREx_EnterSTOP0Mode(uint8_t STOPEntry)
Enter Stop 0 mode.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_PWR_PVDCallback()

__weak void HAL_PWR_PVDCallback ( void  )

PWR PVD interrupt callback.

Return values
None

Definition at line 637 of file stm32l4xx_hal_pwr.c.

638 {
639  /* NOTE : This function should not be modified; when the callback is needed,
640  the HAL_PWR_PVDCallback can be implemented in the user file
641  */
642 }