HAL PWR How to Use ¶
- group PWR_How_To_Use
-
PWR peripheral overview ¶
The Power control peripheral (PWR) provides an overview of the supply architecture for the different power domains and of the supply configuration controller.
This file provides firmware functions to manage the following functionalities :
-
Wakeup pins management functions.
-
RTC domain write protection management functions.
-
Main regulator management functions.
-
Low power mode management functions.
-
Voltage monitoring management functions.
-
Items retention management functions.
-
Items fast wakeup management functions.
-
Battery management functions.
-
I/O Pull management functions.
How to use the PWR HAL module driver ¶
The PWR HAL driver can be used as follows: ¶
This module manages all device power supplies and power modes transitions
After startup, power management peripheral is not active by default. Use HAL_RCC_PWR_EnableClock() function to enable power interface.
This module provides 9 different set of APIs that allows to :
-
Configure the wakeup pin : The wakeup pin is used to wakeup the system from low power modes.
-
Configure the wakeup pin polarity and selection independently and without enabling it :
-
This functionality is ensured by HAL_PWR_LP_SetConfigWakeupPin() function. The p_config pointer allows to configure wakeup polarity and selection.
-
When p_config is null,this function returns an HAL_INVALID_PARAM.
-
-
-
Get the wakeup pin polarity and selection configuration:
-
This functionality is ensured by HAL_PWR_LP_GetConfigWakeupPin() function.
-
-
Enable, disable and check the wakeup pin :
-
These functionalities are ensured respectively by HAL_PWR_LP_EnableWakeupPin() , HAL_PWR_LP_DisableWakeupPin() and HAL_PWR_LP_IsEnabledWakeupPin() functions.
-
-
-
Manage the RTC domain write protection : After a system reset, the RTC domain is protected against possible unwanted write accesses.
-
Enable, disable and check the write access to RTC domain :
-
These functionalities are ensured respectively by HAL_PWR_EnableRTCDomainWriteProtection() , HAL_PWR_DisableRTCDomainWriteProtection() and HAL_PWR_IsEnabledRTCDomainWriteProtection() functions.
-
-
-
Control power supply : The power supplies can be configured to manage application power consumption and performance.
-
Configure the main regulator voltage scaling range for different power modes :
-
This functionality is ensured by HAL_PWR_SetMainRegulatorVoltageScalingRange() function.
-
-
Get the voltage scaling range configuration :
-
This functionality is ensured by HAL_PWR_GetMainRegulatorVoltageScalingRange() function.
-
-
Configure the main regulator supply:
-
This functionality is ensured by HAL_PWR_SetMainRegulatorSupply() function.
-
-
Get the main regulator supply configuration :
-
This functionality is ensured by HAL_PWR_GetMainRegulatorSupply() function.
-
-
Set and get the main regulator fast startup mode:
-
These functionalities are ensured respectively by HAL_PWR_SetMainRegulatorStartupMode() and HAL_PWR_GetMainRegulatorStartupMode() functions.
-
-
Configure the analog IO switch supply:
-
This functionality is ensured by HAL_PWR_SetAnalogIOSwitchSupply() function.
-
-
Get the analog IO switch supply:
-
This functionality is ensured by HAL_PWR_GetAnalogIOSwitchSupply() function.
-
-
Enable, disable and check the Vdd USB independent supply:
-
These functionalities are ensured respectively by HAL_PWR_EnableVddUSBIndependentSupply() , HAL_PWR_DisableVddUSBIndependentSupply() and HAL_PWR_IsEnabledVddUSBIndependentSupply() functions.
-
-
Enable, disable and check the Vdd IO2 independent supply:
-
These functionalities are ensured respectively by HAL_PWR_EnableVddIO2IndependentSupply() , HAL_PWR_DisableVddIO2IndependentSupply() and HAL_PWR_IsEnabledVddIO2IndependentSupply() functions.
-
-
Enable, disable and check the Vdd analog independent supply:
-
These functionalities are ensured respectively by HAL_PWR_EnableVddAIndependentSupply() , HAL_PWR_DisableVddAIndependentSupply() and HAL_PWR_IsEnabledVddAIndependentSupply() functions.
-
-
Enable, disable and check the Vdd11 USB independent supply: (*)
-
These functionalities are ensured respectively by HAL_PWR_EnableVdd11USBIndependentSupply() , HAL_PWR_DisableVdd11USBIndependentSupply() and HAL_PWR_IsEnabledVdd11USBIndependentSupply() functions.
-
-
Enable, disable and check the internal USB HS transceiver supply: (*)
-
These functionalities are ensured respectively by HAL_PWR_EnableVddUSBHSTransceiverSupply() , HAL_PWR_DisableVddUSBHSTransceiverSupply() and HAL_PWR_IsEnabledVddUSBHSTransceiverSupply() functions.
-
(*) feature not available in all devices
-
-
-
Manage low power mode: Several power modes are available to manage power consumption.
-
Clear Core pending event to clear internal cortex event before entring sleep or stop mode:
-
This functionality is ensured by HAL_PWR_ClearCorePendingEvent() function.
-
-
Enter the MCU to low power modes:
-
Enter the MCU to sleep mode through WFE or WFI request:
-
This functionality is ensured by HAL_PWR_EnterSleepMode() function.
-
-
Enter the MCU to stop x mode through WFE or WFI request:
-
This functionality is ensured by HAL_PWR_EnterStopMode() function.
-
-
Enter the MCU to standby mode:
-
This functionality is ensured by HAL_PWR_EnterStandbyMode() function.
-
-
Enter the MCU to shutdown mode:
-
This functionality is ensured by HAL_PWR_EnterShutdownMode() function.
-
-
-
Configure the core deep sleep mode:
-
This functionality is ensured by HAL_PWR_SetCoreSleepMode() function.
-
-
Get the core deep sleep mode configuration:
-
This functionality is ensured by HAL_PWR_GetCoreSleepMode() function.
-
-
Enable and disable and check the core sleep on exit to re-entry in sleep mode after an interruption is over:
-
These functionalities are ensured respectively by HAL_PWR_EnableCoreSleepOnExit() , HAL_PWR_DisableCoreSleepOnExit() and HAL_PWR_IsEnabledCoreSleepOnExit() functions.
-
-
Enable, disable and check the core send event on pending to wakeup after any pending event/ interrupt:
-
these functionalities are ensured respectively by HAL_PWR_EnableCoreSendEventOnPending() , HAL_PWR_DisableCoreSendEventOnPending() and HAL_PWR_IsEnabledCoreSendEventOnPending() functions.
-
-
Set the Smart Run Domain mode when the system in stop mode (stop 0/1/2):
-
This functionality is ensured by HAL_PWR_LP_SetSmartRunDomainMode() function.
-
-
Get the SmartRun Domain state when the system in stop mode (stop 0/1/2):
-
This functionality is ensured by HAL_PWR_LP_GetSmartRunDomainMode() function.
-
-
Set the brownout reset mode in standby mode:
-
This functionality is ensured by HAL_PWR_LP_SetBrownoutResetMode() function.
-
-
Get the brownout reset mode:
-
This functionality is ensured by HAL_PWR_LP_GetBrownoutResetMode() function.
-
-
Handle the PWR wakeup interrupt from stop 3:
-
This functionality is ensured by HAL_PWR_Stop3Wakeup_IRQHandler() function.
-
-
-
Monitor configuration: The monitor can be used to manage the power supplies and supply domains.
-
Configure the voltage threshold detector by the programmable voltage detector:
-
This functionality is ensured by HAL_PWR_SetProgrammableVoltageDetectorLevel() function.
-
-
Get the programmable voltage detector configuration:
-
This functionality is ensured by HAL_PWR_GetProgrammableVoltageDetectorLevel() function.
-
-
Enable, disable and check the programmable voltage detector:
-
These functionalities are ensured respectively by HAL_PWR_EnableProgrammableVoltageDetector() , HAL_PWR_DisableProgrammableVoltageDetector() and HAL_PWR_IsEnabledProgrammableVoltageDetector() functions.
-
-
Enable, disable and check the Vdd USB voltage monitor:
-
These functionalities are ensured respectively by HAL_PWR_EnableVddUSBMonitor() , HAL_PWR_DisableVddUSBMonitor() and HAL_PWR_IsEnabledVddUSBMonitor() functions.
-
-
Enable, disable and check the Vdd IO2 voltage monitor:
-
These functionalities are ensured respectively by HAL_PWR_EnableVddIO2Monitor() , HAL_PWR_DisableVddIO2Monitor() and HAL_PWR_IsEnabledVddIO2Monitor() functions.
-
-
Enable, disable and check the Vdd Analog voltage monitor 1:
-
These functionalities are ensured respectively by HAL_PWR_EnableVddAMonitor1() , HAL_PWR_DisableVddAMonitor1() and HAL_PWR_IsEnabledVddAMonitor1() functions.
-
-
Enable, disable and check the Vdd Analog voltage monitor 2:
-
These functionalities are ensured respectively by HAL_PWR_EnableVddAMonitor2() , HAL_PWR_DisableVddAMonitor2() and HAL_PWR_IsEnabledVddAMonitor2() functions.
-
-
Enable, disable and check the temperature and VBAT monitor:
-
These functionalities are ensured respectively by HAL_PWR_EnableTemperatureVbatMonitor() , HAL_PWR_DisableTemperatureVbatMonitor() and HAL_PWR_IsEnabledTemperatureVbatMonitor() functions.
-
-
-
Manage memory retention: After entering low power mode, the memories content retention can be managed.
-
Enable, disable and check memory retention:
-
These functionalities are ensured by HAL_PWR_LP_EnableMemoryRetention() , HAL_PWR_LP_DisableMemoryRetention() and HAL_PWR_LP_IsEnabledMemoryRetention() functions.
-
-
Enable, disable and check the memory pages retention:
-
These functionalities are ensured respectively by HAL_PWR_LP_EnableMemoryPageRetention() , HAL_PWR_LP_DisableMemoryPageRetention() and HAL_PWR_LP_IsEnabledMemoryPageRetention() functions.
-
-
Enable, disable and check the UCPD retention: (*)
-
These functionalities are ensured by HAL_PWR_LP_EnableUCPDRetention() , HAL_PWR_LP_DisableUCPDRetention() and HAL_PWR_LP_IsEnabledUCPDRetention() functions.
-
-
Enable, disable and check the OTG HS PHY power during low power modes (Stop2, 3 and Standby): (*)
-
These functionalities are ensured respectively by HAL_PWR_LP_EnableOTGHSPHYRetention() , HAL_PWR_LP_DisableOTGHSPHYRetention() and HAL_PWR_LP_IsEnabledOTGHSPHYRetention() functions.
-
(*) feature not available in all devices
-
-
-
Manage memories wakeup: This feature is used to obtain the best trade-off between low-power consumption and wakeup time when exiting the Stop x modes.
-
Enable, disable and check the memories fast wakeup:
-
These functonalities are ensured respectively by HAL_PWR_LP_EnableMemoryFastWakeup() , HAL_PWR_LP_DisableMemoryFastWakeup() and HAL_PWR_LP_IsEnabledMemoryFastWakeup() functions.
-
-
-
Control the battery Backup domain: Several API are available to retain the content of the backup registers:
-
Configure the battery charging resistor:
-
This functionality is ensured by HAL_PWR_SetConfigBatteryCharging() function.
-
-
Get the battery charging resistor configuration:
-
This functionality is ensured by HAL_PWR_GetConfigBatteryCharging() function.
-
-
Enable, disable and check the battery charging:
-
These functionalities are ensured by HAL_PWR_EnableBatteryCharging() , HAL_PWR_DisableBatteryCharging() and HAL_PWR_IsEnabledBatteryCharging() functions respectively to enable, disable and check that enabled or not.
-
-
Enable, disable and check the UCPD dead battery: (*)
-
These functionalies are ensured respectively by HAL_PWR_LP_EnableUCPDDeadBattery() , HAL_PWR_LP_DisableUCPDDeadBattery() and HAL_PWR_LP_IsEnabledUCPDDeadBattery() functions.
-
(*) feature not available in all devices
-
-
-
Control Power GPIO Pull: Several API are available to control the power GPIO pull.
-
Configure the GPIO Pull:
-
This functionality is ensured by HAL_PWR_SetConfigGPIOPull() function.
-
-
Get the GPIO Pull configuration:
-
This functionality is ensured by HAL_PWR_GetConfigGPIOPull() function.
-
-
Enable, disable and check GPIO Pull configuration:
-
These functionalities are ansured respectively by HAL_PWR_EnableGPIOPull() , HAL_PWR_DisableGPIOPull() and HAL_PWR_IsEnabledGPIOPull() functions.
-
-
-