<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Init clock K20D72M  in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083128#M57589</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Hi,&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Why not try the attachment I have given you? We do not have this board's latest sdk. Only the old code.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 May 2020 01:32:08 GMT</pubDate>
    <dc:creator>nxf56274</dc:creator>
    <dc:date>2020-05-06T01:32:08Z</dc:date>
    <item>
      <title>Init clock K20D72M</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083123#M57584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;Good morning&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;I need to init the clock for 72 MHz on the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;K20D72M&lt;SPAN&gt;&amp;nbsp;board&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;The xtal is 8000000 Hz&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;I see on the scope it is oscillating&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;I use the following data structure&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;const mcg_config_t mcgConfig_BOARD_BootClockRUN =&lt;BR /&gt; {&lt;BR /&gt; .mcgMode = kMCG_ModePEE, /* PEE - PLL Engaged External */&lt;BR /&gt; .irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enabled, MCGIRCLK disabled in STOP mode */&lt;BR /&gt; .ircs = kMCG_IrcSlow, /* Slow internal reference clock selected */&lt;BR /&gt; .fcrdiv = 0x0U, /* Fast IRC divider: divided by 1 */&lt;BR /&gt; .frdiv = 0x0U, /* FLL reference clock divider: divided by 32 */&lt;BR /&gt; .drs = kMCG_DrsLow, /* Low frequency range */&lt;BR /&gt; .dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25% */&lt;BR /&gt; .oscsel = kMCG_OscselOsc, /* Selects System Oscillator (OSCCLK) */&lt;BR /&gt; .pll0Config =&lt;BR /&gt; {&lt;BR /&gt; .enableMode = MCG_PLL_ENABLE, /* MCGPLLCLK enabled */&lt;BR /&gt; .prdiv = 0x02U, /* PLL Reference divider: divided by 3 */&lt;BR /&gt; .vdiv = 03U, /* VCO divider: multiplied by 27 */&lt;BR /&gt; },&lt;BR /&gt; };&lt;BR /&gt;const sim_clock_config_t simConfig_BOARD_BootClockRUN =&lt;BR /&gt; {&lt;BR /&gt; .pllFllSel = SIM_PLLFLLSEL_MCGPLLCLK_CLK, /* PLLFLL select: MCGPLLCLK clock */&lt;BR /&gt; .er32kSrc = SIM_OSC32KSEL_RTC32KCLK_CLK, /* OSC32KSEL select: RTC32KCLK clock (32.768kHz) */&lt;BR /&gt; .clkdiv1 = 0x01130000U, /* SIM_CLKDIV1 - OUTDIV1: /1, OUTDIV2: /2, OUTDIV3: /2, OUTDIV4: /4 */&lt;BR /&gt; };&lt;BR /&gt;const osc_config_t oscConfig_BOARD_BootClockRUN =&lt;BR /&gt; {&lt;BR /&gt; .freq = 8000000U, /* Oscillator frequency: 50000000Hz */&lt;BR /&gt; .capLoad = (OSC_CR_SC8P_MASK), /* Oscillator capacity load: 0pF */&lt;BR /&gt; .workMode = kOSC_ModeOscHighGain, /* Use external clock */&lt;BR /&gt; .oscerConfig =&lt;BR /&gt; {&lt;BR /&gt; .enableMode = kOSC_ErClkEnable, /* Enable external reference clock, disable external reference clock in STOP mode */&lt;BR /&gt; }&lt;BR /&gt; };&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;No way. It stops here&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt; while ((MCG-&amp;gt;S &amp;amp; (MCG_S_IREFST_MASK | MCG_S_CLKST_MASK)) !=&lt;BR /&gt; (MCG_S_IREFST(kMCG_FllSrcExternal) | MCG_S_CLKST(kMCG_ClkOutStatExt)))&lt;BR /&gt; {&lt;BR /&gt; }&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;Suggestions needed.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;Thank You&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333f48; background-color: #ffffff;"&gt;&lt;SPAN&gt;Pietro&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 09:12:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083123#M57584</guid>
      <dc:creator>pietrodicastri</dc:creator>
      <dc:date>2020-04-27T09:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Init clock K20D72M</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083124#M57585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;k20's code is old. I will give you the attachment. This code only support IAR and codewarrior. And the IAR version is 7.8.&amp;nbsp; The higher version may cause some problems.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 06:03:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083124#M57585</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-04-28T06:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Init clock K20D72M</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083125#M57586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Da Li&lt;/P&gt;&lt;P&gt;Thank You for the suggestion. Effectively the structure of the code is totally different and difficult to analyze for exporting the logic. I tried anyway.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a solution just try and test. If I modify the function of the SDK&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void CLOCK_InitOsc0(osc_config_t const *config)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; uint8_t range = CLOCK_GetOscRangeFromFreq(config-&amp;gt;freq);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OSC_SetCapLoad(OSC0, config-&amp;gt;capLoad);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; oscer_config_t oscer_config;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; oscer_config.enableMode = config-&amp;gt;oscerConfig.enableMode &amp;amp; !kOSC_ErClkEnable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OSC_SetExtRefClkConfig(OSC0, &amp;amp;oscer_config );&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MCG-&amp;gt;C2 = ((MCG-&amp;gt;C2 &amp;amp; ~OSC_MODE_MASK) | MCG_C2_RANGE(range) | (uint8_t)config-&amp;gt;workMode);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if ((kOSC_ModeExt != config-&amp;gt;workMode) &amp;amp;&amp;amp; (OSC0-&amp;gt;CR &amp;amp; OSC_CR_ERCLKEN_MASK))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; /* Wait for stable. */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; while (!(MCG-&amp;gt;S &amp;amp; MCG_S_OSCINIT0_MASK))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; }&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; }&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; OSC_SetExtRefClkConfig(OSC0, &amp;amp;config-&amp;gt;oscerConfig );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;in such way the initialization proceed correctly.&amp;nbsp; It seems it does not tolerate to have the&amp;nbsp;ERCLKEN set in the&amp;nbsp;OSC_CR.&lt;/P&gt;&lt;P&gt;There is no explanation to me. I clear the flag and I set again before exiting. I have a function to verify the results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void clocks_dump( void )&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.core_frequency = CLOCK_GetFreq( kCLOCK_CoreSysClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.bus_frequency = CLOCK_GetFreq( kCLOCK_BusClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.flash_frequency = CLOCK_GetFreq( kCLOCK_FlashClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.osc0Er_frequency = CLOCK_GetFreq( kCLOCK_Osc0ErClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.osc0ErUndiv_frequency = CLOCK_GetFreq( kCLOCK_Osc0ErClkUndiv );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.mcgFll_frequency = CLOCK_GetFreq( kCLOCK_McgFllClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.mcgFf_frequency = CLOCK_GetFreq( kCLOCK_McgFixedFreqClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.mcgIr_frequency = CLOCK_GetFreq( kCLOCK_McgInternalRefClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.lpo_frequency = CLOCK_GetFreq( kCLOCK_LpoClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.mcgOut_frequency = CLOCK_GetOutClkFreq();&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; clocks.osc32_frequency = CLOCK_GetFreq( kCLOCK_Er32kClk );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get these results&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/107193i8B996C81EE67E93D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sin&lt;/STRONG&gt;ce I do not find the logic in it You and everyone is welcome to express.&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pietro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 08:52:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083125#M57586</guid>
      <dc:creator>pietrodicastri</dc:creator>
      <dc:date>2020-04-28T08:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Init clock K20D72M</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083126#M57587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;unfortunately despite the good values on the dumping clocks it is not working fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The debug console is not outputting correct data. So I don t know.&lt;/P&gt;&lt;P&gt;Still the question is open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestions needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pietro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:47:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083126#M57587</guid>
      <dc:creator>pietrodicastri</dc:creator>
      <dc:date>2020-04-28T11:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Init clock K20D72M</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083127#M57588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning&lt;/P&gt;&lt;P&gt;I need to initialize the kit with the SDK. The question is very limited I can well suppose a bunch of people have already done.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This board has a xtal to run with and the SDK does not provide the procedure to initialize.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Such situation needs a support.&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pietro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 06:37:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083127#M57588</guid>
      <dc:creator>pietrodicastri</dc:creator>
      <dc:date>2020-04-30T06:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Init clock K20D72M</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083128#M57589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Hi,&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Why not try the attachment I have given you? We do not have this board's latest sdk. Only the old code.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2020 01:32:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083128#M57589</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-05-06T01:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Init clock K20D72M</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083129#M57590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Da Li&lt;/P&gt;&lt;P&gt;I have a hard time to find a solution. The problem with the example is that even if it works I do not see a direct way of detecting the problem in&amp;nbsp; using the SDK.&lt;/P&gt;&lt;P&gt;I have now found a working solution, The parameters in the SDK structure produce the right clock, but in the example the clock source for the debugging uart was the BUS clock in place of the CORE clock so it was not appearing to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now it is running correctly with the modification in the SDK function.&lt;/P&gt;&lt;P&gt;So far I have a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You for supporting,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pietro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2020 08:29:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Init-clock-K20D72M/m-p/1083129#M57590</guid>
      <dc:creator>pietrodicastri</dc:creator>
      <dc:date>2020-05-07T08:29:48Z</dc:date>
    </item>
  </channel>
</rss>

