Olimex lpc e2294 board interrupt help - GNU C

Started by boje_d July 28, 2005
Hi im trying to make the interrupt work om a lpc2294. I am using
timer 0 and see the interrupt being enabled (test routine on display)
but the interrupt does NOT activate the interrupt routine. Ill put in
some code so maybe someone can see my error??? And give a little
help ??

than you (i hope)

Best regards
Boje Demant

interrupt routine
static void Timer0Interrupt(void) __attribute__ ((interrupt ("IRQ")));
static void Timer0Interrupt(void){
// (*timer_function)(); // Call timer callback function.
//
// T0_TCR=0; //stop timer
// T0_TCR=2; //Reset timer
// T0_TCR=1; //start timer
LIGHT_LCD_ON;
T0_IR = 0xff; // Clear timer 0 interrupt line.
VICVectAddr=0xff;
}

in main:

T0_PRX982; //setup prescaler = 1msek
T0_TCR=0x00000002; //Reset timer
T0_MR0= 1500; //2 (2 sek for interrupt;
T0_MCR=0x00000003; //generate interrupt on match
VICProtection=0; //
VICIntEnClear=0xffffffff; //disable all interrupts
VICSoftIntClear=0xffffffff;
VICDefVectAddr=(unsigned long)&DefInterrupt;
VICIntSelect=0x00000000; //assigne interrupt timer 0 til type IRQ
VICVectAddr0= (unsigned long)&Timer0Interrupt; //ops vector
VICVectCntl0= 0x00000024; //enable vector iterrupt


An Engineer's Guide to the LPC2100 Series

In the ISR, you need to reset the VIC using 0x00, not ff:

VICVectAddr = 0;

will work.

Also, in main:

VICIntSelect=0x00000000; //assigne interrupt timer 0 til type IRQ

will not work.. you need to SET the bit for the specific VIC channel, such as:

VICIntSelect |= (1 << VIC_TIMER0);

or alike.

--fred boje_d <boje_demant@boje...> wrote:
Hi im trying to make the interrupt work om a lpc2294. I am using
timer 0 and see the interrupt being enabled (test routine on display)
but the interrupt does NOT activate the interrupt routine. Ill put in
some code so maybe someone can see my error??? And give a little
help ??

than you (i hope)

Best regards
Boje Demant

interrupt routine
static void Timer0Interrupt(void) __attribute__ ((interrupt ("IRQ")));
static void Timer0Interrupt(void){
// (*timer_function)(); // Call timer callback function.
//
// T0_TCR=0; //stop timer
// T0_TCR=2; //Reset timer
// T0_TCR=1; //start timer
LIGHT_LCD_ON;
T0_IR = 0xff; // Clear timer 0 interrupt line.
VICVectAddr=0xff;
}

in main:

T0_PRX982; //setup prescaler = 1msek
T0_TCR=0x00000002; //Reset timer
T0_MR0= 1500; //2 (2 sek for interrupt;
T0_MCR=0x00000003; //generate interrupt on match
VICProtection=0; //
VICIntEnClear=0xffffffff; //disable all interrupts
VICSoftIntClear=0xffffffff;
VICDefVectAddr=(unsigned long)&DefInterrupt;
VICIntSelect=0x00000000; //assigne interrupt timer 0 til type IRQ
VICVectAddr0= (unsigned long)&Timer0Interrupt; //ops vector
VICVectCntl0= 0x00000024; //enable vector iterrupt

SPONSORED LINKS
Microcontrollers Microprocessor Intel microprocessors Pic microcontrollers 8085 microprocessor

---------------------------------
YAHOO! GROUPS LINKS ---------------------------------

---------------------------------
Start your day with Yahoo! - make it your home page



You have a couple of faults:
In Interruption: VicVectAddr = 0; (Not 0xff)
In main, include:
VicIntEnable = 0x10; // Enable timer 0 interrupt

Regards --- In lpc2000@lpc2..., "DECwiz \(Fred van Kempen\)"
<decwiz@y...> wrote:
> In the ISR, you need to reset the VIC using 0x00, not ff:
>
> VICVectAddr = 0;
>
> will work.
>
> Also, in main:
>
> VICIntSelect=0x00000000; //assigne interrupt timer 0 til type
IRQ
>
> will not work.. you need to SET the bit for the specific VIC
channel, such as:
>
> VICIntSelect |= (1 << VIC_TIMER0);
>
> or alike.
>
> --fred > boje_d <boje_demant@h...> wrote:
> Hi im trying to make the interrupt work om a lpc2294. I am using
> timer 0 and see the interrupt being enabled (test routine on
display)
> but the interrupt does NOT activate the interrupt routine. Ill put
in
> some code so maybe someone can see my error??? And give a little
> help ??
>
> than you (i hope)
>
> Best regards
> Boje Demant
>
> interrupt routine
> static void Timer0Interrupt(void) __attribute__ ((interrupt
("IRQ")));
> static void Timer0Interrupt(void){
> // (*timer_function)(); // Call timer callback function.
> //
> // T0_TCR=0; //stop timer
> // T0_TCR=2; //Reset timer
> // T0_TCR=1; //start timer
> LIGHT_LCD_ON;
> T0_IR = 0xff; // Clear timer 0 interrupt line.
> VICVectAddr=0xff;
> } >
>
> in main:
>
> T0_PRX982; //setup prescaler = 1msek
> T0_TCR=0x00000002; //Reset timer
> T0_MR0= 1500; //2 (2 sek for interrupt;
> T0_MCR=0x00000003; //generate interrupt on match
> VICProtection=0; //
> VICIntEnClear=0xffffffff; //disable all interrupts
> VICSoftIntClear=0xffffffff;
> VICDefVectAddr=(unsigned long)&DefInterrupt;
> VICIntSelect=0x00000000; //assigne interrupt timer 0 til type
IRQ
> VICVectAddr0= (unsigned long)&Timer0Interrupt; //ops vector
> VICVectCntl0= 0x00000024; //enable vector iterrupt >
>
> SPONSORED LINKS
> Microcontrollers Microprocessor Intel microprocessors Pic
microcontrollers 8085 microprocessor
>
> ---------------------------------
> YAHOO! GROUPS LINKS > > --------------------------------- >
>
> ---------------------------------
> Start your day with Yahoo! - make it your home page