<?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 Use FTM for both Quadrature Decoder and Input Capture in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM-for-both-Quadrature-Decoder-and-Input-Capture/m-p/793441#M48274</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using an FTM module on the K64F as a quadrature decoder to keep track of the position of an optical rotary encoder.&lt;STRONG&gt; I would also like to time-tag the edges of of the A/B quad channels us&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;ing&lt;/SPAN&gt;&amp;nbsp;FTM Input Capture, so that I can more precisely calculate rotation speed. Is this possible with a single FTM module, or will I need to physically connect the quadrature signals to two separate physical pins, each one monitored by a separate FTM module?&lt;/STRONG&gt; The first module would continue to act as the Quad Encoder (say FTM2), while the second module (say FTM3) would act as a free-running timer responsible for the periodic interrupt, and the input capture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, say I am measuring angular speed&amp;nbsp;&lt;SPAN style="font-family: symbol;"&gt;w&amp;nbsp;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;by running a periodic interrupt (with period dt, in seconds) in which I execute the code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;CODE&gt;current = FTM_GetQuadDecoderCounterValue(FTM2);&lt;BR /&gt; omega = (revCount + (current - previous))/(PPR*dt); // in revolutions per second&lt;BR /&gt; previous = current;&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;(where PPR is the number of pulses per revolution that the encoder provides, and revCount is incremented anytime that overflows). The above calculation assumes time &lt;CODE&gt;dt&lt;/CODE&gt; between the &lt;CODE&gt;current&lt;/CODE&gt; and &lt;CODE&gt;previous&lt;/CODE&gt;&amp;nbsp;edges, which need not be exactly true. That is, it neglects the time that has passed between the quad&amp;nbsp;decoder increment (i.e. edge received), and&amp;nbsp;the&amp;nbsp;&lt;SPAN&gt;&lt;CODE&gt;FTM_GetQuadDecoderCounterValue(FTM2)&lt;/CODE&gt; function call that happens in the above ISR.&amp;nbsp;&lt;/SPAN&gt;So what I really need is something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN&gt;&lt;CODE&gt;omega = (re&lt;SPAN&gt;v&lt;/SPAN&gt;&lt;SPAN&gt;Count + (&lt;/SPAN&gt;current - previous))/(PPR*(t_current - t_previous));&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN&gt;where &lt;CODE&gt;t_current&lt;/CODE&gt; and &lt;CODE&gt;t_previous&lt;/CODE&gt; are recorded using input capture of the quad channel pulses on FTM3.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Jun 2018 20:00:52 GMT</pubDate>
    <dc:creator>aberger</dc:creator>
    <dc:date>2018-06-18T20:00:52Z</dc:date>
    <item>
      <title>Use FTM for both Quadrature Decoder and Input Capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM-for-both-Quadrature-Decoder-and-Input-Capture/m-p/793441#M48274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using an FTM module on the K64F as a quadrature decoder to keep track of the position of an optical rotary encoder.&lt;STRONG&gt; I would also like to time-tag the edges of of the A/B quad channels us&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;ing&lt;/SPAN&gt;&amp;nbsp;FTM Input Capture, so that I can more precisely calculate rotation speed. Is this possible with a single FTM module, or will I need to physically connect the quadrature signals to two separate physical pins, each one monitored by a separate FTM module?&lt;/STRONG&gt; The first module would continue to act as the Quad Encoder (say FTM2), while the second module (say FTM3) would act as a free-running timer responsible for the periodic interrupt, and the input capture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, say I am measuring angular speed&amp;nbsp;&lt;SPAN style="font-family: symbol;"&gt;w&amp;nbsp;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;by running a periodic interrupt (with period dt, in seconds) in which I execute the code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;CODE&gt;current = FTM_GetQuadDecoderCounterValue(FTM2);&lt;BR /&gt; omega = (revCount + (current - previous))/(PPR*dt); // in revolutions per second&lt;BR /&gt; previous = current;&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;(where PPR is the number of pulses per revolution that the encoder provides, and revCount is incremented anytime that overflows). The above calculation assumes time &lt;CODE&gt;dt&lt;/CODE&gt; between the &lt;CODE&gt;current&lt;/CODE&gt; and &lt;CODE&gt;previous&lt;/CODE&gt;&amp;nbsp;edges, which need not be exactly true. That is, it neglects the time that has passed between the quad&amp;nbsp;decoder increment (i.e. edge received), and&amp;nbsp;the&amp;nbsp;&lt;SPAN&gt;&lt;CODE&gt;FTM_GetQuadDecoderCounterValue(FTM2)&lt;/CODE&gt; function call that happens in the above ISR.&amp;nbsp;&lt;/SPAN&gt;So what I really need is something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN&gt;&lt;CODE&gt;omega = (re&lt;SPAN&gt;v&lt;/SPAN&gt;&lt;SPAN&gt;Count + (&lt;/SPAN&gt;current - previous))/(PPR*(t_current - t_previous));&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN&gt;where &lt;CODE&gt;t_current&lt;/CODE&gt; and &lt;CODE&gt;t_previous&lt;/CODE&gt; are recorded using input capture of the quad channel pulses on FTM3.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2018 20:00:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM-for-both-Quadrature-Decoder-and-Input-Capture/m-p/793441#M48274</guid>
      <dc:creator>aberger</dc:creator>
      <dc:date>2018-06-18T20:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Use FTM for both Quadrature Decoder and Input Capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM-for-both-Quadrature-Decoder-and-Input-Capture/m-p/793442#M48275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;Andy Berger,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Quadrature Decoder mode has precedence over the other modes.&lt;BR /&gt;So you &lt;STRONG&gt;need to physically connect the quadrature signals to two separate physical pins, each one monitored by a separate FTM module&lt;/STRONG&gt;.&lt;span class="lia-inline-image-display-wrapper" image-alt="FTMx_QDCTRL[QUADEN].png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/62061iCC75382DBAEDC681/image-size/large?v=v2&amp;amp;px=999" role="button" title="FTMx_QDCTRL[QUADEN].png" alt="FTMx_QDCTRL[QUADEN].png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&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, 20 Jun 2018 08:06:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-FTM-for-both-Quadrature-Decoder-and-Input-Capture/m-p/793442#M48275</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2018-06-20T08:06:07Z</dc:date>
    </item>
  </channel>
</rss>

