<?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: QEI inputs, and index capture in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284273#M10808</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Earl, thanks for sharing your QEI file with us.&amp;nbsp; I'm glad I found it, as I am having a lot of trouble getting QD working on my FRDM-K64F using FTM2 configured to read a QE on PTB18 and PTB19.&amp;nbsp; I am comparing your code to mine, and was hoping that you could answer some questions I have come up with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You set the DECAPEN0 flag just before enabling the FTM.&amp;nbsp; The docs say that this field is write-protected, so MODE[WPDIS] has to be 1 for it to take effect.&amp;nbsp; Is there a reason why you didn't put FTM2_MODE = FTM_MODE_FTMEN_MASK | FTM_MODE_WPDIS_MASK before FTM2_COMBINE = FTM_COMBINE_DECAPEN0_MASK?&lt;/LI&gt;&lt;LI&gt;Is it necessary to set FTMx_CnV?&amp;nbsp; Your comment says "clear these while we can", which sounds important, but the docs say that in input capture or dual edge capture modes, these registers are ignored.&lt;/LI&gt;&lt;LI&gt;For "quick and dirty" testing, I just have a task that performs all of my register initializations, and then sits in a while loop and monitors FTM2_CNT and should hit a breakpoint any time the count changes.&amp;nbsp; However, it never changes.&amp;nbsp; At some point I will add the ISR to deal with counter rollover, but is it necessary to implement this now when I just want to see the FTM2_CNT register change as I spin the encoder?&lt;/LI&gt;&lt;LI&gt;I think the main problem I'm having is that I can't set FTM2_MOD.&amp;nbsp; It's always zero.&amp;nbsp; I've also tried to follow FSL's flowchart for modifying that value, but even when I set up the other registers as indicated, when I write FTM2_MOD it's still 0.&amp;nbsp; Would you agree that anytime FTM2_MOD is 0, FTM2_CNT will be stuck at 0 as well?&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Mar 2015 16:33:07 GMT</pubDate>
    <dc:creator>dave408</dc:creator>
    <dc:date>2015-03-30T16:33:07Z</dc:date>
    <item>
      <title>QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284267#M10802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am studying the quadrature mode of the Kinetis K family, more specifically the K10, and specs for these have the general statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quadrature decoder with input filters, relative position counting, and interrupt on&lt;/P&gt;&lt;P&gt;position count or capture of position count on external event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is the 'capture of position count on external event', or more particularly the connection of an encoder Index pulse.&amp;nbsp; These quadrature functions are available on 2-channel FTM instantiations, and the A/B inputs 'take over' the two associated channel I/O connections for that module, and later in the FTM description of Quadrature Decoder Mode is the statement "no channel logic is used in Quadrature Decoder mode."&amp;nbsp; So I don't know where this 'capture of position count on external event' functionality IS.&amp;nbsp; One 'grand hope' I have is that the FTM Hardware Trigger(s) discussed in the FTM instantiaion information can be forwarded to the channel capture logic and re-enable use of one channel's capture function.&amp;nbsp; Has anybody made a full A/B/X encoder interface work with these quadrature capabilities?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 21:59:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284267#M10802</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2013-03-05T21:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284268#M10803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp; Hello Earl,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just working with A and B inputs of quadrature encoder with "my" Kinetis K60 board (we have a project board with K60 where I connect the inputs to check the functionality of inputs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can refer to the Application Note 4381:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://cache.freescale.com/files/32bit/doc/app_note/AN4381.pdf?fpsp=1&amp;amp;WT_TYPE=Application"&gt;http://cache.freescale.com/files/32bit/doc/app_note/AN4381.pdf?fpsp=1&amp;amp;WT_TYPE=Application&lt;/A&gt;&lt;SPAN&gt; Notes&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=pdf&amp;amp;WT_ASSET=Documentation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and, if you use the Processor Expert in your exampe project, you can use only the Init_FTM component to initialize it and after you can work directly with&amp;nbsp; Registers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-) FTM1_CNT is the counter register;&lt;/P&gt;&lt;P&gt;-) FTM1_QDCTRL to set some charateristcs of encoder (in my example I use the command&lt;/P&gt;&lt;P&gt;FTM1_QDCTRL ^= FTM_QDCTRL_PHAPOL_MASK; &lt;/P&gt;&lt;P&gt;to change "rotation" of encoder, it reverse the channel A logic)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need example project to test it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 16:55:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284268#M10803</guid>
      <dc:creator>p_vagnoni</dc:creator>
      <dc:date>2013-03-07T16:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284269#M10804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for this input. I see where you work with A/B, and I also see the same in AN4381 -- that AN specifically says that the index-pulse will be handled as an edge interrupt.&amp;nbsp; But this fails to resolve the Kinetis-documentation statement &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;'capture of position count on external event',&lt;/SPAN&gt; and invites inherent index-count-resolution error due to various interrupt delays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I'm still looking for somebody, presumably at Freescale, to explain the claimed FTM quadrature capability &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;'capture of position count on external event'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--ERGII&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 17:15:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284269#M10804</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2013-03-07T17:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284270#M10805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;By experimentation, that control bit does indeed seem to work!&amp;nbsp; Not my 'favorite' way to prove chip functions, but in a pinch it will do...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;This is CONTRARY to the AN4381 statement:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"The processing of the index signal together with the phase signals can only be&amp;nbsp; done in an FTM with three or more channels."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;That is, with the SOPT4 register contents set to use the CMP1 ‘output’ as the channel-0 input capture control (for the 2-channel FMT2 in this example):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Hook FTM2 CH0 capture to run from this CMP1 comparator output!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIM_SOPT4 |= SIM_SOPT4_FTM2CH0SRC(2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt; I do INDEED get a capture value at the index edge!&amp;nbsp; Now of course that still leaves one fundamental issue with this process – knowing ‘which direction’ we were going at the time!&amp;nbsp; That is, for any ‘width’ of Index pulse more than ¼ of the quadrature-period, then the ‘rising’ (or falling) edge we encounter will be the ‘leading’ (or trailing) edge of the pulse, so the encoder counts will inherently differ by the number of PHA/B edges that occur during the width of the index pulse.&amp;nbsp; There is a status bit that tells me the ‘last direction’ the counter was going when I read it, but any value of that assumes that the direction at the time I can get to read it is the same as the direction at the time of the Index-driven capture, which is ‘less than ideal’ in cases of shaft jitter, but I think this is going to work out ‘pretty well’.&amp;nbsp; My next test is to try the 'dual edge capture' capabilities to give me both edges to work with, and that should help the counter-consistency decisions!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;As an example, here is some output from my test:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;Overflow UP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- output when overall counter goes from 0xFFFF back up thru 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;0031F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- output from comparator-interrupt routine &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0031F UP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- output from FTM channel-zero input capture, also printing that ‘last direction’ as UP&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;00321&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- output from comparator-interrupt routine, going the other direction&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00321 DN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- output from FTM channel-zero capture, going ‘down’ this time so the ‘leading edge’ comes 2 counts earlier!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;0031F&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0031F UP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Back in the ‘up’ direction&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;0063F &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #1f497d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0063F UP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- One ‘whole turn’ later!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;&lt;SPAN style="font-size: 8pt; font-family: arial,helvetica,sans-serif;"&gt;Incidentally, this is a 200-slot encoder disk, so 800 (0x320) quad-edge counts per revolution.&amp;nbsp; The above test was started right at the index pulse.&amp;nbsp; At this ‘speed’ (a CRAWL) the comparator and capture interrupts agree on the encoder count.&amp;nbsp; Certainly at higher speeds, and with some interrupt latency, this will NOT remain true.&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Earl Goodrich II&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 19:12:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284270#M10805</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2013-03-25T19:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284271#M10806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Indeed, dual-edge DOES work, although I had some 'difficult' troubles with the consistency-control logic.&amp;nbsp; I put rising (leading) edge on C0, falling (trailing) on C1 (still both fed thru the SOPT4 option from CMP1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now I wait for the 'falling edge' detect on FTM2 channel 1, and at that time evaluate both channel 0 and 1 values for the 'least' to indicate a consistent 'edge point' for the index relative to PHA/B count values!&amp;nbsp; This is my 'test' output:&lt;/P&gt;&lt;P&gt;08034 rise&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Compare interrupt on rising (leading) edge&lt;/P&gt;&lt;P&gt;08036 fall&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Compare interrupt 'fall' (trailing)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8034 8036&amp;nbsp; UP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- FTM2 C1 'capture' interrupt with both edges (C0V and C1V). and QD direction&lt;/P&gt;&lt;P&gt;08354 rise&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;nbsp; One turn later, so same as above plus 0x320&lt;/P&gt;&lt;P&gt;08356 fall&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8354 8356&amp;nbsp; UP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;08356 rise&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Compare interrupt on leading edge, in reverse direction&lt;/P&gt;&lt;P&gt;08354 fall&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Compare trailing edge, still in reverse&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8356 8354&amp;nbsp; DN&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;nbsp; FTM2 C1 capture interrupt from reverse direction, so the 'higher' count matches the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index rising edge, and the falling edge comes 'later' as the count continues to decrease.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is a version of the code that runs this test.&amp;nbsp; Please, no points off for style(!), especially printf() in isr!...this is just test-case code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2013 15:03:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284271#M10806</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2013-03-26T15:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284272#M10807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a footnote on the impressive performance of the Kinetis QD FTM functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With 'maximum filtering' set in FTMx_FILTER, a 36MHz bus clock allows just about 1.2 Million edges per second.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With filtering 'off', it looks like the edge rate can run right at the 1.5 bus-clocks per edge per the datasheet GPIO spec!&amp;nbsp; Each input frequency is only 1/4 the edge rate, of course.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And running 'near the limits' of clocks and filters of course requires 'perfect quadrature', with each input truly 50/50 and offset exactly 90 degrees.&amp;nbsp; Deviations will decrease the overall edge rate until the 'shortest' segment satisfies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 16:52:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284272#M10807</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2013-03-28T16:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284273#M10808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Earl, thanks for sharing your QEI file with us.&amp;nbsp; I'm glad I found it, as I am having a lot of trouble getting QD working on my FRDM-K64F using FTM2 configured to read a QE on PTB18 and PTB19.&amp;nbsp; I am comparing your code to mine, and was hoping that you could answer some questions I have come up with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You set the DECAPEN0 flag just before enabling the FTM.&amp;nbsp; The docs say that this field is write-protected, so MODE[WPDIS] has to be 1 for it to take effect.&amp;nbsp; Is there a reason why you didn't put FTM2_MODE = FTM_MODE_FTMEN_MASK | FTM_MODE_WPDIS_MASK before FTM2_COMBINE = FTM_COMBINE_DECAPEN0_MASK?&lt;/LI&gt;&lt;LI&gt;Is it necessary to set FTMx_CnV?&amp;nbsp; Your comment says "clear these while we can", which sounds important, but the docs say that in input capture or dual edge capture modes, these registers are ignored.&lt;/LI&gt;&lt;LI&gt;For "quick and dirty" testing, I just have a task that performs all of my register initializations, and then sits in a while loop and monitors FTM2_CNT and should hit a breakpoint any time the count changes.&amp;nbsp; However, it never changes.&amp;nbsp; At some point I will add the ISR to deal with counter rollover, but is it necessary to implement this now when I just want to see the FTM2_CNT register change as I spin the encoder?&lt;/LI&gt;&lt;LI&gt;I think the main problem I'm having is that I can't set FTM2_MOD.&amp;nbsp; It's always zero.&amp;nbsp; I've also tried to follow FSL's flowchart for modifying that value, but even when I set up the other registers as indicated, when I write FTM2_MOD it's still 0.&amp;nbsp; Would you agree that anytime FTM2_MOD is 0, FTM2_CNT will be stuck at 0 as well?&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 16:33:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284273#M10808</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2015-03-30T16:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: QEI inputs, and index capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284274#M10809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I've finally figured it out.&amp;nbsp; I will update &lt;A _jive_internal="true" href="https://community.nxp.com/thread/350276"&gt;my own post&lt;/A&gt; with my findings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 17:22:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/QEI-inputs-and-index-capture/m-p/284274#M10809</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2015-03-30T17:22:44Z</dc:date>
    </item>
  </channel>
</rss>

