STM32H735xx HAL User Manual
Functions
Peripheral Control Functions
PWR Exported Functions

Power Control functions. More...

Functions

void HAL_PWR_ConfigPVD (PWR_PVDTypeDef *sConfigPVD)
 Configure the event mode and the voltage threshold detected by the Programmable Voltage Detector(PVD).
void HAL_PWR_EnablePVD (void)
 Enable the Programmable Voltage Detector (PVD).
void HAL_PWR_DisablePVD (void)
 Disable the Programmable 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 the current core in SLEEP mode (CSLEEP).
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 feature 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 SEVONPEND feature.
void HAL_PWR_DisableSEVOnPend (void)
 Disable CORTEX SEVONPEND feature.
void HAL_PWR_PVD_IRQHandler (void)
 This function handles the PWR PVD interrupt request.
void HAL_PWR_PVDCallback (void)
 PWR PVD interrupt callback.

Detailed Description

Power Control functions.

 ===============================================================================
                 ##### Peripheral Control Functions #####
 ===============================================================================
    [..]
      This section provides functions allowing to control power peripheral.

    *** PVD configuration ***
    =========================
    [..]
      (+) The PVD is used to monitor the VDD power supply by comparing it to a
          threshold selected by the PVD Level (PLS[7:0] bits in the PWR_CR1
          register).

      (+) A PVDO flag is available to indicate if VDD is higher or lower
          than the PVD threshold. This event is internally connected to the EXTI
          line 16 to generate an interrupt if enabled.
          It is configurable through __HAL_PWR_PVD_EXTI_ENABLE_IT() macro.

      (+) The PVD is stopped in STANDBY mode.

    *** Wake-up pin configuration ***
    =================================
    [..]
      (+) Wake-up pin is used to wake up the system from STANDBY mode.
          The pin pull is configurable through the WKUPEPR register to be in
          No-pull, Pull-up and Pull-down.
          The pin polarity is configurable through the WKUPEPR register to be
          active on rising or falling edges.

      (+) There are up to six Wake-up pin in the STM32H7 devices family.

    *** Low Power modes configuration ***
    =====================================
    [..]
     The device present 3 principles low-power modes features:
      (+) SLEEP mode   : Cortex-Mx is stopped and all PWR domains are remaining
                         active (Powered and Clocked).

      (+) STOP mode    : Cortex-Mx is stopped, clocks are stopped and the
                         regulator is running. The Main regulator or the LP
                         regulator could be selected.

      (+) STANDBY mode : All PWR domains enter DSTANDBY mode and the VCORE
                         supply regulator is powered off.

   *** SLEEP mode ***
   ==================
    [..]
      (+) Entry:
        The SLEEP mode is entered by using the HAL_PWR_EnterSLEEPMode(Regulator,
        SLEEPEntry) function.

          (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction.
          (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction.

      -@@- The Regulator parameter is not used for the STM32H7 family
              and is kept as parameter just to maintain compatibility with the
              lower power families (STM32L).

      (+) Exit:
        Any peripheral interrupt acknowledged by the nested vectored interrupt
        controller (NVIC) can wake up the device from SLEEP mode.

   *** STOP mode ***
   =================
    [..]
      In system STOP mode, all clocks in the 1.2V domain are stopped, the PLL,
      the HSI, and the HSE RC oscillators are disabled. Internal SRAM and
      register contents are preserved.
      The voltage regulator can be configured either in normal or low-power mode.
      To minimize the consumption in STOP mode, FLASH can be powered off before
      entering the STOP mode using the HAL_PWREx_EnableFlashPowerDown() function.
      It can be switched on again by software after exiting the STOP mode using
      the HAL_PWREx_DisableFlashPowerDown() function.

      (+) Entry:
         The STOP mode is entered using the HAL_PWR_EnterSTOPMode(Regulator,
         STOPEntry) function with:

         (++) Regulator:
          (+++) PWR_MAINREGULATOR_ON: Main regulator ON.
          (+++) PWR_LOWPOWERREGULATOR_ON: Low Power regulator ON.

         (++) STOPEntry:
          (+++) PWR_STOPENTRY_WFI: enter STOP mode with WFI instruction.
          (+++) PWR_STOPENTRY_WFE: enter STOP mode with WFE instruction.

      (+) Exit:
         Any EXTI Line (Internal or External) configured in Interrupt/Event mode.

   *** STANDBY mode ***
   ====================
    [..]
    (+)
      The system STANDBY mode allows to achieve the lowest power consumption.
      It is based on the Cortex-Mx deep SLEEP mode, with the voltage regulator
      disabled. The system is consequently powered off. The PLL, the HSI
      oscillator and the HSE oscillator are also switched off. SRAM and register
      contents are lost except for the RTC registers, RTC backup registers,
      backup SRAM and standby circuitry.

    [..]
      The voltage regulator is OFF.

      (++) Entry:
        (+++) The STANDBY mode is entered using the HAL_PWR_EnterSTANDBYMode()
              function.

      (++) Exit:
        (+++) WKUP pin rising or falling edge, RTC alarm (Alarm A and Alarm B),
              RTC wakeup, tamper event, time stamp event, external reset in NRST
              pin, IWDG 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 and STANDBY 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

void HAL_PWR_ConfigPVD ( PWR_PVDTypeDef sConfigPVD)

Configure the event mode and the voltage threshold detected by the Programmable Voltage Detector(PVD).

Parameters:
sConfigPVD: Pointer to an PWR_PVDTypeDef structure that contains the configuration information for the PVD.
Note:
Refer to the electrical characteristics of your device datasheet for more details about the voltage threshold corresponding to each detection level.
For dual core devices, please ensure to configure the EXTI lines for the different Cortex-Mx through PWR_Exported_Macro provided by this driver. All combination are allowed: wake up only Cortex-M7, wake up only Cortex-M4 or wake up Cortex-M7 and Cortex-M4.
Return values:
None.

Definition at line 415 of file stm32h7xx_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 Programmable Voltage Detector (PVD).

Return values:
None.

Definition at line 480 of file stm32h7xx_hal_pwr.c.

void HAL_PWR_DisableSEVOnPend ( void  )

Disable CORTEX SEVONPEND feature.

Note:
Resets SEVONPEND bit of SCR register. When this bit is reset, only enabled pending causes exception entry wakes up the Cortex-Mx.
Return values:
None.

Definition at line 776 of file stm32h7xx_hal_pwr.c.

void HAL_PWR_DisableSleepOnExit ( void  )

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

Note:
Clears 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 751 of file stm32h7xx_hal_pwr.c.

void HAL_PWR_DisableWakeUpPin ( uint32_t  WakeUpPinx)

Disable the WakeUp PINx functionality.

Parameters:
WakeUpPinx: Specifies 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, PWR_WAKEUP_PIN6, PWR_WAKEUP_PIN1_HIGH, PWR_WAKEUP_PIN1_LOW, PWR_WAKEUP_PIN2_HIGH, PWR_WAKEUP_PIN2_LOW, PWR_WAKEUP_PIN3_HIGH, PWR_WAKEUP_PIN3_LOW, PWR_WAKEUP_PIN4_HIGH, PWR_WAKEUP_PIN4_LOW, PWR_WAKEUP_PIN5_HIGH, PWR_WAKEUP_PIN5_LOW, PWR_WAKEUP_PIN6_HIGH, PWR_WAKEUP_PIN6_LOW.
Note:
The PWR_WAKEUP_PIN3_HIGH, PWR_WAKEUP_PIN3_LOW, PWR_WAKEUP_PIN5_HIGH and PWR_WAKEUP_PIN5_LOW are available only for devices that includes GPIOI port.
Return values:
None.

Definition at line 536 of file stm32h7xx_hal_pwr.c.

References assert_param, and IS_PWR_WAKEUP_PIN.

void HAL_PWR_EnablePVD ( void  )

Enable the Programmable Voltage Detector (PVD).

Return values:
None.

Definition at line 470 of file stm32h7xx_hal_pwr.c.

void HAL_PWR_EnableSEVOnPend ( void  )

Enable CORTEX SEVONPEND feature.

Note:
Sets SEVONPEND bit of SCR register. When this bit is set, any pending event / interrupt even if it's disabled or has insufficient priority to cause exception entry wakes up the Cortex-Mx.
Return values:
None.

Definition at line 764 of file stm32h7xx_hal_pwr.c.

void HAL_PWR_EnableSleepOnExit ( void  )

Indicate Sleep-On-Exit feature 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 738 of file stm32h7xx_hal_pwr.c.

void HAL_PWR_EnableWakeUpPin ( uint32_t  WakeUpPinPolarity)

Enable the WakeUp PINx functionality.

Parameters:
WakeUpPinPolarity: Specifies which Wake-Up pin to enable. This parameter can be one of the following legacy values, which sets the default (rising edge):
  • PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3, PWR_WAKEUP_PIN4, PWR_WAKEUP_PIN5, PWR_WAKEUP_PIN6. or one of the following values where the user can explicitly states the enabled pin and the chosen polarity:
  • PWR_WAKEUP_PIN1_HIGH, PWR_WAKEUP_PIN1_LOW, PWR_WAKEUP_PIN2_HIGH, PWR_WAKEUP_PIN2_LOW, PWR_WAKEUP_PIN3_HIGH, PWR_WAKEUP_PIN3_LOW, PWR_WAKEUP_PIN4_HIGH, PWR_WAKEUP_PIN4_LOW, PWR_WAKEUP_PIN5_HIGH, PWR_WAKEUP_PIN5_LOW, PWR_WAKEUP_PIN6_HIGH, PWR_WAKEUP_PIN6_LOW.
Note:
PWR_WAKEUP_PINx and PWR_WAKEUP_PINx_HIGH are equivalent.
The PWR_WAKEUP_PIN3_HIGH, PWR_WAKEUP_PIN3_LOW, PWR_WAKEUP_PIN5_HIGH and PWR_WAKEUP_PIN5_LOW are available only for devices that includes GPIOI port.
Return values:
None.

Definition at line 507 of file stm32h7xx_hal_pwr.c.

References assert_param, IS_PWR_WAKEUP_PIN, and PWR_EWUP_MASK.

void HAL_PWR_EnterSLEEPMode ( uint32_t  Regulator,
uint8_t  SLEEPEntry 
)

Enter the current core in SLEEP mode (CSLEEP).

Parameters:
Regulator: Specifies the regulator state in SLEEP mode. This parameter can be one of the following values:
  • PWR_MAINREGULATOR_ON : SLEEP mode with regulator ON.
  • PWR_LOWPOWERREGULATOR_ON : SLEEP mode with low power regulator ON.
Note:
This parameter is not used for the STM32H7 family and is kept as parameter just to maintain compatibility with the lower power families.
Parameters:
SLEEPEntry: Specifies if SLEEP mode is entered with WFI or WFE intrinsic instruction. This parameter can be one of the following values:
  • PWR_SLEEPENTRY_WFI : enter SLEEP mode with WFI instruction.
  • PWR_SLEEPENTRY_WFE : enter SLEEP mode with WFE instruction.
Note:
Ensure to clear pending events before calling this API through HAL_PWREx_ClearPendingEvent() when the SLEEP entry is WFE.
Return values:
None.

Definition at line 564 of file stm32h7xx_hal_pwr.c.

References assert_param, IS_PWR_REGULATOR, IS_PWR_SLEEP_ENTRY, and PWR_SLEEPENTRY_WFI.

void HAL_PWR_EnterSTANDBYMode ( void  )

Enter STANDBY mode.

Note:
For single core devices, this API will enter the system in STANDBY mode with all domains in DSTANDBY, if RUN_D3/RUN_SRD bit in CPUCR register is cleared. For dual core devices, this API will enter the domain (containing Cortex-Mx that executing this function) in DSTANDBY mode. If all Cortex-Mx domains are in DSTANDBY and RUN_D3 bit in CPUCR register is cleared, all the system will enter in STANDBY mode.
The system enters Standby mode only when all domains are in DSTANDBY.
When the System exit STANDBY mode by issuing an interrupt or a wakeup event, the HSI RC oscillator is selected as system clock.
It is recommended to disable all regulators before entring STANDBY mode for power consumption saving purpose.
Return values:
None.

Definition at line 686 of file stm32h7xx_hal_pwr.c.

References CM7_CPUID, and HAL_GetCurrentCPUID().

void HAL_PWR_EnterSTOPMode ( uint32_t  Regulator,
uint8_t  STOPEntry 
)

Enter STOP mode.

Note:
For single core devices, this API will enter the system in STOP mode with all domains in DSTOP, if RUN_D3/RUN_SRD bit in CPUCR register is cleared. For dual core devices, this API will enter the domain (containing Cortex-Mx that executing this function) in DSTOP mode. If all Cortex-Mx domains are in DSTOP and RUN_D3 bit in CPUCR register is cleared, all the system will enter in STOP mode.
Parameters:
Regulator: Specifies the regulator state in STOP mode. This parameter can be one of the following values:
  • PWR_MAINREGULATOR_ON : STOP mode with regulator ON.
  • PWR_LOWPOWERREGULATOR_ON : STOP mode with low power regulator ON.
STOPEntry: Specifies if STOP mode in entered with WFI or WFE intrinsic instruction. This parameter can be one of the following values:
  • PWR_STOPENTRY_WFI : Enter STOP mode with WFI instruction.
  • PWR_STOPENTRY_WFE : Enter STOP mode with WFE instruction.
Note:
In System STOP mode, all I/O pins keep the same state as in Run mode.
When exiting System STOP mode by issuing an interrupt or a wakeup event, the HSI RC oscillator is selected as default system wakeup clock.
In System STOP mode, when the voltage regulator operates in low power mode, an additional startup delay is incurred when the system is waking up. By keeping the internal regulator ON during STOP mode, the consumption is higher although the startup time is reduced.
Return values:
None.

Definition at line 615 of file stm32h7xx_hal_pwr.c.

References assert_param, CM7_CPUID, HAL_GetCurrentCPUID(), IS_PWR_REGULATOR, IS_PWR_STOP_ENTRY, and PWR_STOPENTRY_WFI.

void HAL_PWR_PVD_IRQHandler ( void  )

This function handles the PWR PVD interrupt request.

Note:
This API should be called under the PVD_AVD_IRQHandler().
Return values:
None.

Definition at line 805 of file stm32h7xx_hal_pwr.c.

References __HAL_PWR_PVD_EXTI_CLEAR_FLAG, __HAL_PWR_PVD_EXTI_GET_FLAG, CM7_CPUID, HAL_GetCurrentCPUID(), and HAL_PWR_PVDCallback().

void HAL_PWR_PVDCallback ( void  )

PWR PVD interrupt callback.

Return values:
None.

Definition at line 850 of file stm32h7xx_hal_pwr.c.

Referenced by HAL_PWR_PVD_IRQHandler(), and HAL_PWREx_PVD_AVD_IRQHandler().