I have been trying different sample projects with interrupts, but I can not get the ISR to fire. I have tried BlinkyIRQ both in a board and the simulator, without success.
Is there a global IRQ Enable that needs to be set? I would think the examples would run correctly.
With an ARM7 you're going to want to look at the vectors in startup.s/LPC2300.s
For an LPC23xx I'd presume you'd want it to vector via VicVectAddr, or have a wrapper routine to handle the interrupt context and call routines without the __irq directive.
You'd need to enable the interrupt in the VIC and peripheral.
\Keil\ARM\Boards\Keil\MCB2300\Blinky\
Correct, I am trying to use the VIC to vector to the ISR. I can see the interrupt set in the Timer0 register, and the VIC looks to be set up correctly, just no ISR execution.
Code from the example:
#include <LPC23XX.H> // LPC21XX Peripheral Registers #include "Timer.h" long timeval; void tc0 (void) __irq;//__attribute__ ((interrupt)); // Generate Interrupt /* Setup the Timer Counter 0 Interrupt */ void init_timer (void) { T0MR0 = 149999; // 10mSec = 150.000-1 counts T0MCR = 3; // Interrupt and Reset on MR0 T0TCR = 1; // Timer0 Enable VICVectAddr4 = (unsigned long)tc0; // set interrupt vector in 0 VICVectCntl4 = 0x20 | 4; // use it for Timer 0 Interrupt VICIntEnable = 0x00000010; // Enable Timer0 Interrupt } /* Timer Counter 0 Interrupt executes each 10ms @ 60 MHz CPU Clock */ void tc0 (void) __irq { timeval++; T0IR = 1; // Clear interrupt flag VICVectAddr = 0; // Acknowledge Interrupt }
I'm sure this and other examples work, just why don't they work for me? I am using an unlicensed eval installation of the latest uVision.
All this goes back to an older project I did years ago in a version of uVision3. Back then, the timer interrupt worked flawlessly. Now, when I use the IDENTICAL code in uVision4, the Timer0 ISR will not fire.
I am having the same problem with interrupts with Red Suite 3.
An interesting thing here - you seem to have taken code for a LPC21xx and use on a LPC23xx processor.
Note that in the LPC21xx, each channel of the VIC have a control register that you use to specify which peripherial that is using this channel. The priority of the channels are hard-coded based on the channel number.
Look closer at the datasheet for LPC23xx and you find that it instead have a register called priority. I.e. specifying the priority of the interrupt. In the LPC23xx chips, the channel have a hard-coded mapping to an interface. So channel 4 that you are using is hard-coded to handle timer0 match and capture events.
Not sure if Keil have fixed this now, but when adding support for LPC23xx, they just duplicated lots of constants from the LPC21xx header file and failed to correctly name the priority register, incorrectly keeping the VICVectCntlXX names.
I did see this. I am running channel 4 with Timer0, which should be correct. One anomaly is that the VICVectPriority4 = 0x00000024 uses more than the lowest nibble, which is invalid according to the data sheet. When I change this to be VICVectPriority4 = 4;, the situation does not change, still no interrupt firing. I am including LPC23xx.h and LPC2300.s as a startup file.