qd mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,551件の閲覧回数
ralf1694
Contributor III

Can not get qd mode to work.

0 件の賞賛
返信
1 解決策
1,366件の閲覧回数
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,366件の閲覧回数
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,366件の閲覧回数
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,366件の閲覧回数
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,367件の閲覧回数
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 件の賞賛
返信