aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/modmachine.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm32/modmachine.c')
-rw-r--r--ports/stm32/modmachine.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c
index 7db8e2964..19f58a98d 100644
--- a/ports/stm32/modmachine.c
+++ b/ports/stm32/modmachine.c
@@ -310,6 +310,11 @@ STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
#else
mp_int_t sysclk = mp_obj_get_int(args[0]);
mp_int_t ahb = sysclk;
+ #if defined (STM32H7)
+ if (ahb > 200000000) {
+ ahb /= 2;
+ }
+ #endif
mp_int_t apb1 = ahb / 4;
mp_int_t apb2 = ahb / 2;
if (n_args > 1) {