PWM max frequency

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

PWM max frequency

Jump to solution
2,572 Views
martindusek
Contributor V

What is max. achievable edge aligned PWM (or any other PWM or output compare) frequency on Kinetis K22 in high speed run mode (MCGOUT = 120 MHz), all clocks set to max: CLKDIV1 = 0x01340000U (=> core/system = 120 MHz, bus = 60 MHz)?

As FTM is clocked by system clock I would assume 60 MHz is achievable. However, I'm able to generate only 30 MHz with this setting:

CLOCK_EnableClock(kCLOCK_Ftm0);
FTM0->SC = FTM_SC_CLKS(1);
FTM0->MOD = 1;
FTM0->CONTROLS[1].CnSC = FTM_CnSC_ELSB_MASK | FTM_CnSC_MSB_MASK;
FTM0->CONTROLS[1].CnV = 1;

I need to generate 1:2 high:low pulses with max. frequency.

Labels (1)
0 Kudos
Reply
1 Solution
2,123 Views
mjbcswitzerland
Specialist V

Martin

The FlexClock has (depending on exact chip) at least 2 clock source possibilities but the fastest is always the bus clock (never system/core clock).

It is always advisable to look at the module clock section of the user's manual since it will list the clocks to the FlexTimer, where it is then clear that it is BUS CLOCK.

In some of the manuals the FlexTimer section will start with a note that the "system clock" as used in its description is not the processor's system clock (it may state that it is the bus clock or that you need to consult the module clocking section to find out which one it actually is).

Regards

Mark

View solution in original post

0 Kudos
Reply
3 Replies
2,123 Views
mjbcswitzerland
Specialist V

Hi Martin

In edge aligned mode the minimum MOD value is 1 (which means that the cycle ends when this value increments [to 2->0]). This gives 2 x 60MHz cycles for the PWM period -> 30MHz.
To get a signal of 33.3% PWM (1 high pulse for each 2 low pulses) you need MOD = 2 and CV = 1, which will give 20MHz frequency.
__|-|__|-|__|-|__

Regards

Mark


uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html

0 Kudos
Reply
2,123 Views
martindusek
Contributor V

Hi Mark, thanks for your answer. I apologize for confusing question, but I would like to know why max achievable frequency of PWM on 120 MHz kinetis is only 30 MHz. I think the answer is here: K20: FTM clock divided by 2 

System clock in fTMsection of RM is actually bus clock. As bus clock max is 60 MHz, then max PWM frequency is 30 MHz, whch corresponds to what I get from my kinetis.

0 Kudos
Reply
2,124 Views
mjbcswitzerland
Specialist V

Martin

The FlexClock has (depending on exact chip) at least 2 clock source possibilities but the fastest is always the bus clock (never system/core clock).

It is always advisable to look at the module clock section of the user's manual since it will list the clocks to the FlexTimer, where it is then clear that it is BUS CLOCK.

In some of the manuals the FlexTimer section will start with a note that the "system clock" as used in its description is not the processor's system clock (it may state that it is the bus clock or that you need to consult the module clocking section to find out which one it actually is).

Regards

Mark

0 Kudos
Reply