Can not get qd mode to work.
i solved the problem. the pha and phb signal goes throw a mux and the mux input was wrong.
thank you for your fast answers!
I suppose that your code is correct. From hardware perspective, I suppose you connect the encoder signals PhaseA/PhaseB with 90 degree phase shift to the PTA10(FTM2_QD_PHA) and PTA11(FTM2_QD_PHB), then rotate the motor shaft manually so that the Encoder sensor can generate the PhaseA and PhaseB edges and FTM can count the edges. If the motor shaft is still, no edges of PhaseA and PhaseB signal are generated, the FTM counter will be zero.
Regarding your code, I suppose you have enable the POPTA gate clock in the SIM_SCGC5 by the code such as SIM_SCGC5|=0x200; prior to your code: PORTA_PCR10 = PORT_PCR_MUX(6);
Regarding the test, pls check the FTM2_CNT register directly in the debugger of the tools and check it's value.
Hope it can help you
I enable the PORTA gate clock before muxing the port. I spin the motor but the FTM2_CNT (debug) register is always null.
Pls set the FTMEN bit by the code:FTM2_MODE|=0x05; //enable FTM2 module. I do not suggest you use center-alignment, but I do not think it is the cause of the issue either.
Pls have a try. If you still have problem, I will test on my tower board tomorrow.
Retrieving data ...