<?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 FRDM KL25 Delay_mS() in interrupt in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456221#M27196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I call Delay_mS() function in main(), its going fine:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14490026979659143" data-renderedposition="71_8_1155_64" jivemacro_uid="_14490026979659143"&gt;&lt;P&gt;void maind(){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Delay_mS(100);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I doing this same in interupt, the Delay_mS() function doesnt comes back it takes infinity time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14490030517776268 jive_text_macro" data-renderedposition="198_8_1155_144" jivemacro_uid="_14490030517776268"&gt;&lt;P&gt;void maind(){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable_irq(INT_TPM0 - 16);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void handle_interrupt(){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Delay_mS(100);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //This function takes infinity time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is on FRDM-KL25Z board.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Dec 2015 20:51:39 GMT</pubDate>
    <dc:creator>mqxman</dc:creator>
    <dc:date>2015-12-01T20:51:39Z</dc:date>
    <item>
      <title>FRDM KL25 Delay_mS() in interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456221#M27196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I call Delay_mS() function in main(), its going fine:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14490026979659143" data-renderedposition="71_8_1155_64" jivemacro_uid="_14490026979659143"&gt;&lt;P&gt;void maind(){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Delay_mS(100);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I doing this same in interupt, the Delay_mS() function doesnt comes back it takes infinity time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14490030517776268 jive_text_macro" data-renderedposition="198_8_1155_144" jivemacro_uid="_14490030517776268"&gt;&lt;P&gt;void maind(){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable_irq(INT_TPM0 - 16);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void handle_interrupt(){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Delay_mS(100);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //This function takes infinity time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is on FRDM-KL25Z board.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 20:51:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456221#M27196</guid>
      <dc:creator>mqxman</dc:creator>
      <dc:date>2015-12-01T20:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM KL25 Delay_mS() in interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456222#M27197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No way to give a good answer without know how delay is written.&amp;nbsp; If it is using an interrupt itself the result you see makes sense. Doing delays in interrupts is never a good idea and should be avoided at all costs. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Dec 2015 12:58:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456222#M27197</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2015-12-02T12:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM KL25 Delay_mS() in interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456223#M27198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the answer. Yes the delay is using interrupts, the function is definied in ARM_SysTick.c (attached file). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.Previously I used FRDM - K20, on this processor I run this same code, and there is running fine. Is it a difference with interrupt handling on these two processors KL25Z (M0+) and K20 (M4)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. I developing quadcopter control software, I have two interrupts: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The first is for PID control, motor power controlling, etc... this is should go on 400 Hz. - pid_interrupt()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The second is going in lower speed 50 Hz, its for logging data (speed, altitude, motor powers, etc) to SDcard. - log_interrupt()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; On K20 when log_interrupt is executed and and there is interrupt request for pid_interrupt(), the program from the log_interrupt() immediately jumps to the pid_interrupt() function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; But on KL25Z first all lines in log_interrupt() is handled and only after this the program jumps to the pid_interrupt. Why? Is it any way to solve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The pid_interrupt() has higher priority than log_interrupt().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Dec 2015 08:48:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456223#M27198</guid>
      <dc:creator>mqxman</dc:creator>
      <dc:date>2015-12-03T08:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM KL25 Delay_mS() in interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456224#M27199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Norbert&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The interrupt controller in the K20 has 16 levels of interrupt priority (0..15). The one in the KL25 has 4 levels of priority (0..3)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore if you were using, for example, levels 6 and 7 to allow the interrupt with level 6 priority to interrupt the level 7 priority one before and keep these values they are now equal (both equate to level 1 on the KL25) and so the pre-emption will no longer take place.&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;&lt;SPAN&gt;Kinetis: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis.html" rel="nofollow"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;KL25: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis/FRDM-KL25Z.html" rel="nofollow"&gt;http://www.utasker.com/kinetis/FRDM-KL25Z.html&lt;/A&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis/TWR-KL25Z48M.html" rel="nofollow"&gt;http://www.utasker.com/kinetis/TWR-KL25Z48M.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;K20: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis/TWR-K20D72M.html" rel="nofollow"&gt;http://www.utasker.com/kinetis/TWR-K20D72M.html&lt;/A&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis/FRDM-K20D50M.html" rel="nofollow"&gt;http://www.utasker.com/kinetis/FRDM-K20D50M.html&lt;/A&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis/TWR-K20D50M.html" rel="nofollow"&gt;http://www.utasker.com/kinetis/TWR-K20D50M.html&lt;/A&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis/TEENSY_3.1.html" rel="nofollow"&gt;http://www.utasker.com/kinetis/TEENSY_3.1.html&lt;/A&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.utasker.com/kinetis/tinyK20.html" rel="nofollow"&gt;http://www.utasker.com/kinetis/tinyK20.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Dec 2015 10:32:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FRDM-KL25-Delay-mS-in-interrupt/m-p/456224#M27199</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-12-03T10:32:55Z</dc:date>
    </item>
  </channel>
</rss>

