FTM output compare MCUXpresso SDK_2.x_FRDM-K66F working?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

FTM output compare MCUXpresso SDK_2.x_FRDM-K66F working?

跳至解决方案
2,186 次查看
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 项奖励
回复
1 解答
1,831 次查看
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

在原帖中查看解决方案

4 回复数
1,831 次查看
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 项奖励
回复
1,831 次查看
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 项奖励
回复
1,832 次查看
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

1,831 次查看
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 项奖励
回复