Hello,
I have a question regarding Clock APIs of the KSDK.
Context:
I expect to have a 100MHz System clock with this configuration : 10MHz / 256 * 2560 = 100MHz.
However, all APIs from KSDK 2.0 or earlier (CLOCK_GetCoreSysClkFreq, SystemCoreClockUpdate) report a System clock of 99998720Hz.
I understand this is a rouding issue (10MHz/256 = 39062.5Hz), but I am wondering if the "real" System Clock is 100MHz or 99998720Hz due to some internal FLL behavior?
已解决! 转到解答。
Hi, Francois,
The 99.99872MHz clock is not the real clock frequency, the real clock is 100MHz, in order to confirm it, you can output a clock to the PTC3 pin which is multiplexed with CLKOUT for K22 chip. You can set up the CLKOUTSEL bits in SIM_SOPT2 to output the BUS_CLK so that you can figure out the real clock frequency.
Because the api function CLOCK_GetCoreSysClkFreq() uses integer to compute the clock frequency based on MCG register configuration, so it gives the result because of rounding. Frankly speaking, the core has no way to know the real clock frequency.
Hope it can help you.
BR
Xiangjun rong
Hi, Francois,
The 99.99872MHz clock is not the real clock frequency, the real clock is 100MHz, in order to confirm it, you can output a clock to the PTC3 pin which is multiplexed with CLKOUT for K22 chip. You can set up the CLKOUTSEL bits in SIM_SOPT2 to output the BUS_CLK so that you can figure out the real clock frequency.
Because the api function CLOCK_GetCoreSysClkFreq() uses integer to compute the clock frequency based on MCG register configuration, so it gives the result because of rounding. Frankly speaking, the core has no way to know the real clock frequency.
Hope it can help you.
BR
Xiangjun rong