This is embarrassing: I have nearly identical code on a LPC2106 that
works fine. I do not get the interrupts on the LPC2148. The code
changes between versions have to do with the divisors, not the VIC stuff.
I can see the timer match output toggle on pin 22 so I know the timer
is working and the frequency is correct.
void T0ISR(void) __attribute__ ((interrupt));
volatile unsigned int CurrentTime = 0;
void T0_init(void)
{
T0TC = 0;// clear the timer count
T0PR = 1;// prescale divide by 2
T0MR0 = 7500;// divide by 7500 to get approx 1000 ints per second
T0MCR = 0x03;// interrupt on match, reset on match
T0TCR = 0x01;// start the timer
VICVectCntl3 = 0x00000024;// set priority 3 for Timer 0
VICVectAddr3 = (unsigned long) T0ISR;// pass the address of the ISR
VICIntEnable |= 0x00000010;// enable interrupt
T0EMR = 0x30;// toggle external match pin
}
void T0ISR(void) // interrupt handler - see timer.h
{
CurrentTime++;
T0IR = 0x01;
VICVectAddr = 0xFF;
}
I am missing something simple but I have been staring at this for a
couple of hours with no success. Oh, the pin setup to allow me to
watch the match bit toggle is handled elsewhere. Fortunately, it works!
And I don't think I am getting interrupts from the I2C gadget either
but that's another problem. I'm doing something wrong with the
VIC.
Anybody see where I messed up?
Thanks
Richard
LPC2148 Timer0 Interrupts
Started by ●June 22, 2006
Reply by ●June 22, 20062006-06-22
Quoting rtstofer :
> This is embarrassing: I have nearly identical code on a LPC2106 that
> works fine. I do not get the interrupts on the LPC2148. The code
> changes between versions have to do with the divisors, not the VIC stuff.
Any chance you havn't enabled interrupts in the startup on the 2148?
Robert
> This is embarrassing: I have nearly identical code on a LPC2106 that
> works fine. I do not get the interrupts on the LPC2148. The code
> changes between versions have to do with the divisors, not the VIC stuff.
Any chance you havn't enabled interrupts in the startup on the 2148?
Robert
Reply by ●June 22, 20062006-06-22
--- In l..., Robert Adsett wrote:
>
> Quoting rtstofer :
>
> > This is embarrassing: I have nearly identical code on a LPC2106 that
> > works fine. I do not get the interrupts on the LPC2148. The code
> > changes between versions have to do with the divisors, not the VIC
stuff.
>
> Any chance you havn't enabled interrupts in the startup on the 2148?
>
> Robert
>
Robert,
Sure, I could have done something like omit:
MSR CPSR_c,#MODE_SVC /* enable interrupts */
MSR CPSR_c,#MODE_USR
in crt.s I really thought I was using the same startup file as I had
for the LPC2106.
Thanks for the help!
Richard
>
> Quoting rtstofer :
>
> > This is embarrassing: I have nearly identical code on a LPC2106 that
> > works fine. I do not get the interrupts on the LPC2148. The code
> > changes between versions have to do with the divisors, not the VIC
stuff.
>
> Any chance you havn't enabled interrupts in the startup on the 2148?
>
> Robert
>
Robert,
Sure, I could have done something like omit:
MSR CPSR_c,#MODE_SVC /* enable interrupts */
MSR CPSR_c,#MODE_USR
in crt.s I really thought I was using the same startup file as I had
for the LPC2106.
Thanks for the help!
Richard