3

How to determine the port from which the interrupt has been generated in the handler? For example, in the EXTI0_IRQHandler how will I determine whether the interrupt was generated through PA0, PB0 or PC0? Is it even possible to handle interrupts from these pins on the same EXTI line (if only one pin generates an interrupt at a time so that there is no confict)?

Nikhil Gupta
  • 172
  • 1
  • 18

2 Answers2

3

No, only one of PA0, PB0, etc can be configured as EXTI0 source. See the description of SYSCFG_EXTICR* registers, section 9.2.3 in the STM32F4 Reference Manual.

If the interrupt handler is shared between multiple EXTI sources, like EXTI9_5_IRQHandler and EXTI15_10_IRQHandler, then read the EXTI_PR register to determine which one(s) generated the interrupt.

0

I'm not familiar with your board, but generally you'd want to query the interrupt controller from your handler to determine the actual interrupt source.

You can find a fairly easy to follow example on the ARM site (but your hardware may differ from the controller discussed here): http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/15708.html

The setup in the example is discussed in the README in the .zip archive. In short, this shows interrupt handing using a vectored interrupt controller as well as handling a cascaded controller through that primary VIC.