3

I have studied in bcm2835 manual that its gpio peripheral can generate three interrupt lines. But in the same manual (interrupts section) I found that there are four gpio interrupts, gpio_int[0] to gpio_int[4]. The gpio irq used by the rpi is gpio_int[3], which I found in arch/arm/mach-bcm2708/bcm2708_gpio.c from the linux kernel source.

What happens if I replace that gpio_int[3] to gpio_int[2]? Will I still be able to get interrupts if one of the gpios is set (similar to when gpio_int[3] is used)?

1

1 Answer 1

2

I think you mean "gpio_int[0] to gpio_int[3]", right? Not "gpio_int[0] to gpio_int[4]". There is no gpio_int[4] mentioned in that manual.

The bcm2835 manual that you referenced was written for the first generation Raspberry Pi, in which there were only 2 banks of GPIO pins.

On the BCM2837 (the SoC used in the Raspberry Pi 3), there are actually 3 banks of GPIO pins, so there are four interrupt lines going from the GPIO controller to the interrupt controller.

  • gpio_int[0] for BANK0 (pins 0-27)
  • gpio_int1 for BANK1 (pins 28-45)
  • gpio_int[2] for BANK2 (pins 46-53)
  • gpio_int[3] for all the pins

You can verify this on the Raspberry Pi 3 with the "raspi-gpio get" command, which lists each pin's function (INPUT/OUTPUT/ALT). If you filter the results with grep, you should see:

raspi-gpio get | grep BANK

BANK0 (GPIO 0 to 27):
BANK1 (GPIO 28 to 45):
BANK2 (GPIO 46 to 53):

Even though the GPIO controller in the original BCM2835 only had 2 banks, Broadcom was forward–looking and reserved a bit in each register of the interrupt controller for future versions, the gpio controller of which would have an additional bank.

If you are using a pi that has a gpio controller with 3 banks and you replace gpio_int[3] with gpio_int[2], you will only be able to get interrupts if one of the gpios in bank2 (pins 46-53) is set, but those pins are not exposed on the header and are connected to the SD card.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.