I’m trying to get EINT0 running. I can setup the VIC but cannot figure out how to associate the VIC channel with EINT0. The FIQ_Handler is mapped in my interrupt vector table.
boot code linking ISR:
Vectors LDR PC, Reset_Addr
LDR PC, Undef_Addr
LDR PC, SWI_Addr
LDR PC, PAbt_Addr
LDR PC, DAbt_Addr
NOP ; Reserved Vector
; LDR PC, IRQ_Addr
LDR PC, [PC, #-0x0120] ; Vector from VicVectAddr
LDR PC, FIQ_Addr
IMPORT FIQ_Handler
Reset_Addr DCD Reset_Handler
Undef_Addr DCD Undef_Handler
SWI_Addr DCD SWI_Handler
PAbt_Addr DCD PAbt_Handler
DAbt_Addr DCD DAbt_Handler
DCD 0 ; Reserved Address
IRQ_Addr DCD IRQ_Handler
FIQ_Addr DCD FIQ_Handler
Undef_Handler B Undef_Handler
SWI_Handler B SWI_Handler
PAbt_Handler B PAbt_Handler
DAbt_Handler B DAbt_Handler
IRQ_Handler B IRQ_Handler
Main code:
#include "lpc246x.h"
void FIQ_Handler( void ) __irq
{
// Pulling Port1.18 high turns off the LED
IOSET1 = 0x00040000;
// I don't reset the interrupt flag as I just
// want to see that I can vector here at this point.
}
int main( void )
{
/* Setup green LED by EINT0 button. This is next to the
"Good" silk screen message. By default the LED is off on power
up. Once Port1.18 is configured as an output the LED
illuminates.
Pulling Port1.18 high turns off the LED.
Pulling Port1.18 low turns off LED.
*/
PINSEL3 &= 0xFFFFFFCF; // Set Port1.18 to GPIO
IODIR1 = 0x00040000; // Set Port1.18 to Output
// LED is on now. It should turn off once EINT0 is tripped.
/* Configure External Interrupt 0 / Port2.10
Note: Port2.10 serves only one function EINT0 so by default
it is always hooked up to that port. */
// Set Interrupt channel 0 as FIQ
VICIntSelect = 0x00000001;
// Set address for channel 0 ISR
VICVectAddr0 = (unsigned)FIQ_Handler;
// Turn on Interrupt channel 0
VICIntEnable = 0x00000001; // Enable interrupt channel 0
/* I'm confused at this point. I cannot find anyplace that tell
me the EINT0 is on. And I would expect a 5-bit setting
somplace to tell EINT0 which interrupt channel in the VIC contains
the ISR. I think if I had that I'd be up and running right now. */
while( 1 ); // Loop here forever
return 0;
}