2019-08-13 10:45 PM
Greetings Everybody,
I want to ready PWM Input Frequency from 0.016 Hz to 250 Hz. I tried a bit with PWM Input Capture and i can read up to 11 Hz . Is it possible to ready frequencies lower than this ?
May be i might be doing some thing wrong in setting the timer clock. I have used Timer 2 for this purpose..
Any further guidance will be of great help..
Thanks.
2019-08-15 03:42 AM
Your approach is interesting... Is there any HAL function to get time stamp ?? I have never worked on time stamp aspect...
2019-08-15 03:48 AM
That's nice, but... what do you intend to achieve by extending the timer to 48 or 64 bits?
We have established that your counter is plenty long with 32 bits, and you processor has a 32-bit counter.
The disadvantage of this approach is that when the timer overflows, you MUST be running an interrupt to increment the higher order bits of the timer. But that will interfere with other interrupts if you're using those to measure the edges of the input signal.
On the other hand, when you do get a timer reading, it is difficult to get it right: You need to be very careful that you get the right "upper bits" wtih your sample. Of course without doing anything, you'll get it right in 99.9% of the cases, but when things roll around there can be tricky timing problems....