Interrupts

Guest #1172344
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?
Guest #1172345
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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.