<?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 Error in LPTMR SDK in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849272#M51091</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the SDK for MKW41Z512 and have found a probable error in the SDK related to the LPTMR. In fsl_lptmr.h there is a function for setting the compare register. For some reason (which does not make sense if the timer is free running) you are not allowed to set the compare to 0. The Reference Manual also states that:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;When the LPTMR is enabled and the CNR equals the value in the CMR and increments, TCF is set&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;hence the compare value needs to be -1 to what is wanted. This results in the following code in the SDK:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;static&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;inline&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;LPTMR_SetTimerPeriod&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;LPTMR_Type &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;base&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; uint32_t ticks&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;assert&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ticks &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; base&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;CMR &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ticks &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, if ticks = 1, assert is OK but 0 will be written to the register, which is not allowed (for normal behaviour)!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Reference Manual Rev. No. 3, there is a related error in the documentation. In Chapter 35.3.3 one can read:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;If the LPTMR is enabled, the CMR must be altered only when TCF is set.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;TCF is the&amp;nbsp;Timer Compare Flag and it does not make sense that you can only alter the compare if a compare match has already happened. I believe that it should be&amp;nbsp;TFC,&amp;nbsp;Timer Free-Running Counter, i.e. you can only alter the compare when the LPTMR is running and is free running, which make sense!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Sep 2018 12:16:51 GMT</pubDate>
    <dc:creator>samuelvestlin</dc:creator>
    <dc:date>2018-09-20T12:16:51Z</dc:date>
    <item>
      <title>Error in LPTMR SDK</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849272#M51091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the SDK for MKW41Z512 and have found a probable error in the SDK related to the LPTMR. In fsl_lptmr.h there is a function for setting the compare register. For some reason (which does not make sense if the timer is free running) you are not allowed to set the compare to 0. The Reference Manual also states that:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;When the LPTMR is enabled and the CNR equals the value in the CMR and increments, TCF is set&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;hence the compare value needs to be -1 to what is wanted. This results in the following code in the SDK:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;static&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;inline&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;LPTMR_SetTimerPeriod&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;LPTMR_Type &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;base&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; uint32_t ticks&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;assert&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ticks &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; base&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;CMR &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ticks &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, if ticks = 1, assert is OK but 0 will be written to the register, which is not allowed (for normal behaviour)!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Reference Manual Rev. No. 3, there is a related error in the documentation. In Chapter 35.3.3 one can read:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;If the LPTMR is enabled, the CMR must be altered only when TCF is set.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;TCF is the&amp;nbsp;Timer Compare Flag and it does not make sense that you can only alter the compare if a compare match has already happened. I believe that it should be&amp;nbsp;TFC,&amp;nbsp;Timer Free-Running Counter, i.e. you can only alter the compare when the LPTMR is running and is free running, which make sense!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2018 12:16:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849272#M51091</guid>
      <dc:creator>samuelvestlin</dc:creator>
      <dc:date>2018-09-20T12:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Error in LPTMR SDK</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849273#M51092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Samuel Vestlin&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using free running timer then there is no need to use the LPTMR_SetTimerPeriod API, CNR will be reset until it overflows and the interruption will be triggered when this happened&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&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>Mon, 24 Sep 2018 22:41:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849273#M51092</guid>
      <dc:creator>jorge_a_vazquez</dc:creator>
      <dc:date>2018-09-24T22:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Error in LPTMR SDK</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849274#M51093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jorge&lt;/P&gt;&lt;P&gt;I know that the free running timer will reset at 0 after overflow and continue to run, that's&amp;nbsp;why I use it in free running mode.&lt;/P&gt;&lt;P&gt;However, I need to set compare values, e.g. CMR = CNR +10, and if my wanted compare happens to be 1, the provided SDK function will fail (since 0 will be written to the CMR). Hence, I have implemented my own setter to solve this, but the SDK is still not correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error in the&amp;nbsp;Reference Manual is also annoying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2018 08:52:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849274#M51093</guid>
      <dc:creator>samuelvestlin</dc:creator>
      <dc:date>2018-09-26T08:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error in LPTMR SDK</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849275#M51094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we get a confirmation that the SDK is wrong there?&lt;/P&gt;&lt;P&gt;What about the datasheet saying TCF instead of TFC, is that correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2019 14:26:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Error-in-LPTMR-SDK/m-p/849275#M51094</guid>
      <dc:creator>gauthier_osterv</dc:creator>
      <dc:date>2019-12-18T14:26:03Z</dc:date>
    </item>
  </channel>
</rss>

