HAL PWR use cases

User application Wake-up pin

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group Wake-up management

...

group #4ef84e Wake-up pin management 

"part1"->"part2" : HAL_PWR_LP_SetConfigWakeupPin()

activate "part2"

"part2"-->"part1": hal_status

note right:- Set wake-up polarity \n- Set wake-up source

"part1"->"part2" : HAL_PWR_LP_GetConfigWakeupPin()

note right:- Get wake-up polarity \n- Get wake-up source

end 

deactivate "part2"



group #lightblue Wake-up pin activation 

"part1"->"part2" : HAL_PWR_LP_EnableWakeupPin()

activate "part2"

"part1"->"part2"  : HAL_PWR_LP_IsEnabledWakeupPin()

note right: Enable wake-up pin

"part2"-->"part1" : Wake-up pins is enabled

deactivate "part2"

"part1"->"part2" : HAL_PWR_LP_DisableWakeupPin()

activate "part2"

"part1"->"part2"  : HAL_PWR_LP_IsEnabledWakeupPin()

note right: Disable wake-up pin

"part2"-->"part1" : Wake-up pins is disabled

deactivate "part2"

end

end

@enduml

Called functions:

User application RTC domain write protection

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue RTC domain write protection activation

"part1"->"part2" : HAL_PWR_EnableRTCDomainWriteProtection()

activate "part2"

"part1"->"part2" : HAL_PWR_IsEnabledRTCDomainWriteProtection()

note right: Enable RTC write protection

"part2"-->"part1" : RTC write protection state

deactivate "part2"

"part1"->"part2" : HAL_PWR_DisableRTCDomainWriteProtection()

activate "part2"

"part1"->"part2" : HAL_PWR_IsEnabledRTCDomainWriteProtection()

note right: Disable RTC write protection

"part2"-->"part1" : RTC write protection state

end

deactivate "part2"

@enduml

Called functions:

User application regulator voltage scaling range

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #4ef84e Regulator voltage scaling range management

"part1"->"part2" : HAL_PWR_SetMainRegulatorVoltageScalingRange()

activate "part2"

"part2"-->"part1" : hal_status

note right: Set regulator voltage scaling range

"part1"->"part2" : HAL_PWR_GetMainRegulatorVoltageScalingRange()

"part2"-->"part1" : Voltage scaling range

note right: Get regulator voltage scaling range

end

deactivate "part2"

@enduml

Called functions:

User application regulator supply

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #4ef84e Regulator supply management

"part1"->"part2" : HAL_PWR_SetMainRegulatorSupply()

activate "part2"

"part2"-->"part1" : hal_status

note right:- Set main regulator supply

"part1"->"part2" : HAL_PWR_GetMainRegulatorSupply()

"part2"-->"part1" : Main regulator supply

note right:- Get main regulator supply 

end

deactivate "part2"

@enduml

Called functions:

User application Vdd USB independent supply

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Vdd USB Independen supply

"part1"->"part2" : HAL_PWR_EnableVddUSBIndependentSupply()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledVddUSBIndependentSupply()

note right: Enable Vdd USB independent supply

"part2"-->"part1" : Vdd USB Independent supply state

deactivate "part2"

"part1"->"part2"  : HAL_PWR_DisableVddUSBIndependentSupply()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledVddUSBIndependentSupply()

note right: Disable Vdd USB independent supply

"part2"-->"part1" : Vdd USB Independent supply state

deactivate "part2"

end



group #lightblue Independent Vdd IO2 voltage supply activation

"part1"->"part2"  : HAL_PWR_EnableIndependentVddIO2Supply()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledVddIO2IndependentSupply()

note right: Enable Vdd IO2 independent supply

"part2"-->"part1" : Vdd IO2 Independent supply state

deactivate "part2"

"part1"->"part2"  : HAL_PWR_DisableIndependentVddIO2Supply()

activate "part2"

note right: Disable Vdd IO2 voltage supply

"part1"->"part2"  : HAL_PWR_IsEnabledVddIO2IndependentSupply()

"part2"-->"part1" : Vdd IO2 Independent supply state

deactivate "part2"

end



