AnsweredAssumed Answered

quadrature decoder / FTM how-to

Question asked by Lawrence Johnson on Apr 9, 2013
Latest reply on Apr 30, 2013 by EARL GOODRICH

I'm attempting to enable the quadrature decoder in a K10 series part. I have an encoder connected to inputs PHA/B or PTA10 & 11, corresponding to FTM2. Reading the manual, in order to enable this, I need to set FTMEN and QUADEN.  Here's what I did:


FTM2_MODE = 0x00000005;          // WRTDIS bit is already set, default after reset.

FTM2_SC = 0x00000028;

FTM2_QDCTRL = 0x00000001;

FTM2_CNT = 100;          // manual says write to this before writing to FTM2_CNTIN


FTM2_MOD = 0x00007fff;


The WRTEN bit is set, and the WRTDIS bit is clear.

The filters are off, and should be disabled, and the clock is enabled to the FTM.

If I turn the encoder, I can see the PHA/B inputs changing on the pins, checked with a scope.

The FTM2_MOD register never reflects the write of 0x00007ffff to it & I never get anything other than 0 in the FTM2_CNT register.


I've read and reread the section of the manual on quadrature decoder mode, and I can't see anything in the block diagram or anywhere else that I'm not putting into the required state. I have also tried the same configuration with FTM1, and got the same results. What am I missing?