SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By efox
#76373
Ive been playing around with an Atmel AT91SAM7S64 (ARM7TDMI) for a little bit. Gradually trying to learn the thing.

There are a number of pins that can be configured for IRQ.

My question is, is it possible to have a different ISR for each different pin OR do all IRQ fall under one ISR and within that ISR i have to determine which pin was triggered and go from there ?

If it IS possible, how would I go about doing it ? I dont need the code or anything, just like steps on what i have to do (ill figure out the rest on my own).


Hardware: AT91SAM7S-EK developerboard (with AT91SAM7S64)
IAR J-LINK
Software: IAR, Crossworks, Kiel.

Ive been the most sucessful with Crossworks, but if you think another compiler might be easier to use, and or have better library support and just easier overall, let me know. I had a hard time getting my jlink to work with keil, and its still kind of iffy.
By stevech
#76388
I take it you tried IAR? I did plug and play with J-Link and it but with LPC 2xxx, not Atmel.

ImageCraft has an ARM product. Don't know what JTAG is supports as integrated.
By TheDirty
#76404
I think you're looking for this, from the AIC section on the datasheet.
Register Name: AIC_SVR0..AIC_SVR31
The user may store in these registers the addresses of the corresponding handler for each interrupt source.
Code: Select all
pAIC->AIC_SVR[IRQ_Number] = (unsigned int)IrqHandler_ISR;
Last edited by TheDirty on Mon Jul 06, 2009 6:15 am, edited 2 times in total.
By nigma
#76405
With the ARM7, you will need to work out which (GPIO) port generate the interrupt and branch to a handler for that port. Then you need to determine the pin that caused the interrupt and deal with it accordingly.

I assume you have a global interrupt handler with dispatcher in place ?
By TheDirty
#76406
Thanks, Nigma. Trying to figure this out myself.

Ya, looks like you have one ISR for your GPIO port A and you need to figure out the pin.

I've just got to the point where I need to handle an edge interrupt myself. I can post code when I get it working for simple edge trigger and identifying the pin. I'll work on this tonight.
By efox
#76407
With the ARM7, you will need to work out which (GPIO) port generate the interrupt and branch to a handler for that port. Then you need to determine the pin that caused the interrupt and deal with it accordingly.
So what you are saying is that any GPIO interrupt (whether Pin1 or Pin25) interrupt, it will go to only ONE handler (the irq handler) and from there i have to determine WHICH pin interrupted and then do whatever it is I need to do ?

I cant have a handler for Pin1 and Pin25 right ?[/quote]
By TheDirty
#76448
If you download the sample code from Atmel, they have a pio_it.c file with an interrupt handler library in it. I always hate these libraries as the style seems crazy, but it does a decent job of outlining everything needed. It handles multiple handlers by having a 'table of handlers' and having a main handler that figures out what's going on, and calling the correct sub-handler.