FTM output compare MCUXpresso SDK_2.x_FRDM-K66F working?

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

FTM output compare MCUXpresso SDK_2.x_FRDM-K66F working?

Jump to solution
1,095 Views
wygonski
Contributor I

I am using the MCUXpresso SDK_2.x_FRDM-K66F example for FTM output compare project:  "frdmk66f_driver_examples_ftm_ftm_output_compare."  The FTM output toggles as expected but when I change the FTM compare value, the timing does not change.   I've stepped through the FTM_SetupOutputCompare library function.   I'm running on the FRDM-K66F eval board. 

Changing the compare value should change the frequency of the output, why doesn't this work?

0 Kudos
1 Solution
740 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Q: Are you suggesting that this function doesn't work as advertised?
A: No. The channel output is changed based on what is specified in the compareMode argument, but it's hard to observe when you has only one channel.(The CnV only move the waveform, it can not change the frequency. The frequency is related to MOD, you need to use FTM_SetTimerPeriod change the frequency.)

You may need to add another channel and only modify one of them. Then you can observe the waveform move.

Output Compare match toggles.png

View solution in original post

4 Replies
740 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Please use FTM_SetTimerPeriod function change the frequency of the output.

FTM_SetTimerPeriod.png

The compare value is not used to do that.

45.5.5 Output Compare mode.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
740 Views
wygonski
Contributor I

Robin,

Thanks for your reply.   The SDK demo program uses the FTM_SetupOutputCompare library function.  The MCUXpresso SDK API description states: 

"When the FTM counter matches the value of compareVal argument (this is written into CnV reg), the channel output is changed based on what is specified in the compareMode argument."

When I change the value of the compareVal argument and re-build and run, there is no change in the output.  Are you suggesting that this function doesn't work as advertised?

Thanks,

John

0 Kudos
741 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Q: Are you suggesting that this function doesn't work as advertised?
A: No. The channel output is changed based on what is specified in the compareMode argument, but it's hard to observe when you has only one channel.(The CnV only move the waveform, it can not change the frequency. The frequency is related to MOD, you need to use FTM_SetTimerPeriod change the frequency.)

You may need to add another channel and only modify one of them. Then you can observe the waveform move.

Output Compare match toggles.png

740 Views
wygonski
Contributor I

I modified my code to use the FTM_SetTimerPeriod() function and it works as you described.  

Thanks for the clear and helpful answer.

John

0 Kudos