From 9a5cd9e64a66829fb0cd3713c5cbd41085641db3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 24 Jan 2024 15:36:34 -0800 Subject: [PATCH] src/stm32f1: Disable extra JTAG pins in ao_clock_init Need to enable AFIO before trying to adjust bits there. Signed-off-by: Keith Packard --- src/stm32f1/ao_clock.c | 2 ++ src/stm32f1/stm32f1.h | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stm32f1/ao_clock.c b/src/stm32f1/ao_clock.c index 52830117..899923dc 100644 --- a/src/stm32f1/ao_clock.c +++ b/src/stm32f1/ao_clock.c @@ -181,6 +181,8 @@ ao_clock_init(void) /* Clear reset flags */ stm_rcc.csr |= (1 << STM_RCC_CSR_RMVF); + /* Enable AFIO */ + stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_AFIOEN); /* Release PB3, PA15 and PB4 from JTAG use */ stm_afio.mapr = (stm_afio.mapr & diff --git a/src/stm32f1/stm32f1.h b/src/stm32f1/stm32f1.h index 532cd052..bf96fbbc 100644 --- a/src/stm32f1/stm32f1.h +++ b/src/stm32f1/stm32f1.h @@ -1187,9 +1187,6 @@ stm_exticr_set(struct stm_gpio *gpio, int pin) { uint8_t shift = (pin & 3) << 2; uint8_t val = 0; - /* Enable AFIO */ - stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_AFIOEN); - if (gpio == &stm_gpioa) val = STM_AFIO_EXTICR_PA; else if (gpio == &stm_gpiob) -- 2.30.2