<?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: K20D50 - Toggle IO pin max speed in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284954#M10902</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paulo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the GPIO register has been set or clear, there with some delay added to GPIO IO pin. That's why you could find GPIO toggle speed not as expected.&lt;/P&gt;&lt;P&gt;If you want to generate a fast frequency pulse output, you could consider to use FlexTimer module to generate PWM signal output.&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B.R.&lt;/P&gt;&lt;P&gt;Ma Hui &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Sep 2013 06:52:47 GMT</pubDate>
    <dc:creator>Hui_Ma</dc:creator>
    <dc:date>2013-09-02T06:52:47Z</dc:date>
    <item>
      <title>K20D50 - Toggle IO pin max speed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284953#M10901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the max frequency i can toggle an IO pin using the MK20DX128 with 8Mhz crystal and PLL enabled to output 50Mhz?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used the ProcesssorExpert to configure the clock settings&amp;nbsp; and i got the following configuration output:&lt;/P&gt;&lt;P&gt;Core clock: 50Mhz&lt;/P&gt;&lt;P&gt;Bus clock: 50Mhz&lt;/P&gt;&lt;P&gt;External bus close: 50Mhz&lt;/P&gt;&lt;P&gt;Flash clock 25Mhz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrote the code bellow for testing, but according with my scope the toggling frequency is only&amp;nbsp; 3.571Mhz. From the disassembly i can see that 4 instructions are needed to toggle the pin, that makes the core speed at 4 * 2 * 3.571Mhz = 28.568Mhz???&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;while(1)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;//RED_TOGGLE;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;GPIOC_PTOR = 8;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;GPIOC_PTOR = 8;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;GPIOC_PTOR = 8;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;GPIOC_PTOR = 8;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Paulo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 16:03:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284953#M10901</guid>
      <dc:creator>paulolouro</dc:creator>
      <dc:date>2013-08-30T16:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: K20D50 - Toggle IO pin max speed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284954#M10902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paulo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the GPIO register has been set or clear, there with some delay added to GPIO IO pin. That's why you could find GPIO toggle speed not as expected.&lt;/P&gt;&lt;P&gt;If you want to generate a fast frequency pulse output, you could consider to use FlexTimer module to generate PWM signal output.&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B.R.&lt;/P&gt;&lt;P&gt;Ma Hui &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2013 06:52:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284954#M10902</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2013-09-02T06:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: K20D50 - Toggle IO pin max speed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284955#M10903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hui_Ma,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ya i can see there was some different behave from what i was expecting. The propose was only to check that the core clock was working as expected and that we were in fact running at 50Mhz. What i have done to manage that was to implement the SYSTick and then toggle a PIN via the ISR. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what i have concluded is it that's 4 instructions cycles to process the each line &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;GPIOC_PTOR = 8&lt;/SPAN&gt; and then an extra 3 for something else. Maybe 2 cycles for the bus and 1 for the IO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a document that explain Bus/FlexModules read write times?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Paulo Louro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2013 08:14:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284955#M10903</guid>
      <dc:creator>paulolouro</dc:creator>
      <dc:date>2013-09-02T08:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: K20D50 - Toggle IO pin max speed</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284956#M10904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paulo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would recommend you to use PTC3 pin (ALT5 function is CLKOUT), and with below setting, you could measure the Flash clock 25MHz on scope.&lt;/P&gt;&lt;P&gt;The PTC3 pin function setting:&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SOPT2 |= SIM_SOPT2_CLKOUTSEL(2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; PORTC_PCR3 = PORT_PCR_MUX(5);&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B.R.&lt;/P&gt;&lt;P&gt;Ma Hui&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 02:09:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K20D50-Toggle-IO-pin-max-speed/m-p/284956#M10904</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2013-09-03T02:09:16Z</dc:date>
    </item>
  </channel>
</rss>

