<?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: Change System/Core Frequency - KL43 in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608697#M6299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Santhosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem here is that LPUART's clock is taking a wrong value in debug initialization function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you look at BOARD_InitDebugConsole function will notice that uartClkSrcFreq is taken from BOARD_DEBUG_UART_CLK_FREQ and this macro is using the CLOCK_GetCoreSysClkFreq. Like LPUART0 is taken its reference from HIRC (48MHz) and Core clock is 48 MHz / 2, you are initializing LPUART module as if it was taken 24MHz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to modify this code as follows:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="property macro token"&gt;#if DEFAULT&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uartClkSrcFreq &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; BOARD_DEBUG_UART_CLK_FREQ&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#else&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;/* Take HIRC reference (48MHz) */&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uartClkSrcFreq &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;CLOCK_GetFreq&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCLOCK_McgIrc48MClk&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#endif‍‍‍‍‍‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(DEFAULT macro was set to 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, uartClkSrcFreq will get 48000000 value (48MHz) and LPUART's baud rate will be calculated correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this can help you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isaac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Oct 2016 23:32:13 GMT</pubDate>
    <dc:creator>isaacavila</dc:creator>
    <dc:date>2016-10-07T23:32:13Z</dc:date>
    <item>
      <title>Change System/Core Frequency - KL43</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608695#M6297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to update the system frequency for the hello world program running on the FRDM board. I updated the core frequency value to 24 MHz and changed the CLKDIV1 value to divide IRC48M by 2. I also configured the SysTick to provide an interrupt once every 0.5 seconds and use the Red and Green LED toggle to verify the frequency for SysTick.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the UART debug console is now working with a wrong baud rate. (The prints are gibberish and the echo feature is also gibberish). I have gone through the Debug code and can't find any reference to system clock other than specific function calls that read the value (ie there is no hard coded value that I could find).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please let me know what I'm missing? Here is the code that I modified in clock_config.c&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/* Configuration for enter RUN mode. Core clock = &lt;STRONG&gt;24&lt;/STRONG&gt;000000Hz. */&lt;BR /&gt;const clock_config_t g_defaultClockConfigRun = {&lt;BR /&gt; .mcgliteConfig =&lt;BR /&gt; {&lt;BR /&gt; .outSrc = kMCGLITE_ClkSrcHirc,&lt;BR /&gt; .irclkEnableMode = 0U,&lt;BR /&gt; .ircs = kMCGLITE_Lirc8M,&lt;BR /&gt; .fcrdiv = kMCGLITE_LircDivBy1,&lt;BR /&gt; .lircDiv2 = kMCGLITE_LircDivBy1,&lt;BR /&gt; .hircEnableInNotHircMode = true,&lt;BR /&gt; },&lt;BR /&gt; .simConfig =&lt;BR /&gt; {&lt;BR /&gt; .clkdiv1 = &lt;STRONG&gt;0x10010000U&lt;/STRONG&gt;, /* SIM_CLKDIV1. */&lt;BR /&gt; },&lt;BR /&gt; .oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,&lt;BR /&gt; .capLoad = 0U,&lt;BR /&gt; .workMode = kOSC_ModeOscLowPower,&lt;BR /&gt; .oscerConfig =&lt;BR /&gt; {&lt;BR /&gt; .enableMode = kOSC_ErClkEnable,&lt;BR /&gt;#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) &amp;amp;&amp;amp; FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)&lt;BR /&gt; .erclkDiv = 0U,&lt;BR /&gt;#endif&lt;BR /&gt; }},&lt;BR /&gt; .coreClock = &lt;STRONG&gt;24&lt;/STRONG&gt;000000U, /* Core clock frequency */&lt;BR /&gt;};&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help. &lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="205680" data-objecttype="3" href="https://community.nxp.com/people/michaelsteffenfae"&gt;michaelsteffenfae&lt;/A&gt; &lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="201652" data-objecttype="3" href="https://community.nxp.com/people/CChilton"&gt;Camron Chilton&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 17:21:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608695#M6297</guid>
      <dc:creator>srcoolz</dc:creator>
      <dc:date>2016-10-05T17:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change System/Core Frequency - KL43</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608696#M6298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just adding another data point:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I change debug initialization code in board.c with baudrate 57600 (half of 115200) then it works fine. I can leave the terminal program on my PC at baud rate 115200 and the messages are fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, &lt;STRONG&gt;57600/*BOARD_DEBUG_UART_BAUDRATE*/&lt;/STRONG&gt;, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This kind of indicates that the clock being used by the LPUART is still at 48Mhz (IRC48M) but the baud rate calculator uses system/core clock which is 24Mhz. It would also make sense based on&amp;nbsp;the clock source for the LPUART as defined in the SIM registers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please confirm? Is this a software bug in the freedom board code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 17:48:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608696#M6298</guid>
      <dc:creator>srcoolz</dc:creator>
      <dc:date>2016-10-05T17:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change System/Core Frequency - KL43</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608697#M6299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Santhosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem here is that LPUART's clock is taking a wrong value in debug initialization function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you look at BOARD_InitDebugConsole function will notice that uartClkSrcFreq is taken from BOARD_DEBUG_UART_CLK_FREQ and this macro is using the CLOCK_GetCoreSysClkFreq. Like LPUART0 is taken its reference from HIRC (48MHz) and Core clock is 48 MHz / 2, you are initializing LPUART module as if it was taken 24MHz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to modify this code as follows:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="property macro token"&gt;#if DEFAULT&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uartClkSrcFreq &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; BOARD_DEBUG_UART_CLK_FREQ&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#else&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;/* Take HIRC reference (48MHz) */&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uartClkSrcFreq &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;CLOCK_GetFreq&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;kCLOCK_McgIrc48MClk&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#endif‍‍‍‍‍‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(DEFAULT macro was set to 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, uartClkSrcFreq will get 48000000 value (48MHz) and LPUART's baud rate will be calculated correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this can help you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isaac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Oct 2016 23:32:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608697#M6299</guid>
      <dc:creator>isaacavila</dc:creator>
      <dc:date>2016-10-07T23:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change System/Core Frequency - KL43</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608698#M6300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Isaac,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I actually changed the code to the following and here is the snippet. It works fine now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="code_change.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/3232iD66E1F3E0C635508/image-size/large?v=v2&amp;amp;px=999" role="button" title="code_change.jpg" alt="code_change.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2016 02:26:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Change-System-Core-Frequency-KL43/m-p/608698#M6300</guid>
      <dc:creator>srcoolz</dc:creator>
      <dc:date>2016-10-10T02:26:06Z</dc:date>
    </item>
  </channel>
</rss>

