summaryrefslogtreecommitdiff
path: root/ports/stm32/system_stm32.c
diff options
context:
space:
mode:
authoriabdalkader <i.abdalkader@gmail.com>2022-04-07 16:55:18 +0200
committerDamien George <damien@micropython.org>2022-04-11 16:12:53 +1000
commita3e5a68c46af76d4d6e8924388b6a943996aa95e (patch)
tree38df369d8bf373e22c5d2dfbf6c30af5c77cc674 /ports/stm32/system_stm32.c
parentbdbc9b395fb19ae7b31e9f4c6116a0bba24addd1 (diff)
stm32/system_stm32: Set voltage scaling level 0 for H7 Rev-V devices.
This enables voltage scaling level 0 for H7 Rev-V devices, which allows the CPU to run at the maximum supported operating frequency (480MHz).
Diffstat (limited to 'ports/stm32/system_stm32.c')
-rw-r--r--ports/stm32/system_stm32.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ports/stm32/system_stm32.c b/ports/stm32/system_stm32.c
index cdbfe925f..dfff803e0 100644
--- a/ports/stm32/system_stm32.c
+++ b/ports/stm32/system_stm32.c
@@ -208,7 +208,16 @@ MP_WEAK void SystemClock_Config(void) {
/* The voltage scaling allows optimizing the power consumption when the device is
clocked below the maximum system frequency, to update the voltage scaling value
regarding system frequency refer to product datasheet. */
- __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
+ #if defined(STM32H7)
+ if (HAL_GetREVID() >= 0x2003) {
+ // Enable VSCALE0 for revision V devices.
+ __HAL_RCC_SYSCFG_CLK_ENABLE();
+ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
+ } else
+ #endif
+ {
+ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
+ }
#elif defined(STM32G4)
// Configure the main internal regulator output voltage