qd mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
729 Views
ralf1694
Contributor III

Can not get qd mode to work.

0 Kudos
1 Solution
544 Views
ralf1694
Contributor III

hi xiangjun.

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!

View solution in original post

0 Kudos
4 Replies
544 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Ralf,

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

BR

Xiangjun rong

0 Kudos
544 Views
ralf1694
Contributor III

Hi Xiangjun,

I enable the PORTA gate clock before muxing the port. I spin the motor but the FTM2_CNT (debug) register is always null.

0 Kudos
544 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, ralf,

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.

BR

Xiangjun Rong

0 Kudos
545 Views
ralf1694
Contributor III

hi xiangjun.

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!

0 Kudos