PWM Input put capture and output in one FTM module

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

PWM Input put capture and output in one FTM module

Jump to solution
1,491 Views
kwf
Contributor III

Hi Community

I try to modified SDK ver. 2.9.0 example "input_capture"  to let the FTM2 can be input capture and output PWM waveform.

Base on user manual, I know when the edge was detected which I configured, the module will put the CTN value to CnV.

So, I let the FTM2_CH4 output 21.5 KHz PWM and FTM2_CH3 input capture.

The purpose is I need to know the duty and the same time the PWM output can work.

My FTM input clock are system clock at high speed mode (168MHz).

In my test, FTM2_CH4 output to  FTM2_CH3, and set break point to check CnV value.

I Monitor register got the CnV same as CTN value in first time interrupt trigger , but most time I got CnV value 4.

I thought it should be same CnV value with FTM2_CH4, but it seem wrong!

Is my configuration wrong? I attachment my code please help me to check it.

PWM input capture seem only detect once.

Thanks for your time for read and help.

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,475 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello.

Hope you are well.
I suggest you use two different instances of the FTM for capture and PWM. You can use FTM0 for the input capture and any channel of the rest of the instances as PWM. For example, set FTM1 channel 0 to PWM.
While doing some tests I noticed that the input capture and the PWM behaved strangely when they are in the same instance.

Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar

View solution in original post

0 Kudos
3 Replies
1,476 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello.

Hope you are well.
I suggest you use two different instances of the FTM for capture and PWM. You can use FTM0 for the input capture and any channel of the rest of the instances as PWM. For example, set FTM1 channel 0 to PWM.
While doing some tests I noticed that the input capture and the PWM behaved strangely when they are in the same instance.

Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos
1,425 Views
kwf
Contributor III

Thx for your reply.

I had solve this question. It's my configuration wrong.

0 Kudos
1,380 Views
DavidChang0
Contributor I

Hello, 

Could you please share your code here?Do you have idea what i have to do when i want to continously capture the external signal( for me it is tacho signal from a fan & fan speed will be changed by changing input duty cycle.So continous monitoing of signal is necessary) ? If you have the code please share with me. I will be greatfull to you. Thanks in advance.

Best Regard's

David

0 Kudos