Problem with 2 Match Interrupts

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem with 2 Match Interrupts

380件の閲覧回数
lpcware
NXP Employee
NXP Employee
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_Clock_SetPCLKDiv(SYSCTL_PCLK_TIMER2, SYSCTL_CLKDIV_1);
Chip_TIMER_Init(LPC_TIMER2);

Chip_TIMER_Reset(LPC_TIMER2);

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);

NVIC_ClearPendingIRQ(TIMER2_IRQn);
NVIC_EnableIRQ(TIMER2_IRQn);



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);
}

NVIC_ClearPendingIRQ(TIMER2_IRQn);
}


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




ラベル(1)
0 件の賞賛
返信
2 返答(返信)

361件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Patrick_W on Wed Jul 08 23:06:50 MST 2015
You're right, stupid mistake :-D

But thanks for the answer.
0 件の賞賛
返信

361件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Jul 08 08:38:57 MST 2015

Quote: Patrick_W
Has somebody a advice what i am doing wrong?



You are posting code snippets...

Probably the timer is confusing you  :)  The timer isn't stopped, so it's generating interrupts while you are staring at the breakpoint  :O


0 件の賞賛
返信