Setting up Quadrature Encoder

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting up Quadrature Encoder

1,124 Views
PHXFAE
Contributor II

I have a customer using theMK21FX512VMC12 and is trying to set up the FTM2 for a quadrature encoder. 

The goal is to have FTM2 in the Quadrature Mode where the PHA and PHB clocks come in and increment or decrement the counter. Every 100miliseconds, I want to read the FTM2 Counter value
and direction,  then reset back to the initial value.

To do this: do I have to set the channels up?

Are they only needed to load or compare to the count register?

Do I have to do anything with the mod register?

I see the initial Count value when I read it but I don’t see the counter change with PHA and PHB running.

I added a txt file for the register set up.

Labels (1)
0 Kudos
Reply
2 Replies

818 Views
egoodii
Senior Contributor III
0 Kudos
Reply

818 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

It need to use FTM Quadrature Decoder- Phase A and Phase B Encoding mode.

For there could exist counter increase and decrement situation, please check below picture:

2015-06-30_14-35-21.png

There is a note for the FTM module using with quadrature decoder mode, the FTM channels in input capture and output compare mode.

When BDM is active, the FTM counter is frozen. This is the value that you may read.

So, it need to use the software to read the FTM counter value back.

Wish it helps.

best regards,

Ma Hui

0 Kudos
Reply