cancel
Showing results for 
Search instead for 
Did you mean: 

What is the minimum/maximum frequencies I can measure with a timer in input capture mode?

LBant
Associate II

I am using an STM32F303K8T and am trying to use a flow sensor with an output of 15 Hz - 225 Hz.

5 REPLIES 5

Depends on the granularity of the measurement you seek, so the prescaler on the TIM, the width of the counter, and input prescaler, where you can measure 1, 2, 4 or 8 periods.

The frequencies you describe are LOW. For HIGH frequencies one might look at External Count mode.

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

Thanks Clive. What is the point of measuring 1/2/4/8 periods?

S.Ma
Principal

Your frequency is very low.

Say your STM32 runs at 32 MHz.

Take a 16 bit timer and prescale by 128 and the timer clock will be 250kHz

The timer overflow period will be 250000 / 65536 = 3,8 Hz

Any frequency higher than this one and below 1 kHz should be accurately measured with input capture or pulse capture. you'll get period and duty cycle (high and low time). The accuracy will depend on the timer 32MHz clock frequency precision...

This is just a quick example.

Input signal prescale is typically for very high incoming signal frequency.

LBant
Associate II

Which prescaler are you referring to (128)? I noticed on CubeMX there is an input capture prescaler division ratio and a prescaler PSC in counter settings.

0690X000006DQ3IQAW.png

Thanks Clive. What do you mean by measuring 1/2/4/8 periods? And what is the difference between the prescaler on the TIM and the input prescaler?