Hi zhiyong zhang ,
Thanks for your interest in the NXP kinetis product, I would like to provide service for you.
Do you want to detect both the PWM duty and the frequency, right?
What's the FTM clock you are using? Bus clock 20Mhz? Core clock is 40Mhz, right?
Do you try to just use signal edge to detect the 20Khz frequency PWM?
Does it work?
Or just when you use the Double Edge sampling which also want to get the pulse, 95% duty cycle, it meas the double edge interrupt should detect the 5%*20K= 2.5us.
Please note, the FTM double edge sample,two edges detect is also using the same FTM2 interrupt ISR.
From this link:
Beginner guide on interrupt latency and Arm Cortex-M processors - Processors blog - Processors - Arm...
You can get that:

That means, the interrupt latency+ your ISR interrupt service code time should smaller than the 5%*20K= 2.5us.
So, if your core clock is 40Mhz, then you can check your ISR serive code, whether all the execute time is larger than 2.5us when you can't detect the correct frequency?
Because if your ISR execution time is very long, when the next edge interrupt happens, you will lost the interrupt, it will have problems. So in your ISR, code should be as small as possible, save the execute time.
Wish it helps you!
If you still have questions about it, please kindly let me know.
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------