<?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 FTM changing FTMx_CxV within ISR in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506472#M31785</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On a K64 I'm using a timer channel as a software timeout. Normally events occur in "main line" and the values operate as expected.&lt;/P&gt;&lt;P&gt;When the time expires the ISR performs an operatian the updates the FTMx_CxV with a new value. On reading back the register the value &lt;SPAN style="text-decoration: underline;"&gt;appears&lt;/SPAN&gt; changed but the timer value does not operate.&lt;/P&gt;&lt;P&gt;I'm sure its a simple setup &amp;amp; control issue but on reading the doumentation I find no clear answer (that I understand).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggests?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doug&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 28 May 2016 23:17:15 GMT</pubDate>
    <dc:creator>dougprice</dc:creator>
    <dc:date>2016-05-28T23:17:15Z</dc:date>
    <item>
      <title>FTM changing FTMx_CxV within ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506472#M31785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On a K64 I'm using a timer channel as a software timeout. Normally events occur in "main line" and the values operate as expected.&lt;/P&gt;&lt;P&gt;When the time expires the ISR performs an operatian the updates the FTMx_CxV with a new value. On reading back the register the value &lt;SPAN style="text-decoration: underline;"&gt;appears&lt;/SPAN&gt; changed but the timer value does not operate.&lt;/P&gt;&lt;P&gt;I'm sure its a simple setup &amp;amp; control issue but on reading the doumentation I find no clear answer (that I understand).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggests?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doug&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 23:17:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506472#M31785</guid>
      <dc:creator>dougprice</dc:creator>
      <dc:date>2016-05-28T23:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: FTM changing FTMx_CxV within ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506473#M31786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Doug,&lt;/P&gt;&lt;P&gt;After had a brief look thorough the statement, I'm still a little confused with our question.&lt;/P&gt;&lt;P&gt;I was wondering if you can clarify the sentence "On reading back the register the value &lt;SPAN style="text-decoration: underline;"&gt;appears&lt;/SPAN&gt; changed but the timer value does not operate" and what "the timer value" stand for.&lt;/P&gt;&lt;P&gt;I'm looking forward to your reply.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&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, 30 May 2016 06:17:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506473#M31786</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-05-30T06:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: FTM changing FTMx_CxV within ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506474#M31787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ping&lt;/P&gt;&lt;P&gt;The process I've used (for years on HC, and Coldfire processors)&amp;nbsp; is to configure the main FTM counter in a simple rollover mode, in this case counting up. To set a channel for a timeout (in the future), the timeout interval (in timer ticks/counts) is added to the current value of FTM0_CNT value, that sum is written to FTM0_C0V as the new "timer value" (maybe I should have said time value).&lt;/P&gt;&lt;P&gt;If my expected operation happens, firmware again sets FTM0_C0V = FTM0_CNT + interval. And the cycle begins anew.&lt;/P&gt;&lt;P&gt;If the operation does not occur, the ISR triggers, but again it sets FTM0_C0V = FTM0_CNT + interval. This is the thing that does not work. &lt;SPAN style="text-decoration: underline;"&gt;In both cases the same function&lt;/SPAN&gt; is used to set the new interval.&lt;/P&gt;&lt;P&gt; While debugging this operation I dumped values out my diagnostic port, as part of that, after writing FTM0_C0V I read it back, it "appears" to be written in all cases but as I mentioned, it looks like it works when I do it in main line code but not when I do it from within the ISR.&lt;/P&gt;&lt;P&gt;My code snippet is below. The TimeOutEvent_Xxxx() functions are all unmodified PE driver functions, cliPrnXxxx() are my diagnostic prints.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentTicks&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = TimeOutEvent_GetCounterValue( NULL );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OffsetTicks&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = CurrentTicks + ( interval * TIMEOUT_1_MSEC_COUNT );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeOutEvent_SetOffsetTicks( NULL, channel, OffsetTicks );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cliPrnUInt32( CurrentTicks&amp;nbsp; );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cliPrnUInt32( OffsetTicks );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeOutEvent_GetOffsetTicks( NULL, TIMEOUT_CHANNEL_START_TX , &amp;amp;OffsetTicks);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cliPrnUInt32( OffsetTicks );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should be simple, I've likely done something really stupid, and I will be truly embarased once we figure it out. What I need is someone to ask the pointy questions to push me in teh correct direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doug&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 13:08:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506474#M31787</guid>
      <dc:creator>dougprice</dc:creator>
      <dc:date>2016-05-30T13:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: FTM changing FTMx_CxV within ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506475#M31788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As expected, something dumb.&lt;/P&gt;&lt;P&gt;I stumbled over a control variable because of the cyclical nature of the operation.&lt;/P&gt;&lt;P&gt;Once I re-read the manual for the n-th time and convinced myself it should work I just bached my head against it until the wall cracked. After that it was easy.&lt;/P&gt;&lt;P&gt;The timer works as expected.&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 00:03:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506475#M31788</guid>
      <dc:creator>dougprice</dc:creator>
      <dc:date>2016-06-01T00:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: FTM changing FTMx_CxV within ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506476#M31789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Doug,&lt;/P&gt;&lt;P&gt;I'm glad to hear that you had figured out the root cause of the issue.&lt;/P&gt;&lt;P&gt;If you have any further questions about it, please feel free to contact with me.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&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>Wed, 01 Jun 2016 02:11:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-changing-FTMx-CxV-within-ISR/m-p/506476#M31789</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-06-01T02:11:11Z</dc:date>
    </item>
  </channel>
</rss>

