EmbDev.net

Forum: ARM programming with GCC/GNU tools Interrupts


Author: i386DX (Guest)
Posted on:

Rate this post
0 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?

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 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

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.