KL03 SysTick Timer in IAR vs. KDS 2.0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KL03 SysTick Timer in IAR vs. KDS 2.0

Jump to solution
884 Views
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

0 Kudos
Reply
1 Solution
498 Views
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

View solution in original post

0 Kudos
Reply
1 Reply
499 Views
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 Kudos
Reply