Interrupts on makecontroller now working

Finally worked out how to use the GPIO interrupts on the AT91SAM7X, which is the brain of the .  A couple of “gotchas” along the way, especially for a newby to these beasts like me, which as usual, after I’ve finally worked it out I look back see how simple it was lol.

 The three main “gotchas” were:

  1. The ISR needs to be in its own .c file and the filename appended to the _SRC section in the makefile.  Reason: All IRQ need to be compiled in mode
  2. In the ISR I needed to Read the Interrupt Status register, PIOB_ISR, I was not dodin gthis and so it would process  the IRQ once and never again.  By reading the ISR it clears it and allows interrupts on the PIO to re-occur.
  3. The very last thing in the ISR is to renable the AIC so that interrupts will be processed upon exit

Here is the code:




This site uses Akismet to reduce spam. Learn how your comment data is processed.