<?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: K20FX Bus Clock Seems to be 120MHz? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547229#M33362</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi NORMAN,&lt;/P&gt;&lt;P&gt;Have you observe the frequency of FlexBus clock with an oscilloscope?&lt;/P&gt;&lt;P&gt;If the frequency of FlexBus clock is 30MHz (SIM_CLKDIV1=0x01370000), then the Bus clock should be correct(60MHz).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PTA6 and PTC3 can be configured as CLKOUT function (use PORTx_PCRn[MUX]). You can select the CLKOUT output FlexBus clock(SIM_SOPT2[CLKOUTSEL]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have &lt;A href="http://www.nxp.com/products/software-and-tools/run-time-software/kinetis-software-and-tools/ides-for-kinetis-mcus/kinetis-design-studio-integrated-development-environment-ide:KDS_IDE"&gt;Kinetis Design Studio&lt;/A&gt;, then you can compared the code which is generated by Processor Expert.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="K20FX Processor Expert.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/36657iDE65DE33959B16B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="K20FX Processor Expert.png" alt="K20FX Processor Expert.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jul 2016 10:27:24 GMT</pubDate>
    <dc:creator>Robin_Shen</dc:creator>
    <dc:date>2016-07-08T10:27:24Z</dc:date>
    <item>
      <title>K20FX Bus Clock Seems to be 120MHz?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547228#M33361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;We've got a 16MHz crystal hooked up to a K20FX512, and we're trying to configure it in PEE mode to generate a system clock at 120MHz and a bus clock at 60MHz. The code gets through the MCG initialisation, but then whether we generate a PWM out of one of the timers, or setup UART5, we get speeds twice what we're expecting. The setup code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SIM_CLKDIV1=(0&amp;lt;&amp;lt;28)|(1&amp;lt;&amp;lt;24)|(3&amp;lt;&amp;lt;20)|(7&amp;lt;&amp;lt;16); //120 system, 60 bus, 30 flexbus, 15 flash&lt;/P&gt;&lt;P&gt;SIM_SOPT2=(SIM_SOPT2&amp;amp;~(0b11&amp;lt;&amp;lt;16))|(0b01&amp;lt;&amp;lt;16); //PLL0CLK&lt;/P&gt;&lt;P&gt;OSC0_CR=(1&amp;lt;&amp;lt;7);&lt;/P&gt;&lt;P&gt;OSC0_CR|=(1&amp;lt;&amp;lt;1); //8pF&lt;/P&gt;&lt;P&gt;MCG_C2=0b00101100;&lt;/P&gt;&lt;P&gt;MCG_C1=0b10100000; //External Reference as system clock -&amp;gt; 16mhz/512=31.25khz&lt;/P&gt;&lt;P&gt;while(!(MCG_S&amp;amp;(1&amp;lt;&amp;lt;1))); //Wait for OSCINIT0&lt;/P&gt;&lt;P&gt;while((MCG_S&amp;amp;(1&amp;lt;&amp;lt;4))); //Wait for !IREFST&lt;/P&gt;&lt;P&gt;while((MCG_S&amp;amp;(0b11&amp;lt;&amp;lt;2))!=(0b10&amp;lt;&amp;lt;2)); //Wait for CLKST=External Clock&lt;/P&gt;&lt;P&gt;MCG_C5=0b01000001; //PRDIV=2&lt;/P&gt;&lt;P&gt;MCG_C6=0b01001110; //PLL selected, x30=240Mhz&lt;/P&gt;&lt;P&gt;while(!(MCG_S&amp;amp;(1&amp;lt;&amp;lt;5))); //Wait for PLLST&lt;/P&gt;&lt;P&gt;while(!(MCG_S&amp;amp;(1&amp;lt;&amp;lt;6))); //Wait for LOCK0&lt;/P&gt;&lt;P&gt;MCG_C1=0b00100000; //PLL as system clock&lt;/P&gt;&lt;P&gt;while((MCG_S&amp;amp;(0b11&amp;lt;&amp;lt;2))!=(0b11&amp;lt;&amp;lt;2)); //Wait for CLKST=PLL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case I've missed something obvious here, the PWM and UART setups are:&lt;/P&gt;&lt;P&gt;FTM3_SC=0b00001111; //Bus/128 = 468750Hz&lt;/P&gt;&lt;P&gt;FTM3_MOD=46875; //10Hz&lt;/P&gt;&lt;P&gt;FTM3_C1SC=0b00100100; //Edge Aligned PWM Set on match&lt;/P&gt;&lt;P&gt;FTM3_C1V=46875/2;&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;P&gt;tempbd=60000000/16/9600;&lt;/P&gt;&lt;P&gt;UART5_C2=0;&lt;/P&gt;&lt;P&gt;UART5_C1=0;&lt;/P&gt;&lt;P&gt;UART5_BDH=tempbd&amp;gt;&amp;gt;8;&lt;/P&gt;&lt;P&gt;UART5_BDL=tempbd;&lt;/P&gt;&lt;P&gt;UART5_C3=0b00001111;&lt;/P&gt;&lt;P&gt;enable_irq(INT_UART5_RX_TX-16);&lt;/P&gt;&lt;P&gt;UART5_C2=0b00111100;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Alex.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2016 23:11:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547228#M33361</guid>
      <dc:creator>HummingbirdElec</dc:creator>
      <dc:date>2016-07-07T23:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: K20FX Bus Clock Seems to be 120MHz?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547229#M33362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi NORMAN,&lt;/P&gt;&lt;P&gt;Have you observe the frequency of FlexBus clock with an oscilloscope?&lt;/P&gt;&lt;P&gt;If the frequency of FlexBus clock is 30MHz (SIM_CLKDIV1=0x01370000), then the Bus clock should be correct(60MHz).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PTA6 and PTC3 can be configured as CLKOUT function (use PORTx_PCRn[MUX]). You can select the CLKOUT output FlexBus clock(SIM_SOPT2[CLKOUTSEL]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have &lt;A href="http://www.nxp.com/products/software-and-tools/run-time-software/kinetis-software-and-tools/ides-for-kinetis-mcus/kinetis-design-studio-integrated-development-environment-ide:KDS_IDE"&gt;Kinetis Design Studio&lt;/A&gt;, then you can compared the code which is generated by Processor Expert.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="K20FX Processor Expert.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/36657iDE65DE33959B16B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="K20FX Processor Expert.png" alt="K20FX Processor Expert.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 10:27:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547229#M33362</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2016-07-08T10:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: K20FX Bus Clock Seems to be 120MHz?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547230#M33363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply Robin,&lt;/P&gt;&lt;P&gt;I was able to measure the FlexBUS clock on PTC3, and found that it was running at 60MHz. I'm using Codewarrior, so I started a new project with Processor Expert and compared the generated setup code with my own. Besides confirming the reset states of a lot of registers, the only significant difference I found was that the oscillator was set for low-power, rather than high-gain operation.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;MCG_C2=0b00100100;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Changing my code to low-power operation (HGO0, in MCG_C2, above) resolved the problem. Looking at the reference manual, it appears that "High-frequency, high-gain" is only a valid mode on Connections 2 and 3 - are the connections numbered 1 - EXTAL0, 2 - EXTAL1, 3 - EXTAL32?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2016 01:26:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547230#M33363</guid>
      <dc:creator>HummingbirdElec</dc:creator>
      <dc:date>2016-07-11T01:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: K20FX Bus Clock Seems to be 120MHz?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547231#M33364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi NORMAN,&lt;/P&gt;&lt;P&gt;The FlexBUS clock on PTC3 should not running at 60MHz, according to the datasheet the maximum frequency is 50MHz .&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="FlexBus clock.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/37186i728EADAEB8EF11CE/image-size/large?v=v2&amp;amp;px=999" role="button" title="FlexBus clock.png" alt="FlexBus clock.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please observe the values of SIM_CLKDIV1\ MCG_C5\ MCG_C6 when debugging. The Divide Factor and Multiply Factor should equal the values in below image.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Clock.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/37216i51188AD810B48744/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clock.png" alt="Clock.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tested the project generated by ProcessorExpert? Will the FlexBUS clock on PTC3 change if you only change the Oscillator operating mode?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have K20FX512, so I test it on TWR-K60F120M board.&lt;/P&gt;&lt;P&gt;Changing the the Oscillator operating mode will not change the FlexBUS clock on PTC3(or period of PWM) on my board. But I am using "System oscillator 1", there is a 12MHz crystal connected on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the Mask Set of your K20FX512? So that we can check whether it has some errata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Are the connections numbered 1 - EXTAL0, 2 - EXTAL1, 3 - EXTAL32?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;No.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Connection 1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/37217i8C27EF6848AAB331/image-size/large?v=v2&amp;amp;px=999" role="button" title="Connection 1.png" alt="Connection 1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Connection 1: Figure 26-2. Crystal/Ceramic Resonator Connections&lt;/P&gt;&lt;P&gt;Connection 2: Figure 26-3. Crystal/Ceramic Resonator Connections&lt;/P&gt;&lt;P&gt;Connection 3: Figure 26-4. Crystal/Ceramic Resonator Connections&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 12:56:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20FX-Bus-Clock-Seems-to-be-120MHz/m-p/547231#M33364</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2016-07-12T12:56:38Z</dc:date>
    </item>
  </channel>
</rss>

