<?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: Kinetis K60 LPTMR module in interrupt mode in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-K60-LPTMR-module-in-interrupt-mode/m-p/638032#M38516</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;It my be an optimisaton issue - check that LPTMR_INTERRUPT is declared as a volatle variable.&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Sep 2016 21:36:50 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2016-09-21T21:36:50Z</dc:date>
    <item>
      <title>Kinetis K60 LPTMR module in interrupt mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-K60-LPTMR-module-in-interrupt-mode/m-p/638031#M38515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Hi,&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; border: 0px; font-weight: inherit; font-size: 14px;"&gt;I am using TWR-K60N512, with PK60DN512Z VMD10 chip and Codewarrior 10.5. There's a very good example baremetal project for this module, but the interrupt mode in this example doesn't work properly. I think it got stuck in the interrupt and keeps printing '&lt;SPAN style="color: #3d3d3d;"&gt;LPT ISR' every five seconds.The&amp;nbsp;code is shown below taken directly from the example. It does not ever go beyond the "while(LPTMR_INTERRUPT == 0)" line. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; color: #3d3d3d; font-weight: inherit; font-size: 14px;"&gt;Any idea how to troubleshoot this? To view the full example "lptmr project", you can find it in Codewarrior example for K60.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P&gt;void&amp;nbsp;lptmr_interrupt(void)&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;int compare_value=5000; //value must be less than 0xFFFF&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR_INTERRUPT=0; //Clear global variable&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;lptmr_clear_registers();&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;enable_irq(85); //LPTMR Vector is 101. IRQ# is 101-16=85&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR0_CMR=LPTMR_CMR_COMPARE(compare_value); //Set compare value&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR0_PSR=LPTMR_PSR_PCS(0x1)|LPTMR_PSR_PBYP_MASK;&amp;nbsp;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR0_CSR=LPTMR_CSR_TIE_MASK; //Enable LPT interrupt&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;in_char(); //wait for keyboard press&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR0_CSR|=LPTMR_CSR_TEN_MASK; //Turn on LPTMR and start counting&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;while(LPTMR_INTERRUPT == 0)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;******NEVER GOT&amp;nbsp;TO THIS LINE**********&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR0_CSR&amp;amp;=~LPTMR_CSR_TEN_MASK; //Turn off LPT to avoid more interrupts&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;lptmr_clear_registers();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void lptmr_isr(void)&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR0_CSR|=LPTMR_CSR_TCF_MASK; //Clear LPT Compare flag&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;LPTMR_INTERRUPT=1; //Set global variable&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;printf("\n\nIn LPT ISR!\n\n"); ************ THIS KEEPS PRINTING *********&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2016 18:26:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-K60-LPTMR-module-in-interrupt-mode/m-p/638031#M38515</guid>
      <dc:creator>broccolee</dc:creator>
      <dc:date>2016-09-21T18:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis K60 LPTMR module in interrupt mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-K60-LPTMR-module-in-interrupt-mode/m-p/638032#M38516</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;It my be an optimisaton issue - check that LPTMR_INTERRUPT is declared as a volatle variable.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2016 21:36:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-K60-LPTMR-module-in-interrupt-mode/m-p/638032#M38516</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2016-09-21T21:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Kinetis K60 LPTMR module in interrupt mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-K60-LPTMR-module-in-interrupt-mode/m-p/638033#M38517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark. That fixed the problem!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 03:06:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-K60-LPTMR-module-in-interrupt-mode/m-p/638033#M38517</guid>
      <dc:creator>broccolee</dc:creator>
      <dc:date>2016-09-22T03:06:44Z</dc:date>
    </item>
  </channel>
</rss>

