<?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: FRDM-K20D50M clock system in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-clock-system/m-p/352697#M17504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed, as Mark said, the maximum interrupt rate that the device can handle is about 500kHz (interrupts take about &lt;STRONG&gt;2us&lt;/STRONG&gt; at 50MHz).&lt;/P&gt;&lt;P&gt;This is because the &lt;STRONG&gt;Interrupt&lt;/STRONG&gt; &lt;STRONG&gt;Latency&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The term interrupt latency refers to the number of clock cycles required for a processor to respond to an interrupt request, this is typically a measure based on the number of clock cycles between the assertion of the interrupt request up to the cycle where the first instruction of the interrupt handler exected.&lt;/P&gt;&lt;P&gt;Ideally, the interrupt latency should be low.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The interrupt latency of the ARM Cortex M4 is, in the best case, &lt;STRONG&gt;12&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, as in any program code, the ISRs take time to execute.&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="latency.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/51023i63749763B675FDE3/image-size/large?v=v2&amp;amp;px=999" role="button" title="latency.JPG" alt="latency.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P align="center"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case of your application and using Processor Expert, the ISR takes about 80 clock cycles to execute it and I takes about 10 to Return Latency.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In conclusion, if we add all the clock cycles that requires to execute an interrupt, we have 102 clock cycles that means:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 clock cycle&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 ns&lt;/P&gt;&lt;P&gt;102 clock cycle&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="text-decoration: underline;"&gt;2.040 us&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hope this information will be useful for you.&lt;/P&gt;&lt;P&gt;Have a great day. :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;David Diaz.&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Mar 2015 21:16:18 GMT</pubDate>
    <dc:creator>david_diaz</dc:creator>
    <dc:date>2015-03-04T21:16:18Z</dc:date>
    <item>
      <title>FRDM-K20D50M clock system</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-clock-system/m-p/352695#M17502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;i am new in ARMs, new in Kinetis and new in Processor Expert.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I try to setup the clock system of this Evaluation system. To test the setup i want to toggle a pin in the main function. But i cannot see a clean toggle signal. An other idea was to toggle the pin in an timer interrupt. If i choose Period of 100 Khz, i can see a clean toggl&lt;SPAN style="font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;e signal on the &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;oscilloscope. If i change the period to 50 Khz or 1 Mhz i cannot see a clean signal.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;Does anybody an idea what's going wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;Daniel&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 10:34:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-clock-system/m-p/352695#M17502</guid>
      <dc:creator>danielegener</dc:creator>
      <dc:date>2015-03-03T10:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M clock system</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-clock-system/m-p/352696#M17503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1MHz is too fast for the K20D50 - the maximum interrupt rate that it can handle is about 500kHz (interrupts take about 2us at 50MHz).&lt;/P&gt;&lt;P&gt;However 250kHz and 50kHz interrupts on two flex timers is not a problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/50964i359F98B264463A4A/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I have measured two FlexTimer interrupts toggling the LEDs on the board at 50kHz and 250kHz rates. The 50kHz toggle is very stable but the faster one has some jitter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The binary is attached.&lt;/P&gt;&lt;P&gt;The third LED is togged at 2.5Hz by a software timer and the UART on the OpenSDA virtual COM connection is fully operational at the same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know if or why the PE configuration may have problems with specific speeds but you can compare the register setups to maybe see something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I set up the FlexTimers&amp;nbsp; in the uTasker framework as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14254019327202115 jive_text_macro jive_macro_code" jivemacro_uid="_14254019327202115"&gt;
