I'm using the quadrature on the FTM1 of my K60 and MQX4.0.
The peripheral source clock of my FTM is 60Mhz.
I'have an issue when the overflow occurs too often.
If I have a vibration on my quadrature input, I can have the case where the module count +1 and -1 really quickly.
If the counter is at the value 0, it has the effect to create many interruption and really quickly.
In my interruption routine, I test the differents cases to know if the overflow occurs on the bottom or on the top of counting.
To add a security, I read the count register and I check if the value match with the overflow flag. (Example : there is an top counting interrupt. In the count value you must have something close to 0 and never 0xFFFF)
The problem is that in somes cases I have some incoherence which occurs.
Sometimes instead to have +1/-1/+1 etc..., I have many +1 for one -1
This behaviours start to appears at a vibration of 30 kHz.
I tested with an oscilloscope to see the time duration of my interrupt. The interrupt is handled 2µs after the overflow occurs and my interrupt takes only 0.5µs.
During the interrupt, there is no more overflow. (I have enought time to do my test and go out the interrupt before an new overflow occurs)
I read the 2 values that I need and I clear the flag
_DirectionRegister = FTM1_BASE_PTR->QDCTRL;
_CodeurValue = FTM1_BASE_PTR->CNT;
Why there is some incoherences?
I would like to know how to manage those cases?
If you need more details doesn't hesitate to ask it.