STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
pwr.h File Reference

PWR driver: regulator voltage scale and over-drive. More...

#include "driver_status.h"
#include "pwr_reg.h"
#include <stdint.h>
Include dependency graph for pwr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

DRIVER_MUST_CHECK DriverStatus_e pwrSetVoltageScale (PwrRegisters_t *pwr, uint32_t vos)
 Select the regulator voltage scale for the coming PLL frequency.
DRIVER_MUST_CHECK DriverStatus_e pwrWaitVoltageScaleReady (const PwrRegisters_t *pwr)
 Wait until the regulator reaches the selected scale (CSR.VOSRDY).
DRIVER_MUST_CHECK DriverStatus_e pwrEnableOverdrive (PwrRegisters_t *pwr)
 Enable over-drive, to run above the scale's normal maximum.

Detailed Description

PWR driver: regulator voltage scale and over-drive.

Voltage scaling is split around the PLL: CR.VOS can be written only while the PLL is off, and the regulator reaches the new scale only once the PLL is on. So pwrSetVoltageScale() runs before rccPllEnable() and pwrWaitVoltageScaleReady() after it. See rcc.h for the full order and Clock bring-up order.

// ... rccPllConfig(), rccPllEnable() ...
if (pwrEnableOverdrive(PWR) != DRIVER_STATUS_OK) { ... } // only for 180 MHz
@ DRIVER_STATUS_OK
Succeeded.
DRIVER_MUST_CHECK DriverStatus_e pwrEnableOverdrive(PwrRegisters_t *pwr)
Enable over-drive, to run above the scale's normal maximum.
Definition pwr.c:63
DRIVER_MUST_CHECK DriverStatus_e pwrWaitVoltageScaleReady(const PwrRegisters_t *pwr)
Wait until the regulator reaches the selected scale (CSR.VOSRDY).
Definition pwr.c:58
DRIVER_MUST_CHECK DriverStatus_e pwrSetVoltageScale(PwrRegisters_t *pwr, uint32_t vos)
Select the regulator voltage scale for the coming PLL frequency.
Definition pwr.c:42
#define PWR
The PWR instance.
Definition pwr_reg.h:28
#define PWR_CR_VOS_SCALE1
Scale 1: highest maximum frequency (reset value).
Definition pwr_reg.h:69
void rccPwrClockEnable(RccRegisters_t *rcc)
Enable PWR's clock; needed before any PWR access.
Definition rcc.c:129
#define RCC
The RCC instance.
Definition rcc_reg.h:61

Maximum HCLK per scale (RM0390 section 3.4.1):

Scale Normal With over-drive
3 120 MHz -
2 144 MHz 168 MHz
1 168 MHz 180 MHz

Definition in file pwr.h.