RITIMER ticking on every clock

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ArriaLive on Sat Oct 26 15:41:28 MST 2013
I'm trying to use the Repetitive Interrupt Timer (RIT) for some housekeeping clocking chores on an LPC1830 Xplorer board, but can't seem to get it working as expected.

Here's how I'm setting it up:

/* Setup Repeating Int Timer (RIT) */
LPC_RITIMER->COMPVAL= 180000;                 //Hope to use a calculated value for this, but this is close to the value I expect
                                                                                    // with LPC1830 running at 180MHz, should generate roughly 1ms interrupts
LPC_RITIMER->MASK=0x0;//no mask bits, which should allow compval to determine interrupt
LPC_RITIMER->COUNTER=0x0;//always start at zero
LPC_RITIMER->CTRL= ( (1<<1) /* Timer reset to zero on interrupt */
| (1<<2) /* stop the timer when debugging */
                                                | (1<<3));                 /* Enable */

NVIC_EnableIRQ(RITIMER_IRQn);//Enable the interrupt

I can look at the register entries and they are correct.  The counter appears to count up to the compare value and restarts, however, the interrupt flag (CTRL bit 1) is set immediately, and the RITinterrupt is called.  And it is called with every clock tick.  The RIT doesn't wait until the compare value at all.

I've tried changing the mask, making the compval larger, and more.  I've searched the net for examples of this working, but they all do essentially what I'm doing.  I've scoured the documentation for any detail I might be missing, but I'm not finding anything.  I've even changed Xplorer boards just in case there was a hardware anomaly.  Still no luck.

Can someone provide me a clue of what I'm missing?