SysTick Timer gives error of 5 second per minute KE02 Micro-controller

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

SysTick Timer gives error of 5 second per minute KE02 Micro-controller

ソリューションへジャンプ
830件の閲覧回数
xpress_embedo
Contributor II

Hello Everyone.

I am using Freescale MKE02Z32xxx4 micro-controller for one of my project, and everything works fine, the complete project is running fine. But my customer reports an issue, that the time taken for executing 10 minute cycle is longer than 10 minutes.

I checked it and found that 1 minute is acting a 1 minute 5 seconds, which means that, something i missed which is causing this behavior.

I am using SysTick to generate 1ms interrupt and using that I am checking timings required ( Example 10 minutes ).

The following is the initialization code.

void Timer_Init( void )
{
SysTick->LOAD = 20000u-1u;
SysTick->VAL = 0;
SysTick->CTRL |= SysTick_CTRL_CLKSOURCE_Msk;
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
}

This function will start the timer.

void Timer_start( void )
{
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
SysTick->LOAD = 20000u-1u;
}

And the priority for the interrupt is 1, second highest.

I am using the the FEI mode.

Capture.PNG

Can anyone tell me what mistake i had done, and how can I correct it.

Please let me know if any other input is required from my side.

Thanks in Advance.

タグ(2)
0 件の賞賛
返信
1 解決策
650件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Arun,

The default frequency of Slow internal reference clock may error in CodeWarrior10.7 with Processor Expert.

After input 31.25kHz for factory trimmed IRC, we can see the frequency of Core.

KE02 CW10.7 PE 31.25kHz.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

4 返答(返信)
650件の閲覧回数
xpress_embedo
Contributor II

Actually I am new to this micro-controller and after using CodeWarrior, I cam to know that the clock is around 16.66MHz and after updating that values, system works properly with correct timings.

0 件の賞賛
返信
651件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Arun,

The default frequency of Slow internal reference clock may error in CodeWarrior10.7 with Processor Expert.

After input 31.25kHz for factory trimmed IRC, we can see the frequency of Core.

KE02 CW10.7 PE 31.25kHz.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

650件の閲覧回数
xpress_embedo
Contributor II

Thanks Robin.

Can you help me in code protection for KE02 series.

I am using IAR and I don't understand how can I protect my code.

It looks like that the Mass Protection is always enabled for this series of micro-controller (MKE02Z32xxx4).

So even if I accidentally secured the flash I can re-flash. Is it right??

I think it's better if I open a new thread for this.

0 件の賞賛
返信
650件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

You can mass erase the flash and then re-flash it. And please refer the method in 'Flash protection with IAR'.

8.2 Flash security.jpg

0 件の賞賛
返信