group #lightblue Independent Vdd analog voltage supply 

"part1"->"part2"  : HAL_PWR_EnableVddAIndependentSupply()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledVddAIndependentSupply()

note right: Enable Vdd analog independent supply

"part2"-->"part1" : Vdd analog Independent supply state

deactivate "part2"



"part1"->"part2"  : HAL_PWR_DisableVddAIndependentSupply()

activate "part2"

note right: Disable Vdd analog voltage supply

"part1"->"part2"  : HAL_PWR_IsEnabledVddAIndependentSupply()

"part2"-->"part1" : Vdd analog Independent supply state

deactivate "part2"

end

@enduml

Called functions:

User application Vdd USB HS transceiver supply

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue USB HS Transceiver supply activation

"part1"->"part2"  : HAL_PWR_EnableVddUSBHSTransceiverSupply()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledVddUSBHSTransceiverSupply()

note right: Enable Vdd USB HS Transceiver supply

"part2"-->"part1" : Vdd USB HS Transceiver supply state

deactivate "part2"



"part1"->"part2"  : HAL_PWR_DisableVddUSBHSTransceiverSupply()

activate "part2"

note right: Disable Vdd USB HS Transceiver supply

"part1"->"part2"  : HAL_PWR_IsEnabledVddUSBHSTransceiverSupply()

"part2"-->"part1" : Vdd USB HS Transceiver supply state

deactivate "part2"

end



@enduml

Called functions:

User application enter to sleep mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Enter Sleep mode

"part1"->"part2"  : HAL_PWR_ClearCorePendingEvent()

note right: Clear Core pending event

"part1"->"part2"  : HAL_PWR_EnterSleepMode()

note right: WFE or WFI request

end

@enduml

Called functions:

User application enter to stop mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Enter Stop modes

"part1"->"part2"  : HAL_PWR_ClearCorePendingEvent()

note right: Clear Core pending event

"part1"->"part2"  : HAL_PWR_EnterStopMode()

note right:- Set Stop x mode\n- WFE or WFI request

end

@enduml

Called functions:

User application enter to standby mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Enter Standby mode

"part1"->"part2"  : LL_PWR_ClearFlag_WU()

note right:- Clear wake-up flags

"part1"->"part2"  : HAL_PWR_EnterStandbyMode()

note right:- Set Standby mode

end

@enduml



## User application enter to shutdown mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Enter Shutdown mode

"part1"->"part2"  : LL_PWR_ClearFlag_WU()

note right:- Clear wake-up flags

"part1"->"part2"  : HAL_PWR_EnterShutdownMode()

note right:- Set shutdown mode

end

@enduml

Called functions:

User application core entering in deep sleep mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #4ef84e Core sleep mode management

"part1"->"part2"  : HAL_PWR_SetCoreSleepMode()

note right:- Set core sleep mode

"part1"->"part2"  : HAL_PWR_GetCoreSleepMode()

"part2"-->"part1"  : Core sleep mode state

note right:- Get core sleep mode configuration

end

@enduml

Called functions:

User application core sleep on exit

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Core send event on pending activation

"part1"->"part2"  : HAL_PWR_EnableCoreSleepOnExit()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledCoreSleepOnExit()

note right        : Enable core ssleep on exit

"part2"-->"part1" : Core sleep on exit state

deactivate "part2"



"part1"->"part2"  : HAL_PWR_EnableCoreSleepOnExit()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledCoreSleepOnExit()

note right        : Disable core sleep on exit

"part2"-->"part1" : Core sleep on exit state

end

deactivate "part2"



@enduml

Called functions:

User application core send event on pending

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Core send event on pending activation

"part1"->"part2"  : HAL_PWR_EnableCoreSendEventOnPending()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledCoreSendEventOnPending()

note right        : Enable core send event on pending

"part2"-->"part1" : Core send event on pending state

deactivate "part2"



"part1"->"part2"  : HAL_PWR_DisableCoreSendEventOnPending()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledCoreSendEventOnPending()

note right        : Disable core send event on pending

"part2"-->"part1" : Core send event on pending state

end

deactivate "part2"

@enduml

Called functions:

