Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Interrupts in the RP2040

In the previous chapter, we looked at what interrupts are and the role of the NVIC. Now, lets look at which interrupts are actually available on the RP2040.

Interrupts fall into two groups: system exceptions and external interrupts.

System exceptions are defined by the CPU architecture itself. These include reset and fault handlers. They behave the same way across most Cortex-M chips.

External interrupts come from peripherals on the RP2040. Each peripheral that can generate an interrupt has an IRQ number and a vector name. These are the names you will see in code.

The table below shows the external interrupts on the RP2040, numbered from 0 to 25. They cover common peripherals such as timers, GPIO, DMA, and communication interfaces like I2C, SPI, and UART.

You do not need to memorize this table. Its purpose is to help you recognize where names like I2C0_IRQ or UART0_IRQ come from when you see them in examples or documentation.

The full details are in the RP2040 datasheet, section 2.3.2 on page 60.

Important note: The RP2040 has two Cortex-M0+ cores, each with its own NVIC. On each core, only the lower 26 IRQ signals (0-25) are connected to hardware peripherals. IRQs 26-31 are not connected and will never fire.

In the next chapter, we will see how Embassy uses these interrupts without requiring you to write interrupt handlers manually.

RP2040 External Interrupts

The RP2040 has 26 external hardware interrupt lines (IRQ 0-25) connected to each core’s NVIC. IRQs 26-31 exist in the NVIC but are not connected to hardware peripherals and will never fire from hardware.

Timers

IRQVectorDescription
0TIMER_IRQ_0Timer alarm 0
1TIMER_IRQ_1Timer alarm 1
2TIMER_IRQ_2Timer alarm 2
3TIMER_IRQ_3Timer alarm 3

PWM

IRQVectorDescription
4PWM_IRQ_WRAPShared PWM interrupt (all slices)

USB

IRQVectorDescription
5USBCTRL_IRQUSB controller interrupt

External Flash (XIP)

IRQVectorDescription
6XIP_IRQXIP interface interrupt

PIO

IRQVectorDescription
7PIO0_IRQ_0PIO 0 interrupt 0
8PIO0_IRQ_1PIO 0 interrupt 1
9PIO1_IRQ_0PIO 1 interrupt 0
10PIO1_IRQ_1PIO 1 interrupt 1

DMA

IRQVectorDescription
11DMA_IRQ_0DMA interrupt 0
12DMA_IRQ_1DMA interrupt 1

GPIO and Core I/O

IRQVectorDescription
13IO_IRQ_BANK0GPIO bank 0 interrupt
14IO_IRQ_QSPIQSPI IO bank interrupt
15SIO_IRQ_PROC0Core 0 SIO interrupt
16SIO_IRQ_PROC1Core 1 SIO interrupt

Clock

IRQVectorDescription
17CLOCKS_IRQClock system interrupt

SPI

IRQVectorDescription
18SPI0_IRQSPI0 interrupt
19SPI1_IRQSPI1 interrupt

UART

IRQVectorDescription
20UART0_IRQUART0 interrupt
21UART1_IRQUART1 interrupt

ADC

IRQVectorDescription
22ADC_IRQ_FIFOADC FIFO interrupt

I2C

IRQVectorDescription
23I2C0_IRQI2C0 interrupt
24I2C1_IRQI2C1 interrupt

Real-Time Clock

IRQVectorDescription
25RTC_IRQRTC interrupt