AnsweredAssumed Answered

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

Question asked by xpress_embedo on Oct 20, 2017
Latest reply on Oct 30, 2017 by Robin_Shen

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.

ICS Registers

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.