<?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>Kinetis MicrocontrollersのトピックRe: FTM2 MK64  dual edge input capture glitch</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM2-MK64-dual-edge-input-capture-glitch/m-p/1779891#M65834</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Because you use only the rising edge as a capture signal, I suggest you use single edge capture mode(normal input capture mode) mode and the code will become simple.&lt;/P&gt;
&lt;P&gt;void FTM_INPUT_CAPTURE_HANDLER(void)&lt;BR /&gt;{&lt;BR /&gt;if ((FTM_GetStatusFlags(DEMO_FTM_BASEADDR) &amp;amp; kFTM_TimeOverflowFlag) == kFTM_TimeOverflowFlag)&lt;BR /&gt;{&lt;BR /&gt;/* Clear overflow interrupt flag.*/&lt;BR /&gt;FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, kFTM_TimeOverflowFlag);&lt;BR /&gt;g_timerOverflowInterruptCount++;&lt;BR /&gt;}&lt;BR /&gt;else if (((FTM_GetStatusFlags(DEMO_FTM_BASEADDR) &amp;amp; FTM_FIRST_CHANNEL_FLAG) == FTM_FIRST_CHANNEL_FLAG))&lt;BR /&gt;{&lt;BR /&gt;/* Disable first channel interrupt.*/&lt;BR /&gt;FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, FTM_FIRST_CHANNEL_FLAG);&lt;BR /&gt;capture1Val = FTM_GetInputCaptureValue(DEMO_FTM_BASEADDR, (ftm_chnl_t)(BOARD_FTM_INPUT_CAPTURE_CHANNEL));&lt;BR /&gt;period=g_timerOverflowInterruptCount*(FTM_MOD&amp;amp;0xFFFF)+capture1Val-capture1Val_Prev;&lt;BR /&gt;capture1Val_Prev=capture1Val;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;If you do want to use dual-capture mode, I suggest you disable the first channel interrupt, in this mode, only the second edge generate interrupt.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Dec 2023 06:57:11 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2023-12-26T06:57:11Z</dc:date>
    <item>
      <title>FTM2 MK64  dual edge input capture glitch</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM2-MK64-dual-edge-input-capture-glitch/m-p/1779475#M65832</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using FTM2 in dual edge input capture mode.&lt;/P&gt;&lt;P&gt;FTM2 running on 187500Hz frequency clock.&lt;/P&gt;&lt;P&gt;The PPM signal i am trying to capture is attached.&lt;/P&gt;&lt;P&gt;I am getting some negative numbers sporadically, more frequent when running higher FTM2 clock frequency. But it has a pattern, in the middle of the "overflow" value (65535/2 = 32768) when running 187500Hz FTM clock.&lt;/P&gt;&lt;P&gt;I suspect it is related to an overflow interrupt(s) is/are skipped, have debugged in two days without figuring out the cause of this glitch.&lt;/P&gt;&lt;P&gt;The source code is based on SDK example&amp;nbsp;frdmk64f_ftm_dual_edge_capture with modifications, and is attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate the help and the time consumed to answer this thread!&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-12-25 005644.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/255734iF18E547584064D1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-12-25 005644.png" alt="Screenshot 2023-12-25 005644.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Dec 2023 00:15:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM2-MK64-dual-edge-input-capture-glitch/m-p/1779475#M65832</guid>
      <dc:creator>RawiUA</dc:creator>
      <dc:date>2023-12-25T00:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: FTM2 MK64  dual edge input capture glitch</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM2-MK64-dual-edge-input-capture-glitch/m-p/1779891#M65834</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Because you use only the rising edge as a capture signal, I suggest you use single edge capture mode(normal input capture mode) mode and the code will become simple.&lt;/P&gt;
&lt;P&gt;void FTM_INPUT_CAPTURE_HANDLER(void)&lt;BR /&gt;{&lt;BR /&gt;if ((FTM_GetStatusFlags(DEMO_FTM_BASEADDR) &amp;amp; kFTM_TimeOverflowFlag) == kFTM_TimeOverflowFlag)&lt;BR /&gt;{&lt;BR /&gt;/* Clear overflow interrupt flag.*/&lt;BR /&gt;FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, kFTM_TimeOverflowFlag);&lt;BR /&gt;g_timerOverflowInterruptCount++;&lt;BR /&gt;}&lt;BR /&gt;else if (((FTM_GetStatusFlags(DEMO_FTM_BASEADDR) &amp;amp; FTM_FIRST_CHANNEL_FLAG) == FTM_FIRST_CHANNEL_FLAG))&lt;BR /&gt;{&lt;BR /&gt;/* Disable first channel interrupt.*/&lt;BR /&gt;FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, FTM_FIRST_CHANNEL_FLAG);&lt;BR /&gt;capture1Val = FTM_GetInputCaptureValue(DEMO_FTM_BASEADDR, (ftm_chnl_t)(BOARD_FTM_INPUT_CAPTURE_CHANNEL));&lt;BR /&gt;period=g_timerOverflowInterruptCount*(FTM_MOD&amp;amp;0xFFFF)+capture1Val-capture1Val_Prev;&lt;BR /&gt;capture1Val_Prev=capture1Val;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;If you do want to use dual-capture mode, I suggest you disable the first channel interrupt, in this mode, only the second edge generate interrupt.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 06:57:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTM2-MK64-dual-edge-input-capture-glitch/m-p/1779891#M65834</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2023-12-26T06:57:11Z</dc:date>
    </item>
  </channel>
</rss>

