HAL_PWREx_ControlVoltageScaling() function
Configures the main internal regulator output voltage.
Arguments
VoltageScaling
specifies the regulator output voltage to achieve a tradeoff between performance and power consumption. This parameter can be one of the following values: @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output range 1 mode, the maximum value of fHCLK is 168 MHz. It can be extended to 180 MHz by activating the over-drive mode. @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output range 2 mode, the maximum value of fHCLK is 144 MHz. It can be extended to, 168 MHz by activating the over-drive mode. @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output range 3 mode, the maximum value of fHCLK is 120 MHz.
Return value
HAL Status
Notes
To update the system clock frequency(SYSCLK): - Set the HSI or HSE as system clock frequency using the HAL_RCC_ClockConfig(). - Call the HAL_RCC_OscConfig() to configure the PLL. - Call HAL_PWREx_ConfigVoltageScaling() API to adjust the voltage scale. - Set the new system clock frequency using the HAL_RCC_ClockConfig(). The scale can be modified only when the HSI or HSE clock source is selected as system clock source, otherwise the API returns HAL_ERROR. When the PLL is OFF, the voltage scale 3 is automatically selected and the VOS bits value in the PWR_CR1 register are not taken in account. This API forces the PLL state ON to allow the possibility to configure the voltage scale 1 or 2. The new voltage scale is active only when the PLL is ON.