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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Jump to solution
442 Views
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!

Labels (1)
0 Kudos
1 Solution
255 Views
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.

View solution in original post

0 Kudos
3 Replies
255 Views
gloria
Contributor III

I use FRDM_K64F board

0 Kudos
256 Views
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 Kudos
255 Views
gloria
Contributor III

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

0 Kudos