STM32 gotchas
146. Only one EXTI per pin number, this means routing (which is different in 'F1 and 'G0/'C0/'L5/'U5)

Interrupt upon edge (or level) of input signal on an external pin is a feature traditionally present in perhaps all microcontrollers. Usually, the number of pins, which can be used as external interrupt, is limited and much less than all pins present on the given package.

In all STM32, there are 16 edge-triggered external pin interrupts, which are handled by the EXTI unit1. Interrupt upon rising, falling, or both edges can be selected individually, and the edge detection is asynchronous, i.e. independent on the system clock. The EXTI functionality on a selected pin is available in parallel to any other functionality of given pin, except if it's set as Analog.

External pin interrupts EXTI0..EXTI15 in STM32 are not assigned to fixed pins - there is a certain, although not unlimited, flexibility available: each EXTIn interrupt can be assigned to any of the pin with the same pin number within the port. For example, EXTI3 can be assigned to PA3, or PB3, or PC3 etc.

This means, that there must be some mechanism to select particular pin for given EXTIn interrupt. In most STM32, this selection is through the SYSCFG unit, in bitfields of SYSCFG_EXTICRx registers. However, there are exceptions:

1.In addition to pin interrupts, EXTI unit handles several internal interrupt sources (mostly wakeup-related), too. Pin interrupts are numbered EXTI0 to EXTI15. Interrupts EXTI16 and higher are from internal sources.