cancel
Showing results for 
Search instead for 
Did you mean: 

Timer counter wraps around in PWM input mode when input frequency is too low.

sima2
Associate III
Posted on April 14, 2015 at 13:47

I have setup a timer in PWM input mode. It all works well. I have setup the prescaler and period counter so I can measure down to 10 Hz. But if the input frequency is too low (< 10 Hz) the timer will wrap around.

If I read the capture values I will calculate the  wrong frequency.

Or can the timer be set to not wrap around?

PWM input mode

3 REPLIES 3
Posted on April 14, 2015 at 17:01

Use a 32-bit timer if your unspecified part has one. Consider master/slaving a pair of 16-bit counters. Consider if you can use an update interrupt, or a 32-bit free running timebase, or 1ms ticker, to invalidate measurements over too long a period.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sima2
Associate III
Posted on April 14, 2015 at 23:53

It is a STM32F437ZI, The timer pins is already defined. The timers I use are 16-bit timers. 

How would an update interrupt help? In what way could I use that?

Posted on April 15, 2015 at 00:38

Well I'd imagine you could use Update, or a threshold via CCR3/CC3 to catch the situations where the measurement is invalid, or timed out.

Depending on if you can live with loss of resolution, you could also increase the prescaler.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..