AnsweredAssumed Answered

Quadrature Decoder not counting correctly on FRDM-K66F

Question asked by Jeff Sylvester on Sep 19, 2018
Latest reply on Oct 10, 2018 by Jeff Sylvester

I have FRDM-K66F and using a CUI inc Encoder AMT213B-V that has 1024 PPR (pulse per revolution) and I have it connected to FTM1 on FRDM board.  (because I also need CAN0 that shares I/O pins with FTM2 on PTB18,PTB19.   So I used MCUExpresso Config Tool to set up the FTM1 pins, and registers,  

 

I run example code from Quadrature Encode/Decode example in SDK for FRDM-K66F that uses PIT timer to do a once per second read of the count register of FTM.    This example manually does some setting up of FTM so I comment this out and use the BOARD_InitPeripherals(), BOARD_InitPins(); BOARD_BootClockRUN(); BOARD_InitDebugConsole()

to set up all the registers at boot time.  

 

I have viewed the encoder output and the signals look just fine with A and B signals 90Degrees out of phase with each other and signal is solid 3.3V  ( encoder outputs 5v signal that goes through a 5v to 3.3v voltage translator.)

 

when I spin the encoder one full revolution,  i should get 4096 Edges counted.  (for both rising and falling edges on both A and B as per manual page 1254 of K66 Sub Family Reference Manual Rev  2 May 2015

 

I spin the encoder at a slow rate about one revolution per 1/2 second.   and I Measure around 3800 PPR in both + and - directions.    So this tells me one of three possibilities.   

 

1) The encoder puts out less PPR than stated. 

2) the Quadrature Decoder is not working / counting properly

3) The settings for FTM are not correct causing #2 above

 

See attachment.    Clock settings are Core clock 120MHz, System clock 120MHz, Bus Clock 60MHz, OSCERCLK 12MHz

 

I have tried Input filter settings of 1 to 12 on both channels A and B and the number does not seem to change the 3800PPR I am seeing. 

 

Does anyone have and suggestions on how to fix?

Attachments

Outcomes