Hello everyone, and happy holidays.
I am trying to extend the range of my input capture. In the past I have used all sorts of work-arounds to use the 16 bit input to read a very wide range of frequencies. I am hoping there is a more elegant way.
What I have done so far is to use the TPM overflow interrupt to increment an unsigned int. Then when an input capture occurs, I make a 32 bit register using the overflow counter as the high word.
Calculating the delta is a simple matter, and I have a 32 bit input capture.
This works 99% of the time, but I am getting stray errors in the captures. I assume it is related to the non-synchronoous increment of the overflow counter, so I my calculations are wrong when the main TPM counter overflows, and a capture occurrs before the overflow interupt can increment the counter.
I vaguely remember an app note regarding counting overflows, but I can't find it.
A 32 bit capture makes all my other software requirements easier. So I am hopeful that the internet-wisdom can help me here.
I would change the TPM rate, but I am doing some other stuff that requires a 50hz PWM, so I am a bit locked in.
Switching up to the larger Flexis part is not possible at this point. I finally have the USB working decently...
Thanks in advance for your attention
Bob Bailey
N8DRK