Interrupts on makecontroller now working

Finally worked out how to use the GPIO interrupts on the AT91SAM7X, which is the brain of the makecontroller.  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 ARM_SRC section in the makefile.  Reason: All IRQ need to be compiled in ARM 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:

make.c 
gpio_isr.c

 

 

Similar Posts:

Print Friendly

Author: Stephen Eaton

Geek at heart. Loves to tinker and find out how things work, which inevitably leads to items in pieces and not working for much longer :)

Leave a Reply