LPC1517 SCTimer Interrupt stops suddenly

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

LPC1517 SCTimer Interrupt stops suddenly

ソリューションへジャンプ
985件の閲覧回数
athmesh_n
Contributor IV

Controller   :   LPC1517

IDE             :   MCUXpresso

I'm using SCTimer 3 for using delay for ms, it is working for 60 delays, and then interrupt stops without any reason.

SCT3 IRQ Handler:

 LPC_SCT3->EVFLAG = 0x01;
 count++;

Delay function:

 SCT3_START_ms;
 while(count<period);
 SCT3_STOP;

SCT3_START_ms definition:

 count=0;
 LPC_SCT3->CTRL_U |= (1<<2);
 LPC_SCT3->MATCH[0].U=(SystemCoreClock/1000-1);
 LPC_SCT3->MATCHREL[0].U=(SystemCoreClock/1000-1);
 LPC_SCT3->CTRL_U &= ~(1<<2);

this worked normally for upto 59 counts, and then MATCH0 turned from normal value to 0xffff, also the SystemCoreClock became 0.

is there any specific reason for this weird change?

Thank you

ラベル(1)
タグ(3)
0 件の賞賛
返信
1 解決策
869件の閲覧回数
athmesh_n
Contributor IV

The above problem solved as SystemCoreClock is not globally initialized and hence, due to memory optimization the SystemCoreClockbecame zero.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
870件の閲覧回数
athmesh_n
Contributor IV

The above problem solved as SystemCoreClock is not globally initialized and hence, due to memory optimization the SystemCoreClockbecame zero.

0 件の賞賛
返信
869件の閲覧回数
athmesh_n
Contributor IV

Either declare SystemCoreClock globally, or call GetSystemCoreClock() function.

0 件の賞賛
返信