qd mode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决
1,520 次查看
ralf1694
Contributor III

Can not get qd mode to work.

0 项奖励
回复
1 解答
1,335 次查看
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 项奖励
回复
4 回复数
1,335 次查看
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 项奖励
回复
1,335 次查看
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 项奖励
回复
1,335 次查看
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 项奖励
回复
1,336 次查看
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 项奖励
回复