FTM changing FTMx_CxV

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

FTM changing FTMx_CxV

674 Views
wojtek_84
Contributor I

Hi,

I'm using FTM3 on channel 0 to generate PWM signal. Processor expert was use to setup the timer. It works ok.

Now I want to change FTM3_C0V register in my app. Changing value of this register does not change the puls width.

I noticed that such action works:

FTM3_SC &= ~(1<<3);
FTM3_C0V = value
FTM3_SC |= (1<<3);

Do I really need to stop the timer to chanche C0V value?

Regards.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

428 Views
EarlOrlando
Senior Contributor II

Dear Wojciech Serek,

You don't need to stop the timer to change the FTMx_CnV value. Please be sure that you write to this register the counts needed until the channel match and not the duty cycle of the PWM.

The next snapshot is from the K64 reference manual when you can see how the PWM period and the duty cycle is computed.

pastedImage_0.png

I hope this helps. I remain at your service.

Best regards,

Earl Orlando Ramírez-Sánchez.