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?
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).
uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
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.
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).?