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
已解决! 转到解答。
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
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