EmbDev.net

Forum: ARM programming with GCC/GNU tools Interrupts


von i386DX (Guest)


Rate this post
useful
not useful
I'm trying to program an interrupt for the LPC-2294 (using a Olimex
LPC-H2294 development print).
It seems there's not that much information about interrupts using the
GCC-compiler...

This is what I already have/tried/found on other sites (only interrupt
code):

//Prototype:
void _attribute_ ((interrupt("IRQ"))) EINT0_routine(void);

//Initialisation
void Init()
{
...
  PinFunctionSelect( P0_16, 1);  //external interrupt0
...
}

void InterruptInit()
{
  IOWRITE(VICVectCntl0, 0x002E);  //External int0 (14)
  IOWRITE(VICVectAddr0, (unsigned long)EINT0_routine);
  IOWRITE(VICIntEnable,0x004000); //Interrupt Enable
}

//Interrupt
void _attribute_ ((interrupt("IRQ"))) EINT0_routine(void)
{
  GpioSetState(P1_16,1);  //Turn led on
  IOWRITE(SCB_EXTINT, 1); //Clear EINT0 interrupt flag
  IOWRITE(VICVectAddr, 0); //Dummy write to signal end of interrupt
}

It compiles without any errors/warnings, but it doesn't work. The µC
never jumps to the interrupt-routine.
I removed -mthumb-interwork from the Makefile (i've read somewhere that
there's a bug). Can't find more information about this :-(. Anyone knows
what I'm doing wrong?

von Martin Thomas (Guest)


Rate this post
useful
not useful
> It compiles without any errors/warnings, but it doesn't work. The µC
> never jumps to the interrupt-routine.
> I removed -mthumb-interwork from the Makefile (i've read somewhere that
> there's a bug). Can't find more information about this :-(. Anyone knows
> what I'm doing wrong?

Since you are using some utility-functions (PinFunctionSet, GpioSetState
etc.) without given the source of these functions I can not tell if the
configuration is correct. At least some additional hints: Are the ARM
core INT-excpetions inabled (INT-bit in CPSR of the application's
run-mode cleared)? If you do not use an assembler-wrapper to "route"
INT-exceptions make sure the VIC-vector-address is loaded into the PC
when an INT-excpetion occurs. See manual, something link ldr PC,
[PC,#-0xFF0] at the INT-execption vector-address. Please verify the
offset (-0xFF0), I have never used a LPC2294, the given offset is for a
LPC2106. And yes, do not use thumb/thumb-interwork for tests to isolate
the problem.

Martin Thomas

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.