src/stm32f1: Disable extra JTAG pins in ao_clock_init
authorKeith Packard <keithp@keithp.com>
Wed, 24 Jan 2024 23:36:34 +0000 (15:36 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 1 Feb 2024 01:50:19 +0000 (17:50 -0800)
Need to enable AFIO before trying to adjust bits there.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm32f1/ao_clock.c
src/stm32f1/stm32f1.h

index 52830117cdf83ba1b200150b0d0baafa734b3ccf..899923dc5cfc0f501db1a554f774e4071b7b1b41 100644 (file)
@@ -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 &
index 532cd052c32c72f6edea6337f5bb10b368ac352e..bf96fbbc8549c21382dbea5b9458268dbe8ec515 100644 (file)
@@ -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)