KL03 SysTick Timer in IAR vs. KDS 2.0

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

KL03 SysTick Timer in IAR vs. KDS 2.0

跳至解决方案
885 次查看
michaelsteffenf
NXP Employee
NXP Employee

All,

Using a FRDM-KL03Z board, and
programming the attached code in IAR and KDS, I get different results.

 

In IAR, red led flashes at exactly 100ms.

In KDS, red led flashes at exactly 200ms.

 

I checked everywhere where I could find a clock divide/2 and nothing.  I’m using the HIRC (48MHz), and
I can’t find any divide/2 except in OUTDIV1.

  

The Systick timer uses the core clock, which is not being divided down from the OUTDIV1 register.  The
memory location 0x04D, that controls the value at reset, is at 0x3D in IAR and KDS.

 

 

What am I missing?

 

 

Michael Steffen

 

 

 

 

Original Attachment has been moved to: KL03_Systick.txt.zip

标记 (4)
0 项奖励
回复
1 解答
499 次查看
michaelsteffenf
NXP Employee
NXP Employee

Ok, I found the answer.

In KDS startup code in system_MKL03Z4.h, line 154,155, the statement

/* SIM_CLKDIV1: OUTDIV1=1,OUTDIV4=1 */

#define SYSTEM_SIM_CLKDIV1_VALUE     0x10010000u         /* SIM_CLKDIV1 */

The OUTDIV1 is the core clock, which is divide/2.  So the core clock is actually at 24MHz instead of 48MHz.

Mike

在原帖中查看解决方案

0 项奖励
回复
1 回复
500 次查看
michaelsteffenf
NXP Employee
NXP Employee

Ok, I found the answer.

In KDS startup code in system_MKL03Z4.h, line 154,155, the statement

/* SIM_CLKDIV1: OUTDIV1=1,OUTDIV4=1 */

#define SYSTEM_SIM_CLKDIV1_VALUE     0x10010000u         /* SIM_CLKDIV1 */

The OUTDIV1 is the core clock, which is divide/2.  So the core clock is actually at 24MHz instead of 48MHz.

Mike

0 项奖励
回复