Problem about using Processor Expert with KDS3.0+KDSK1.2.0

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

Problem about using Processor Expert with KDS3.0+KDSK1.2.0

跳至解决方案
790 次查看
gloria
Contributor III

I am using KDS3.0+KDSK1.2.0+PE and I want to output 50MHz sqaure waveform by compoent FlexTimer component provided by Processor Expert.

However, the maximum frequency it can output is about 15MHz. When it is larger than 20MHz, a 50Hz square waveform will appear.

It is so strange!!!

Could anybody help me about this please?

I use "fsl_clock_manager" to set the system clock to 100MHz.

pastedImage_0.png

pastedImage_1.png

And then I set the 'fsl_ftm' component like this:

pastedImage_2.png

pastedImage_3.png

And then, I click "Generate Processor Expert Code" button and write the following code in main.c:

FTM_DRV_Init(FSL_FLEXTIMER1,&flexTimer1_InitConfig0);

FTM_DRV_SetClock(FSL_FLEXTIMER1, kClock_source_FTM_SystemClk,kFtmDividedBy1);

FTM_DRV_PwmStart(FSL_FLEXTIMER1,&flexTimer1_ChnConfig0,0U);

FTM_HAL_SetSoftwareTriggerCmd(FTM0_BASE, true);

Did I miss anything? Setting or code?

Many thanks!

标签 (1)
0 项奖励
1 解答
603 次查看
EarlOrlando
Senior Contributor II

Hello again,

First of all, PLEASE DO NOT MAKE MORE THAN ONE THREAD PER QUESTION.

Problem about using Processor Expert with KDS3.0+KDSK1.2.0

What components  do I need to output PWM using FTM module by Processor Expert ?

Could I set OSCERCLK as the PWM clock source in FTM moudle in FRDM-K64F?

How could I output 50MHz square waveform by using FRDM-K64F?

The FTM is fed by the bus clock which in this case is 50 MHz. If you view the reference manual, the PWM period is the counts to overflow the timer and the PWM pulse duration depends on the counts configured per channel. For example, if the timer needs 100 counts (FTMx_CNT) to overflow, and the channel value (FTMx_CnV) is 35, when the FTMx_CNT is less than 35 the output will be high and it will toggle when the counter and the channel value match. So, if you have a 50 MHz bus clock, the maximum PWM frequency will be 25 MHz and you will be able to have 0%, 50% or 100% of duty cycle.

pastedImage_4.png

Best regards,

Earl.

在原帖中查看解决方案

0 项奖励
3 回复数
603 次查看
gloria
Contributor III

I use FRDM_K64F board

0 项奖励
604 次查看
EarlOrlando
Senior Contributor II

Hello again,

First of all, PLEASE DO NOT MAKE MORE THAN ONE THREAD PER QUESTION.

Problem about using Processor Expert with KDS3.0+KDSK1.2.0

What components  do I need to output PWM using FTM module by Processor Expert ?

Could I set OSCERCLK as the PWM clock source in FTM moudle in FRDM-K64F?

How could I output 50MHz square waveform by using FRDM-K64F?

The FTM is fed by the bus clock which in this case is 50 MHz. If you view the reference manual, the PWM period is the counts to overflow the timer and the PWM pulse duration depends on the counts configured per channel. For example, if the timer needs 100 counts (FTMx_CNT) to overflow, and the channel value (FTMx_CnV) is 35, when the FTMx_CNT is less than 35 the output will be high and it will toggle when the counter and the channel value match. So, if you have a 50 MHz bus clock, the maximum PWM frequency will be 25 MHz and you will be able to have 0%, 50% or 100% of duty cycle.

pastedImage_4.png

Best regards,

Earl.

0 项奖励
603 次查看
gloria
Contributor III

I am so sorry for so many questions. Thank you very much for your help. They are very useful!

0 项奖励