Hi,
Now I am working on FRDM-K64F to implement frequency measurement. I have tried different method ( single edge capture mode, dual edge capture mode, and GPIO interrupt) , but all the results are not satisfactory.
One of my implementation is :
- use GPIO detect rising edge (PTB9), GPIO IRQ has one action only : counter plus 1
- use FTM0 to count time : 5s
- GPIO interrupt will be disabled once FTM0 5 seconds counting finish
- according to counter number and timing (5s) to calculate frequency
base on my understanding, GPIO use system clock - 120MHz which could response faster interrupt.
but now I am facing an issue for this implementation. FTM interrupt can not be received once GPIO input signal frequency exceed 2.4MHz.
I think that because GPIO make system busy, so I change GPIO interrupt priority to 2 and set FTM interrupt priority to 1. In my opinion, GPIO interrupt should be preempted by FTM interrupt ( because FTM set to higher frequency). But the result is same as before : FTM interrupt still can not be received once GPIO input signal frequency exceed 2.4MHz.
Then I have set GPIO interrupt to lower frequency -> 256, but the result no different.
It seems like, whole system has been occupied by GPIO interrupt once the input frequency higher than 2.4MHz, but it doesn't make sense....
Does anyone can give me a help ?
Thanks & Best Regards
Joshua