SriramK90
Posts: 1
Joined: Mon May 29, 2023 5:08 am

Multiple Interrupts using RPi Pico

Mon May 29, 2023 5:15 am

Hi,

I am need to interface 10 interrupts with the RPi Pico, I had read that all pins can be used as interrupt pins but the Pico has only 2 external interrupts. Is there a way to interface all the 10 interrupts with the Pico? or can they be directly connected to the board.

Thanks in advance!

alastairpatrick
Posts: 697
Joined: Fri Apr 22, 2022 1:39 am
Location: USA

Re: Multiple Interrupts using RPi Pico

Mon May 29, 2023 5:46 pm

SriramK90 wrote:
Mon May 29, 2023 5:15 am
I had read that all pins can be used as interrupt pins but the Pico has only 2 external interrupts.
I think what you mean by this is each of the two processors has separate GPIO interrupts, which is true.

Those interrupts have individual enable bits for each GPIO, so you can use a single interrupt to monitor all 10 GPIOs. For example, if you want an interrupt handler to fire on a rising edge on any of the 10 pins, that is possible.

dthacher
Posts: 915
Joined: Sun Jun 06, 2021 12:07 am

Re: Multiple Interrupts using RPi Pico

Tue May 30, 2023 8:12 am

The Cortex-M0+ only supports 32 interrupts per core. However the RP2040 has many more interrupts. What they do is use nested interrupts where a single interrupt is multiple interrupts ORed together. You will be called for one or more and you have to read a register to know which one(s) called you. You can then something from there.

Cortex-M3 and others have the ability to dispatch a function from an individual interrupt directly. Use interrupts carefully under both approaches.

All of the GPIOs are external interrupts. This is how they are implemented in the SIO module, which is a custom module for the RP2040. PIO also supports working in a similar manner potentially. (SIO module is better.)
There is more I could say here but I am going to leave it at this. Till the world is not a complete waste of time.

Return to “General”