How to Count 'FTM Cycle '

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

How to Count 'FTM Cycle '

1,284 Views
daemangpark
Contributor I

Hi,

I would like to count FTM cycle.

I use s32k144 and s32k144EVB.

I set FTM0 to make Edge PWM.

it's source Clock is 8Mhz and prescaler is 2. so it is going to be 4MHz.

Set MOD to 36 and CnV is 18.

They were set to make PWM pulse 110Khz 50% duty.

BTW, I want count pwm cycle number.

I want it make pwm pulse with certain frequency until 100 cycle

and make pwm pulse with other frequency until 50cycle.

I think I can change frequencies. but don't know how to count pwm cycles.

1. Can you recommend the way to count pwm cycles under those condition?

2. What are the "FTM peripheral timer overflow interrupt" and "FTM peripheral timer channel interrupt" ? what is difference between them.

Thanks,

0 Kudos
1 Reply

1,014 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,
the "FTM peripheral timer overflow interrupt" is triggered when the FTM counter = MOD and overflows and the "FTM peripheral timer channel interrupt" is triggered when FTM counter = CnV.
It is described in Section 45.5.7, RM r.7.

The easiest solution would be to use one of the two interrupts and count the PWM cycles.

Or you can generate FTM output trigger on a FTM channel match (FTM counter = CnV) (CnSC[TRIGMODE = 1]) and route the FTM output trigger to LPIT module using TRGMUX module.
The LPIT module can be used in 32-bit Trigger Accumulator which counts input triggers. Again, on the LPIT overflow after 100 counts, an interrupt can be generated.

Regards,
Daniel

0 Kudos