Which pins can be used as external interrupts on the SAMD21?

The SAMD21 family of microcontrollers features the EIC (External Interrupt Controller) module which you can use to have up to 16 external interrupts on rising, falling or both edges.

External interrupts are only possible on the EXTINT0 to EXTINT15 pins (each of the EXTINTs is called an external interrupt line, e.g. EXTINT0 is called external interrupt line 0).

Every PA and every PB pin is assigned to one of the external interrupt lines! However, if you use multiple external interrupts on the same external interrupt line, you need to do extra work in the firmware to distinguish which specific pin the interrupt came from.

Therefore, I recommend that you use each external interrupt line (EXTINT0 to EXTINT15) only once, if possible.

Here is our table that shows which pin is connected to which interrupt line:

SAMD21 external interrupts

PinExternal interrupt
PA00EXTINT0
PA01EXTINT1
PA02EXTINT2
PA03EXTINT3
PA04EXTINT4
PA05EXTINT5
PA06EXTINT6
PA07EXTINT7
PA08NMI*
PA09EXTINT9
PA10EXTINT10
PA11EXTINT11
PA12EXTINT12
PA13EXTINT13
PA14EXTINT14
PA15EXTINT15
PA16EXTINT0
PA17EXTINT1
PA18EXTINT2
PA19EXTINT3
PA20EXTINT4
PA21EXTINT5
PA22EXTINT6
PA23EXTINT7
PA24EXTINT12
PA25EXTINT13
PA27EXTINT15
PA28EXTINT8
PA30EXTINT10
PA31EXTINT11
PB00EXTINT0
PB01EXTINT1
PB02EXTINT2
PB03EXTINT3
PB04EXTINT4
PB05EXTINT5
PB06EXTINT6
PB07EXTINT7
PB08EXTINT8
PB09EXTINT9
PB10EXTINT10
PB11EXTINT11
PB12EXTINT12
PB13EXTINT13
PB14EXTINT14
PB15EXTINT15
PB16EXTINT0
PB17EXTINT1
PB21EXTINT5
PB22EXTINT6
PB23EXTINT7
PB27EXTINT15
PB28EXTINT8
PB30EXTINT10
PB31EXTINT11

*The NMI (non-maskable interrupt) is somewhat special and is not covered in this article. I recommend not to use it for general purpose external interrupts.