From 689c2f9baf835b55cdbb68d78b0913d8ca6df317 Mon Sep 17 00:00:00 2001 From: Arksine <9563098+Arksine@users.noreply.github.com> Date: Sat, 3 Apr 2021 06:54:07 -0400 Subject: [PATCH] stm32f1: reset peripherals in enable_pcclock() Some bootloaders do not disable peripherals in use before jumping to the application. Reset peripherals to assure correct operation. SIgned-off-by: Eric Callahan --- src/stm32/stm32f1.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c index ae8fcd67..34c28573 100644 --- a/src/stm32/stm32f1.c +++ b/src/stm32/stm32f1.c @@ -21,10 +21,14 @@ enable_pclock(uint32_t periph_base) uint32_t pos = (periph_base - APB1PERIPH_BASE) / 0x400; RCC->APB1ENR |= (1<APB1ENR; + RCC->APB1RSTR |= (1<APB1RSTR &= ~(1<APB2ENR |= (1<APB2ENR; + RCC->APB2RSTR |= (1<APB2RSTR &= ~(1<AHBENR |= (1<