User application SmartRun domain mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #4ef84e SmartRun domain management

"part1"->"part2"  : HAL_PWR_LP_SetSmartRunDomainMode()

note right:- Set Smart Run domain

"part1"->"part2"  : HAL_PWR_LP_GetSmartRunDomainMode()

"part2"-->"part1" : Smart Run domain mode

note right:- Get Smart Run domain mode

end

@enduml



## User application brownout domain mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #4ef84e Brownout reset mode management

"part1"->"part2"  : HAL_PWR_LP_SetBrownoutResetMode()

note right:- Set Brownout reset mode

"part1"->"part2"  : HAL_PWR_LP_GetBrownoutResetMode()

"part2"-->"part1" : Brownout reset state

note right:- Get Brownout reset mode configuration

end

@enduml



## User application stop 3 wake-up on handler mode

@startuml

hide footbox

participant "User Application" as part1

participant "System" as part2

participant "PWR Driver" as part3

participant "NVIC" as part4

participant "HWR" as part5



== Initialization ==

group #LightGreen Initialization

part1 -> part2 : HAL_Init()

part1 -> part2 : Configure system clock(s)

end 



== Low power wakeup management ==

group #LightGrey Low power wakeup management

group #LightSkyBlue Wake-up pin(s) configuration(s)

part1 -> part3 : HAL_PWR_LP_SetConfigWakeupPin()

activate part3

note right: - Set wake-up polarity\n - Set wake-up source

part3 --> part1 : hal_status

deactivate part3

part1 -> part3 : HAL_PWR_LP_EnableWakeupPin()

note right: Enable wake-up pin(s)

end



group #LightSkyBlue Enter Stop 3 Mode

part1 -> part3 : HAL_PWR_EnterStopMode()

note right: Enter Stop 3 Mode

end 



group #LightSkyBlue Wakeup interrupt

part5 -> part4 : Interrupt

activate part4

part4 -> part3 : HAL_PWR_Stop3Wakeup_IRQHandler()

deactivate part4

activate part3

note right: - Clear wakeup flag\n- Call user callback

part3 -> part1 : HAL_PWR_Stop3WakeupCallback()

deactivate part3

end

end 

@enduml

Called functions:

  • HAL_PWR_LP_SetSmartRunDomainState()

  • HAL_PWR_LP_GetSmartRunDomainState()

User application programmable voltage detector

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group Programmable voltage detector

...

group #4ef84e Programmable Voltage Detector Level management

"part1"->"part2"  : HAL_PWR_SetProgrammableVoltageDetectorLevel()

note right:- Set Programmable Voltage Detector Level

"part1"->"part2"  : HAL_PWR_GetProgrammableVoltageDetectorLevel()

"part2"-->"part1" : PVD level

note right:- Get Programmable Voltage Detector Level configuration

end



group #lightblue PVD activation 

"part1"->"part2" : HAL_PWR_EnableProgrammableVoltageDetector()

activate part2

note right        :Enable PVD

"part1"->"part2" : HAL_PWR_DisableProgrammableVoltageDetector()

deactivate part2

note right        :Disable PVD

end

end

@enduml

Called functions:

User application peripheral voltage monitoring

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue PVM activation 

"part1"->"part2" : HAL_PWR_EnableVoltageMonitor()

activate part2

note right        :Enable PVM

"part1"->"part2" : HAL_PWR_DisableVoltageMonitor()

deactivate part2

note right        :Disable PVM

end

@enduml

Called functions:

  • HAL_PWR_EnableVoltageMonitor()

  • HAL_PWR_DisableVoltageMonitor()

User application memory retention

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Memory retention activation 

"part1"->"part2" : HAL_PWR_LP_EnableMemoryRetention()

activate part2

note right        :Enable memory retention

"part1"->"part2" : HAL_PWR_LP_DisableMemoryRetention()

deactivate part2

note right        :Disable memory retention

end

@enduml

Called functions:

User application memory page retention

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Memory pages retention activation 

"part1"->"part2" : HAL_PWR_LP_EnableMemoryPageRetention()

activate part2

note right        :Enable memory pages retention

"part1"->"part2" : HAL_PWR_LP_DisableMemoryPageRetention()

