Contents UM0306
4/519
5.1.6 GPIO locking mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.1.7 Input configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.1.8 Output configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.1.9 Alternate function configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.1.10 Analog input configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.2 GPIO register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
5.2.1 Port configuration register low (GPIOx_CRL) (x=A..E) . . . . . . . . . . . . . 80
5.2.2 Port configuration register high (GPIOx_CRH) (x=A..E) . . . . . . . . . . . . 81
5.2.3 Port input data register (GPIOx_IDR) (x=A..E) . . . . . . . . . . . . . . . . . . . 82
5.2.4 Port output data register (GPIOx_ODR) (x=A..E) . . . . . . . . . . . . . . . . . 83
5.2.5 Port bit set/reset register (GPIOx_BSRR) (x=A..E) . . . . . . . . . . . . . . . . 84
5.2.6 Port bit reset register (GPIOx_BRR) (x=A..E) . . . . . . . . . . . . . . . . . . . . 85
5.2.7 Port configuration lock register (GPIOx_LCKR) (x=A..E) . . . . . . . . . . . 86
5.3 Alternate function I/O and debug configuration (AFIO) . . . . . . . . . . . . . . 87
5.3.1 Using OSC_IN/OSC_OUT pins as GPIO ports PD0/PD1 . . . . . . . . . . . 87
5.3.2 BXCAN alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.3.3 JTAG/SWD alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . 87
5.3.4 Timer alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
5.3.5 USART Alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.3.6 I2C 1 alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.3.7 SPI 1 alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.4 AFIO register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.4.1 AF remap and debug I/O configuration register (AFIO_MAPR) . . . . . . . 92
5.4.2 External interrupt configuration register 1 (AFIO_EXTICR1) . . . . . . . . . 95
5.4.3 External interrupt configuration register 2 (AFIO_EXTICR2) . . . . . . . . . 95
5.4.4 External interrupt configuration register 3 (AFIO_EXTICR3) . . . . . . . . . 96
5.4.5 External interrupt configuration register 4 (AFIO_EXTICR4) . . . . . . . . . 96
5.5 GPIO and AFIO register maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.5.1 GPIO register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.5.2 AFIO register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
6 Interrupts and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.1 Nested vectored interrupt controller (NVIC) . . . . . . . . . . . . . . . . . . . . . . . 98
6.1.1 SysTick calibration value register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.1.2 Interrupt and exception vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.2 External interrupt/event controller (EXTI) . . . . . . . . . . . . . . . . . . . . . . . . 101