Kinetis K22F Systick read issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Kinetis K22F Systick read issue

1,177 次查看
nalinsilva
Contributor I

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.

0 项奖励
回复
2 回复数

1,029 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

pastedImage_1.png

I have tested on my FRDM-K22F, as you see, there is not any problem.

BR

XiangJun Rong

0 项奖励
回复

1,029 次查看
nalinsilva
Contributor I

Thanks for your response and trying the code.  After your verification, I did further investigation into the system and found another process through interrupts resets the value of SYST_CVR causing the problem I saw.  When that interference is removed, the systick works fine.

0 项奖励
回复