<?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: FTM Channel Flag: Set only when interrupts are enabled? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805043#M48944</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want the channel match interrupt, you need to enable CHIE, because this will also caused the interrupt event when the interrupt happens.&lt;/P&gt;&lt;P&gt;&amp;nbsp; In the ISR you can write:&lt;/P&gt;&lt;P&gt;void FTM_ISR(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; if(TOF)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //clear TOF, and do the overflow things&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(CHF)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear CHF, and do the channel match things.&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you don't want to enable CHF, I think you even don't need to check it directly in the interrupt, because the interrupt won't caused by the CHF, you can check it directly in the main while.&lt;/P&gt;&lt;P&gt;From your description, you said you need to check both the overflow event&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt; a channel event, I highly suggest you also enable the CHIE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&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: 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>Thu, 23 Aug 2018 03:30:31 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2018-08-23T03:30:31Z</dc:date>
    <item>
      <title>FTM Channel Flag: Set only when interrupts are enabled?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805038#M48939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using an ISR to handle&amp;nbsp;&lt;EM&gt;both&lt;/EM&gt; timer overflow events &lt;EM&gt;and&lt;/EM&gt; rising edge captures for an FTM module. Therefore, inside the ISR, I need to check the FTM flags to identify the source of the interrupt. That is, the first thing I do inside the ISR is:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;bool overflow = (FTM_GetStatusFlags(FTM0) &amp;amp; kFTM_TimeOverflowFlag) == kFTM_TimeOverflowFlag;&lt;BR /&gt; bool caughtEdge = (FTM_GetStatusFlags(FTM0) &amp;amp; kFTM_Chnl0Flag) == kFTM_Chnl0Flag;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;My question: is the channel flag set even when interrupts for that channel are disabled? In other words, in instances when I only have the overflow interrupt enabled, will the channel flag still be set if an edge is detected on that channel? If so, this means that the ISR will be handling&amp;nbsp;&lt;EM&gt;both&lt;/EM&gt; overflows and channel edge detects, even though I have the edge detect interrupts disabled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2018 19:20:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805038#M48939</guid>
      <dc:creator>aberger</dc:creator>
      <dc:date>2018-08-20T19:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Channel Flag: Set only when interrupts are enabled?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805039#M48940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; If you enable the CHIE in the FTMX_CnSC, it will allow the channel interrupt.&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you enable the TOIE in FTMx_SC, it will allow the FTM overflow interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Otherwise, if you just enable FTMx_SC[TOIE], and didn't enable the CHIE, your CHF, channel interrupt flag won't set.&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&amp;nbsp; Next time, when you post the question, please also tell us what the chip part number you are using, it will be useful to our question checking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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: 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>Tue, 21 Aug 2018 09:26:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805039#M48940</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2018-08-21T09:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Channel Flag: Set only when interrupts are enabled?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805040#M48941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kerry,&lt;/P&gt;&lt;P&gt;Thanks for the reply. I am using a K64.&lt;/P&gt;&lt;P&gt;What you've described is not consistent with my experience. I do not have the CHIE enabled, and yet the CHF interrupt flag is being set by a rising edge on the channel pin. Why would that be?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2018 16:05:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805040#M48941</guid>
      <dc:creator>aberger</dc:creator>
      <dc:date>2018-08-21T16:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Channel Flag: Set only when interrupts are enabled?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805041#M48942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you don't enable the CHIE, your interrupt is not caused by the Channel match interrupt, this interrupt should caused by the FTM counter overflow. CHF will be set when an event occurs on the channel, even you don't enable the interrupt, this bit also can be set. When you enter the interrupt, you also can check TOF, whether it is set or not?&lt;/P&gt;&lt;P&gt;&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: 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, 22 Aug 2018 09:21:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805041#M48942</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2018-08-22T09:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Channel Flag: Set only when interrupts are enabled?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805042#M48943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I am also checking the TOF, as you can see from the first line of code in my original question. However, there are instances in which the interrupt service routine needs to handle&amp;nbsp;&lt;EM&gt;both&lt;/EM&gt; an overflow event&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt; a channel event, so it's not necessarily true that if an overflow occurred, a channel event did not. I need to check both flags.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, there are other instances when I don't care about the channel events. So it seems&amp;nbsp;that when checking for channel events in the ISR, I need to check both:&lt;/P&gt;&lt;P&gt;1. is the CHF set?&lt;/P&gt;&lt;P&gt;2. is CHIE enabled?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2018 19:25:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805042#M48943</guid>
      <dc:creator>aberger</dc:creator>
      <dc:date>2018-08-22T19:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: FTM Channel Flag: Set only when interrupts are enabled?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805043#M48944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want the channel match interrupt, you need to enable CHIE, because this will also caused the interrupt event when the interrupt happens.&lt;/P&gt;&lt;P&gt;&amp;nbsp; In the ISR you can write:&lt;/P&gt;&lt;P&gt;void FTM_ISR(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; if(TOF)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //clear TOF, and do the overflow things&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(CHF)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear CHF, and do the channel match things.&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you don't want to enable CHF, I think you even don't need to check it directly in the interrupt, because the interrupt won't caused by the CHF, you can check it directly in the main while.&lt;/P&gt;&lt;P&gt;From your description, you said you need to check both the overflow event&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt; a channel event, I highly suggest you also enable the CHIE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&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: 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>Thu, 23 Aug 2018 03:30:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM-Channel-Flag-Set-only-when-interrupts-are-enabled/m-p/805043#M48944</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2018-08-23T03:30:31Z</dc:date>
    </item>
  </channel>
</rss>

