Skip to main content

Subsection 9.3.3 Why the Mask Is Separate From the Trigger

It would be simpler to have one bit per line meaning “interrupt me on a falling edge”, and the EXTI deliberately does not provide one. Detection is configured in EXTI_FTSR1 and EXTI_RTSR1; whether a detected event reaches the CPU is configured separately in EXTI_IMR1.
The same edge can drive an event instead of an interrupt. The EXTI has two outputs, and Figure 9.2.7 shows both: the interrupt path this chapter uses, gated by EXTI_IMR1, and a parallel event path gated by EXTI_EMR1 that signals the CPU’s event input rather than requesting an interrupt. Masking the interrupt while unmasking the event is how a design gets a wake-up without a handler.
What the split does not give you is a way to poll the pending register on a masked line. RM0490 §12.3.1 is explicit: “the pending register is only set for an unmasked interrupt”, so if IM4 is 0, no falling edge on line 4 will ever set FPIF4. A program that forgets the unmask does not quietly accumulate flags it could read later; it sees nothing at all, which is worth knowing when you are looking for the bug.
A program can change its mind cheaply. Masking a line is one bit and leaves the trigger configuration intact, so turning a source off temporarily does not mean rebuilding it.
A low-power design can also choose which pins are worth waking up for. That is why the register’s full name in the reference manual is the “CPU wakeup with interrupt mask register”: in the STM32’s stop modes the EXTI is what notices the outside world, and the mask decides which pins are allowed to bring the chip back.