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.
See also:
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:
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