PWM max frequency

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

PWM max frequency

跳至解决方案
3,125 次查看
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.

标签 (1)
0 项奖励
回复
1 解答
2,676 次查看
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 项奖励
回复
3 回复数
2,676 次查看
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 项奖励
回复
2,676 次查看
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 项奖励
回复
2,677 次查看
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 项奖励
回复