Which pins can be used as external interrupts on the SAMD21?
The SAMD21 family of microcontrollers features the EIC (External Interrupt Controller) modulewhich 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:
[table id=1 /]
*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.