aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32f1.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-03-21 12:31:59 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-03-24 10:00:45 -0400
commit886530e777b80081e9837764375df059ebc58ebd (patch)
tree60b1f60671e5324450655eb8af9d5cefb260de5a /src/stm32/stm32f1.c
parent295fb7fc85781f4aee1852fc54bbf4471acedb00 (diff)
downloadkutter-886530e777b80081e9837764375df059ebc58ebd.tar.gz
kutter-886530e777b80081e9837764375df059ebc58ebd.tar.xz
kutter-886530e777b80081e9837764375df059ebc58ebd.zip
stm32: Explicitly reset peripheral clocks on stm32f1
It appears some bootloaders do not properly reset some peripherals. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/stm32f1.c')
-rw-r--r--src/stm32/stm32f1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c
index bb07d340..e5c18a83 100644
--- a/src/stm32/stm32f1.c
+++ b/src/stm32/stm32f1.c
@@ -165,6 +165,11 @@ armcm_main(void)
SystemInit();
SCB->VTOR = (uint32_t)VectorTable;
+ // Reset peripheral clocks (for some bootloaders that don't)
+ RCC->AHBENR = 0x14;
+ RCC->APB1ENR = 0;
+ RCC->APB2ENR = 0;
+
// Setup clocks
clock_setup();