S32K FTM_QD模式 init_trig 不工作

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K FTM_QD模式 init_trig 不工作

2,120 Views
zhengjianfei1
Contributor III

Hi nxp,

   最近发现S32K一个问题,S32K的FTM如果工作在QD(Quadrature Decoder Mode)模式,FTM的Init_trig会不工作。FTM的配置如下。我是用的Init_trig来触发trgmuxout1,示波器测试trgmuxout1没有任何波形,同样的,如果FTM是PWM模式,Init_trig来触发trgmuxout1,示波器测试trgmuxout1就会有对应的触发波形。经过多次测试验证,S32K的FTM如果工作在QD模式,FTM溢出中断可正常触发,但是init_trig 无法工作。能否帮忙解释下原因呢,或者是有哪些配置需要注意下呢?非常感谢!

pastedImage_1.png

pastedImage_2.png

Labels (1)
5 Replies

2,016 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi zhengjianfei@zlgmcu.com,

I have just tested and it works, it generates the init_trig.

I used the configuration I see in the screenshots.

Could you please share a test code so that I can reproduce the exact behavior?

Thank you,

Regards,

Daniel

0 Kudos

2,016 Views
zhengjianfei1
Contributor III

Hi Daniel,

   Thanks a lot! My code is as follows.

   When I set FTM0_INITTRIG(PWM mode) to trig trgmuxout0, trgmuxout0 PIN has square wave. But When i set FTM1_INITTRIG(QD mode) to trig trgmuxout0, it has nothing.But FTM1 OVER interrupt can work.

   To use my code, you neet to connect PTD15 & PTB3.

pastedImage_1.png

0 Kudos

2,016 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi zhengjianfei@zlgmcu.com,

It triggers when the CNT is down-counting and reaches the INIT value, in this case 0x0000.

The CNT decrements on rising edges of PTB3 (phase A) when PTB2 (phase B) is LOW.

In your code, there is the PTB2 internal pull-up enabled, the CNT increments and the trigger is not generated when the CNT overflows to the INIT value.

What is your use case?

Thanks,

BR, Daniel

2,016 Views
zhengjianfei1
Contributor III

Hi Daniel ,

        Thanks for your reply. I will test 

         I just want to generate the exact number of square wave using FTM-PWM. When number of square wave is equal to what I want,then shut down PWM through FTM fault fuction(fault pin or Trgmux).

         In S32K RM, INITTRIGEN is defined " Enables the generation of the trigger when the FTM counter is equal to the CNTIN register."  In My case, when CNT increase to MOD,and next time CNT is equal to the CNTIN,but it cannot   generate  trigger. I didn't realize the CNT increments cannot generate  trigger,Thanks for your help!I will test it following your advise。

pastedImage_1.png

0 Kudos

2,017 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi zhengjianfei@zlgmcu.com,

I think you can use LPIT in 32-bit Trigger Accumulator Mode which counts input triggers and can generate an output trigger when the counter overflows.

Regards,

Daniel