Late timer

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by jdurand on Sat Aug 25 12:55:31 MST 2012
Red Probe +

I'm seeing something odd with the timer...

I set up three MCR in the timer while it's reset and then let it run. The interrupts are coming in about 4% later than they should.  I've tested this at a bit over 1mS to almost 23mS.

I've tested SystemCoreClock by looking at continuous serial data and the serial baud rate comes out just fine.

Is there some way the debugger could slow the timer?  Any other way the timer could run slower than the serial port since they're both on the same PCLK?

Here's the setup:
LPC_TIM0->TCR = 0b10;
LPC_TIM0->MR0 =200;
LPC_TIM0->MR1 = 225;
LPC_TIM0->MR2 = 22850;  
LPC_TIM0->MCR = 1<<6 | 1<<3 | 1;
LPC_TIM0->TCR = 0b01;

I have a test point on one pin that I set low when I start the timer and high when MR2 interrupt hits.