K64F PWM with long period

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

K64F PWM with long period

545 Views
kevinyuthermo
Contributor III

I need a PWM signal with a two-second period.

FTM module has the PWM function but the PWM period too short (us level) since it uses a 16 bits counter.

How can I get a second level period PWM? Or I have to implement it with timer on a GPIO?

0 Kudos
4 Replies

410 Views
mjbcswitzerland
Specialist V

Hi Kevin


Choose a low frequency clock for the FlexTimer if possible and use maximum pre-scaler too; this will give you longer periods for the PWM period.

You can also use an external clock which allow even slower clocks.

It is also possible to use two FlexTimers (cascaded) - the first generating a slow clock for the second (this can also be cascaded via the FlexTimer clock input).

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

410 Views
kevinyuthermo
Contributor III

Hi Mark,

I can make a second-level timer, but I have to implement the pwm duty cycle update algorithm. That introduces more work. Any better simple solutions? 

0 Kudos

410 Views
mjbcswitzerland
Specialist V

Hi

That is the only and simplest solution I can think off - a duty cycle update algorithm is a calculation of a value to write to the corresponding FTM_CV register and will not be made more complex with a slower or a two-tiered clock.

Regards

Mark

0 Kudos

410 Views
kevinyuthermo
Contributor III

Hi Mark,

Do you have some sample code about using two FlexTimers (cascaded) - the first generating a slow clock for the second (this can also be cascaded via the FlexTimer clock input).?

 

0 Kudos