&lt;P&gt;TIMER_INTERRUPT_SETUP timer_setup; // interrupt configuration parameters&lt;/P&gt;
&lt;P&gt;_CONFIG_PORT_OUTPUT_FAST_LOW(A, PORTA_BIT2, (PORT_SRE_FAST | PORT_DSE_LOW)); // configure port outputs (LEDs)&lt;/P&gt;
&lt;P&gt;_CONFIG_PORT_OUTPUT_FAST_LOW(C, PORTC_BIT3, (PORT_SRE_FAST | PORT_DSE_LOW));&lt;/P&gt;
&lt;P&gt;timer_setup.int_type = TIMER_INTERRUPT;&lt;/P&gt;
&lt;P&gt;timer_setup.int_priority = PRIORITY_TIMERS;&lt;/P&gt;
&lt;P&gt;timer_setup.int_handler = timer_int; // interrupt handler&lt;/P&gt;
&lt;P&gt;timer_setup.timer_reference = 0; // FlexTimer 0&lt;/P&gt;
&lt;P&gt;timer_setup.timer_mode = (TIMER_PERIODIC); // period timer interrupt&lt;/P&gt;
&lt;P&gt;timer_setup.timer_value = TIMER_US_DELAY(20); // 20us periodic interrupt&lt;/P&gt;
&lt;P&gt;fnConfigureInterrupt((void *)&amp;amp;timer_setup); // configure for first timer&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;timer_setup.timer_reference = 1; // FlexTimer 1&lt;/P&gt;
&lt;P&gt;timer_setup.int_handler = timer_int_1M; // interrupt handler&lt;/P&gt;
&lt;P&gt;timer_setup.timer_value = TIMER_US_DELAY(4); // 4us periodic interrupt&lt;/P&gt;
&lt;P&gt;fnConfigureInterrupt((void *)&amp;amp;timer_setup);&amp;nbsp; // configure for secondtimer&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The interrupt handlers do:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;static void timer_int(void)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _TOGGLE_PORT(C, PORTC_BIT3);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;static void timer_int_1M(void)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _TOGGLE_PORT(A, PORTA_BIT2);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note however that generally a timer will not be used to perform such a function because it is much easier and more accurate to configure a PWM output on the FlexTimer to generate a high precision output without any interrupt overhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;K20: &lt;A href="http://www.utasker.com/kinetis/TWR-K20D72M.html" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="http://www.utasker.com/kinetis/TWR-K20D72M.html"&gt;µTasker Kinetis TWR-K20D72M support&lt;/A&gt; / &lt;A href="http://www.utasker.com/kinetis/FRDM-K20D50M.html" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="http://www.utasker.com/kinetis/FRDM-K20D50M.html"&gt;µTasker Kinetis FRDM-K20D50M support&lt;/A&gt; / &lt;A href="http://www.utasker.com/kinetis/TWR-K20D50M.html" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="http://www.utasker.com/kinetis/TWR-K20D50M.html"&gt;µTasker Kinetis TWR-K20D50M support&lt;/A&gt; / &lt;A href="http://www.utasker.com/kinetis/TEENSY_3.1.html" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="http://www.utasker.com/kinetis/TEENSY_3.1.html"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hardware Timers: &lt;A href="http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF"&gt;http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:12:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-clock-system/m-p/352696#M17503</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2020-11-02T13:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-K20D50M clock system</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-clock-system/m-p/352697#M17504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed, as Mark said, the maximum interrupt rate that the device can handle is about 500kHz (interrupts take about &lt;STRONG&gt;2us&lt;/STRONG&gt; at 50MHz).&lt;/P&gt;&lt;P&gt;This is because the &lt;STRONG&gt;Interrupt&lt;/STRONG&gt; &lt;STRONG&gt;Latency&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The term interrupt latency refers to the number of clock cycles required for a processor to respond to an interrupt request, this is typically a measure based on the number of clock cycles between the assertion of the interrupt request up to the cycle where the first instruction of the interrupt handler exected.&lt;/P&gt;&lt;P&gt;Ideally, the interrupt latency should be low.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The interrupt latency of the ARM Cortex M4 is, in the best case, &lt;STRONG&gt;12&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, as in any program code, the ISRs take time to execute.&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="latency.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/51023i63749763B675FDE3/image-size/large?v=v2&amp;amp;px=999" role="button" title="latency.JPG" alt="latency.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P align="center"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case of your application and using Processor Expert, the ISR takes about 80 clock cycles to execute it and I takes about 10 to Return Latency.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In conclusion, if we add all the clock cycles that requires to execute an interrupt, we have 102 clock cycles that means:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 clock cycle&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 ns&lt;/P&gt;&lt;P&gt;102 clock cycle&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="text-decoration: underline;"&gt;2.040 us&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hope this information will be useful for you.&lt;/P&gt;&lt;P&gt;Have a great day. :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;David Diaz.&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 21:16:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-K20D50M-clock-system/m-p/352697#M17504</guid>
      <dc:creator>david_diaz</dc:creator>
      <dc:date>2015-03-04T21:16:18Z</dc:date>
    </item>
  </channel>
</rss>

