<?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: LPTMR does not count. in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783889#M47724</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. Something new to me.&amp;nbsp; I used to simply read the counter register.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Jun 2018 15:16:52 GMT</pubDate>
    <dc:creator>john71</dc:creator>
    <dc:date>2018-06-17T15:16:52Z</dc:date>
    <item>
      <title>LPTMR does not count.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783886#M47721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I set the LPTMR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;SIM_SCGC5 |= SIM_SCGC5_LPTIMER_MASK;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Reset LPTMR settings */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR0_CSR=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set up LPTMR to use 1kHz LPO with no prescaler as its clock source */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR0_PSR = LPTMR_PSR_PCS(1) | LPTMR_PSR_PBYP_MASK;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set the compare value to the number of ms to delay */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR0_CMR = 0xFFFF;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR0_CSR |= LPTMR_CSR_TCF_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TFC_MASK;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Start the timer */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR0_CSR |= LPTMR_CSR_TEN_MASK; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable_irq(85);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;And I check&lt;/P&gt;&lt;P&gt;time = LPTMR0_CNR;&lt;/P&gt;&lt;P&gt;It's always 0. When I set break point and watch the registers - LPTMR0_CNR = 0x0000.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 08:44:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783886#M47721</guid>
      <dc:creator>john71</dc:creator>
      <dc:date>2018-06-14T08:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: LPTMR does not count.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783887#M47722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Evgeny&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long ulCnt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR0_CNR = 0;&amp;nbsp; // &lt;SPAN style="text-decoration: underline;"&gt;write any value to the counter register so that it puts its present counter value into a temporary register&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ulCnt = LPTMR0_CNR;&amp;nbsp; // read the value from the temporary register&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you read the register description in the manual you will see why. If you check the uTasker open source project you will probably already get all answers too.&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;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM style="color: #0000ff;"&gt;uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="color: #0000ff;"&gt;&lt;SPAN&gt;Kinetis: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 18:24:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783887#M47722</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-06-14T18:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: LPTMR does not count.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783888#M47723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark is correct, On each read of the CNR, software must first write to the CNR with any value.&lt;/P&gt;&lt;P&gt;You can find the description in "42.4.5 LPTMR counter" of &lt;A href="https://www.nxp.com/docs/en/reference-manual/K10P144M120SF3RM.pdf"&gt;K10P144M120SF3RM&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="LPTMR counter.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/28450i81179B13B7E3719B/image-size/large?v=v2&amp;amp;px=999" role="button" title="LPTMR counter.png" alt="LPTMR counter.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also notice that you have enable the Timer Free-Running Counter.&lt;/P&gt;&lt;P&gt;When 1kHz LPO is select as clock source. You may need to wait 65536ms , then run into LPTMR interrupt.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="LPTMRx_CSR[TFC].png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/35941iAB459CDA011968ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="LPTMRx_CSR[TFC].png" alt="LPTMRx_CSR[TFC].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;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 06:58:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783888#M47723</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2018-06-15T06:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: LPTMR does not count.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783889#M47724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. Something new to me.&amp;nbsp; I used to simply read the counter register.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Jun 2018 15:16:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTMR-does-not-count/m-p/783889#M47724</guid>
      <dc:creator>john71</dc:creator>
      <dc:date>2018-06-17T15:16:52Z</dc:date>
    </item>
  </channel>
</rss>

