Need to enable AFIO before trying to adjust bits there.
Signed-off-by: Keith Packard <keithp@keithp.com>
/* 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 &
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)