You are right, I made a mistake writing my previous mail, it was not
__enable_intrinsic() but of course __enable_interrupt().
Now I have introduced the IRQ Handler exactly as you told me. In that
way, the Timer1 ISR should be called by the irq_handler whenever an
interrupt occurs. BUT, it sill not work! In debug mode I can see the
timer incrementing and when it reaches the match value register, it
resets and put the IR1 bit to '1' but the ISR is never reached... I
think there is a problem with the IAR intrinsic __enable_interrupt()
and __disable_interrupt(). In step by step mode, when the
__enable_interrupt() is executed, that blocks the programm... Any
idea of the problem, or do you know the asm code of __enable_interrupt
() ans __disable_interrupt ?
(the code follow at the end of this mail)
Thank you very much !
--- In lpc2000@yahoogroups.com, "Leighton Rowe" <leightonsrowe@y...>
wrote:
> I'm curious about 2 things.
>
> 1. "__enable_intrinsic()"
> Is this really the function you used or do you really mean
> __enable_interrupt().
>
> 2. Where is your IRQ Handler? The only time I used "_irq" was to
> define the IRQ handler...not the ISR.
>
> something like...
>
> __arm __irq void IRQ_handler(void)
> {
> ISRAddress = VICVectAddr; //load source address
> (*ISRAddress)() //function call
> VICVectAddr=0; //reset VIC
> return;
> }
>
> void Timer1ISR(void) //Timer1 ISR
> {
> .....
> }
>
>
> That way ISRs get called by the handler whenever any enabled
> interrupt channel is activated.
>
> Some example code should come with your IAR compiler...somewhere in
> the /ARM/src directory. Make sure u look at those. They'll come in
> very handy.
>
> Leighton
Here is a piece of my code:
> >
> > __disable_interrupt(); // IAR intrinsic
> > VICProtection=0x0;
> >
> > VICIntEnClear=0xffffffff;
> >
> > VICIntEnable=0x20; //Timer1
> > VICIntSelect=0x00; //all interrupts are IRQs
> > VICVectCntl0=0x25;
> > VICVectAddr0=(unsigned long)&Timer1ISR;
> > __enable_interrupt();
> >
> > Then I also initialize Timer1:
> >
> > T1_IR=0x00;
> > T1_MR0=TIMERMATCH;
> > T1_MCR=0x03; // reset timer and fire interrupt
> > T1_PR=0x0;
> > T1_TC=0x00;
> > T1_TCR=0x01; // start the timer
> >
> > __arm __irq void irq_handler(void) //Timer1 ISR
> > {
> > ISRAddress = VICVectAddr; //load source address
> > (*ISRAddress)() //function call
> > VICVectAddr=0; //reset VIC
> > return;
> > }
> >
> > void Timer1ISR()
> > {
> > IR1 = 0x01;
> > }
> >Message
Re: IAR interrupt problem
2004-09-22 by ducatman2000
Attachments
- No local attachments were found for this message.