AnsweredAssumed Answered

Kinetis K22F Systick read issue

Question asked by nalinsilva on Sep 23, 2016
Latest reply on Sep 27, 2016 by nalinsilva

I'm trying to read Systick timer of MK22FN512VLL12 but found that the timer doesn't go below about 0x00D00000.  My code is as below.

 

//Initialization

SYST_CSR = 0x5u;                    // enable systick
SYST_RVR = 0x00FFFFFFu;     // set reload to maximum 24 bit value 

 

SYST_CVR = 0 ;               // Reset SYST_CVR to 0 and force reload
 val = 0x009E57FF;           //val is uint32_t
 while(SYST_CVR > val);

 

With above value in val, the program is stuck forever in the while loop.  If I increase val to 0x00FF05FF, program doesn't get stuck at while loop.  Using IAR compiler.  Also, tried same code on MK22FN512VLH12 but same behavior.  Running core clock at 64MHz and the MCU is in normal running mode always.  With above SYST_CSR value, no interrupts occur with Systick.

 

Please let me know how to resolve this issue and let SYST_CVR reach 0 as mentioned in documentation.

Outcomes