<?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: Use FTM0 / 1 with a one-shot timer. in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926369#M53913</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jun,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thanks for your updated information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Yes, you are right!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; MKE04 FTM0/1 doesn't have the CNTIN register, but I have tested the FTM0 overflow function, after the counter overflow happens, the CNT will be reset, please check my test result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/86244i14FBFA131A42F75A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I enable the FTM0 timer overflow interrupt, when the overflow happens, the CNT is cleared.&lt;/P&gt;&lt;P&gt;I don't know how you test it, I think you also can enable the overflow interrupt, then debug the code, and add the break point in the interrupt, when you enter the interrupt, you can check the CNT data.&lt;/P&gt;&lt;P&gt;I am using the KDS PE to create the FTM0 code for KE04, I also attach the code for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still have questions about it, please kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Sep 2019 03:09:41 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2019-09-17T03:09:41Z</dc:date>
    <item>
      <title>Use FTM0 / 1 with a one-shot timer.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926366#M53910</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;BR /&gt;I want to use the one-shot timer, but the CNT register does not seem to be reset even if the timer overflows.&lt;BR /&gt;So, remodeling to make CNT = 0 at &lt;SPAN&gt;FTM_StartTimer&amp;nbsp;()&lt;/SPAN&gt;, is there a problem?&lt;/P&gt;&lt;P&gt;Used for MODBUS silent interval timer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify fsl_ftm.c (SDK_2.6.0_MKE04Z128xxx4)&lt;BR /&gt;static inline void FTM_StartTimer (FTM_Type * base, ftm_clock_source_t clockSource)&lt;BR /&gt;{&lt;BR /&gt;&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;uint32_t reg = base-&amp;gt; SC;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;if (base&amp;nbsp; ! = FTM2) {&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;base-&amp;gt; CNT = 0u;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// 2019/09/14 add jun.&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;}&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;reg &amp;amp; = ~ (FTM_SC_CLKS_MASK);&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;reg | = FTM_SC_CLKS (clockSource);&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;base-&amp;gt; SC = reg;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my application source is&lt;/P&gt;&lt;P&gt;// ================================================ =======&lt;BR /&gt;// &lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;T3.5 character timer-timer start&lt;BR /&gt;// ================================================ =======&lt;BR /&gt;static inline void modbusT15Start (void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FTM_StopTimer (MODBUS_TMR_T15);&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FTM_StartTimer (MODBUS_TMR_T15, kFTM_SystemClock); // reset timer &amp;amp; start&lt;BR /&gt;}&lt;BR /&gt;// ================================================ =======&lt;BR /&gt;// &lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;3.5 character timer-interrupt handler&lt;BR /&gt;// ================================================ =======&lt;BR /&gt;void MODBUS_TMR_T35_IRQ_HANDLER (void)&lt;BR /&gt;{&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;/ * Clear interrupt flag. * /&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;FTM_ClearStatusFlags (MODBUS_TMR_T35, kFTM_TimeOverflowFlag);&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;FTM_StopTimer (MODBUS_TMR_T35);&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;modbusMatrix (E_MB_EV_T35_EXPIRED, 0);&lt;BR /&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;jun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Sep 2019 08:11:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926366#M53910</guid>
      <dc:creator>jun1</dc:creator>
      <dc:date>2019-09-14T08:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Use FTM0 / 1 with a one-shot timer.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926367#M53911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-content-finding="Community" data-userid="325820" data-username="jun@cew.co.jp" href="https://community.nxp.com/people/jun@cew.co.jp"&gt;jun yamada&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1. Please check your counter mode: up counter, or up-down counting?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 2. Check your CNTIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want the counter is reset to 0 after it is overflow, you need to set CNTIN = 0x0000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;If you still have questions about it, please kindly let me know.&lt;/P&gt;&lt;P&gt;Kerry&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2019 02:06:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926367#M53911</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-09-16T02:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Use FTM0 / 1 with a one-shot timer.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926368#M53912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you for your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isn't ke04 not having CNTIN register?&lt;/P&gt;&lt;P&gt;I saw the reference manual.&lt;/P&gt;&lt;P&gt;KE04 Sub-Family Reference Manual&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table3-34. FTM modules features&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2019 21:13:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926368#M53912</guid>
      <dc:creator>jun1</dc:creator>
      <dc:date>2019-09-16T21:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use FTM0 / 1 with a one-shot timer.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926369#M53913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jun,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thanks for your updated information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Yes, you are right!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; MKE04 FTM0/1 doesn't have the CNTIN register, but I have tested the FTM0 overflow function, after the counter overflow happens, the CNT will be reset, please check my test result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/86244i14FBFA131A42F75A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I enable the FTM0 timer overflow interrupt, when the overflow happens, the CNT is cleared.&lt;/P&gt;&lt;P&gt;I don't know how you test it, I think you also can enable the overflow interrupt, then debug the code, and add the break point in the interrupt, when you enter the interrupt, you can check the CNT data.&lt;/P&gt;&lt;P&gt;I am using the KDS PE to create the FTM0 code for KE04, I also attach the code for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still have questions about it, please kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Sep 2019 03:09:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926369#M53913</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-09-17T03:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Use FTM0 / 1 with a one-shot timer.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926370#M53914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;I checked with the test code.&lt;BR /&gt;I set 10500 to MOD. --- moddata&lt;BR /&gt;When an interrupt is generated, CNT of FTM1 becomes 0. --- cntdata [0]&lt;BR /&gt;If the timer is not stopped, the count continues. --- cntdata [1]&lt;BR /&gt;After the timer stops, CNT remains unchanged. --- cntdata [2] / [3]&lt;BR /&gt;Looking at the value of CNT after the timer starts, it seems that it starts counting from the previous value. --- cntdata [4] / [5]&lt;BR /&gt;So, the question is, is there a way to set CNT = 0 when the timer starts?&lt;BR /&gt;My idea is to write 0 directly to the CNT at the start of the timer.&lt;BR /&gt;Please let us know if there is a more appropriate method.&lt;/P&gt;&lt;P&gt;From there, it is natural, but if the timer does not stop, it continues counting.&lt;/P&gt;&lt;P&gt;Thank you.&lt;BR /&gt;jun&lt;span class="lia-inline-image-display-wrapper" image-alt="FTM1.GIF"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/91104i458533B3A8DD017D/image-size/large?v=v2&amp;amp;px=999" role="button" title="FTM1.GIF" alt="FTM1.GIF" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Sep 2019 00:34:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926370#M53914</guid>
      <dc:creator>jun1</dc:creator>
      <dc:date>2019-09-18T00:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Use FTM0 / 1 with a one-shot timer.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926371#M53915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class=""&gt;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="325820" data-username="jun@cew.co.jp" href="https://community.nxp.com/people/jun@cew.co.jp"&gt;jun yamada&lt;/A&gt;&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Your test result is correct, please know one key point: The counter will be cleared when the counter is overflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp; That's why your cntdata[0] is nearly 0. After the overflow happens, the counter will counter again, that's why your other cntdata also has the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; If you want to clear the counter, you can set CNT = 0&amp;nbsp; directly.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Reset clears the CNT register. Writing any value to COUNT updates the counter with its initial value, CNTIN. If it is FTM0/1, it should be updated to 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp; But please note, even you write CNT=0, the counter will go on counting, if you want the counter stop, you can just disable the FTM&amp;nbsp; clock.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-----------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Sep 2019 02:52:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926371#M53915</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-09-18T02:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use FTM0 / 1 with a one-shot timer.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926372#M53916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply.&lt;BR /&gt;I understood it well.&lt;BR /&gt;It ’s really helpful because you can reply quickly.&lt;BR /&gt;I look forward to working with you.&lt;BR /&gt;jun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Sep 2019 03:26:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM0-1-with-a-one-shot-timer/m-p/926372#M53916</guid>
      <dc:creator>jun1</dc:creator>
      <dc:date>2019-09-18T03:26:38Z</dc:date>
    </item>
  </channel>
</rss>