deactivate part2

note right        :Disable memory pages retention

end

@enduml

Called functions:

User application UCPD standby mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue UCPD standby mode activation 

"part1"->"part2" : HAL_PWR_LP_EnableUCPDRetention()

activate part2

note right        :Enable UCPD Standby mode

"part1"->"part2" : HAL_PWR_LP_DisableUCPDRetention()

deactivate part2

note right        :Disable UCPD Standby mode

end

@enduml

Called functions:

User application OTG HS PHY power in stop 2/3 and standby mode

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue OTG HS PHY power in stop 2/3 and standby activation 

"part1"->"part2" : HAL_PWR_LP_EnableOTGHSPHYRetention()

activate part2

note right        :Enable OTG HS PHY power in stop 2/3 and standby

"part1"->"part2" : HAL_PWR_LP_DisableOTGHSPHYRetention()

deactivate part2

note right        :Disable OTG HS PHY power in stop 2/3 and standby

end

@enduml

Called functions:

User application fast wake-up management

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Memory fast wake-up mode activation 

"part1"->"part2" : HAL_PWR_LP_EnableMemoryFastWakeup()

activate part2

note right        :Enable Memory fast wake-up

"part1"->"part2" : HAL_PWR_LP_DisableMemoryFastWakeup()

deactivate part2

note right        :Disable memory fast wake-up

end

@enduml

Called functions:

User application dead battery

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group #lightblue Dead battery activation 

"part1"->"part2" : HAL_PWR_LP_EnableUCPDDeadBattery()

activate part2

note right        :Enable dead battery behavior

"part1"->"part2" : HAL_PWR_LP_DisableUCPDDeadBattery()

deactivate part2

note right        :Disable dead battery behavior

end

@enduml

Called functions:

User application Backup domain control

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group Battery charging 

...

group #4ef84e Battery charging management 

"part1"->"part2" : HAL_PWR_SetConfigBatteryCharging()

activate "part2"

note right:Set battery charging resistor config

"part1"->"part2" : HAL_PWR_GetConfigBatteryCharging()

"part2"-->"part1": Battery charging resistor value

note right:Get battery charging resistor config

end 

deactivate "part2"



group #lightblue Battery charging activation 

"part1"->"part2" : HAL_PWR_EnableBatteryCharging()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledBatteryCharging()

note right:Enable Battery charging

"part2"-->"part1" : Battery charging  is enabled

deactivate "part2"

"part1"->"part2" : HAL_PWR_DisableBatteryCharging()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledBatteryCharging()

note right:Disable Battery charging

"part2"-->"part1" : Battery charging is disabled

deactivate "part2"

end

end

@enduml

Called functions:

User application Power GPIO pull

@startuml

hide footbox

participant "User Application" as part1

participant "PWR Driver" as part2



group PWR GPIO pull 

...

group #4ef84e Power GPIO management

"part1"->"part2" : HAL_PWR_SetConfigGPIOPull()

activate "part2"

note right:Set PWR GPIO pull

"part1"->"part2" : HAL_PWR_GetConfigGPIOPull()

"part2"-->"part1": PWR GPIO pull

note right:Get PWR GPIO pull config 

end 

deactivate "part2"



group #lightblue PWR GPIO pull activation 

"part1"->"part2" : HAL_PWR_EnableGPIOPull()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledGPIOPull()

note right: Enable PWR GPIO pull

"part2"-->"part1" : PWR GPIO pull is enabled

deactivate "part2"

"part1"->"part2" : HAL_PWR_DisableGPIOPull()

activate "part2"

"part1"->"part2"  : HAL_PWR_IsEnabledGPIOPull()

note right:Disable PWR GPIO pull

"part2"-->"part1" : PWR GPIO pull is disabled

deactivate "part2"

end

end

@enduml

Called functions:

  • HAL_PWR_LP_SetConfigGPIOPull()

  • HAL_PWR_LP_GetConfigGPIOPull()

  • HAL_PWR_LP_EnableGPIOPull()

  • HAL_PWR_LP_IsEnabledGPIOPull()

  • HAL_PWR_LP_DisableGPIOPull()