Problem with 2 Match Interrupts

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Patrick_W on Wed Jul 08 06:40:39 MST 2015
Hey Guys,

after a long time its me again. I got a problem using two match interrupts on timer 2.
When the ISR is called both match interrupt flags are set (even if the TC value is far below the Match Register Value)

This is the code of my init function:



Chip_TIMER_PrescaleSet(LPC_TIMER2, 0);

Chip_TIMER_SetMatch(LPC_TIMER2, 1, 1600);
Chip_TIMER_SetMatch(LPC_TIMER2, 2, 9200000);//zu Testzwecken

Chip_TIMER_ClearMatch(LPC_TIMER2, 1);
Chip_TIMER_ClearMatch(LPC_TIMER2, 2);

Chip_TIMER_ResetOnMatchEnable(LPC_TIMER2, 2);
Chip_TIMER_MatchEnableInt(LPC_TIMER2, 1);
Chip_TIMER_MatchEnableInt(LPC_TIMER2, 2);


And the code of the ISR:

void TIMER2_IRQHandler(void)
if(Chip_TIMER_MatchPending(LPC_TIMER2, 1))
UpdatePulsDACValue = true;
Chip_TIMER_ClearMatch(LPC_TIMER2, 1);

if(Chip_TIMER_MatchPending(LPC_TIMER2, 2))
UpdatePulsDACValue = false;
Chip_TIMER_ClearMatch(LPC_TIMER2, 2);


If i check the register configuration during debugging the MCR, and MR look correct.
Just to mention it: the timer is enabled via an extra function.

I am working on a LPC1763 with a 16MHz crystal no PLL.
For programming i use the LPC Link2, SW: LPCXpresso v7.6.2 on Win7

Has somebody a advice what i am doing wrong?

Best regards