cancel
Showing results for 
Search instead for 
Did you mean: 

stm32l151: TIMx input capture to count input pulses (input filter configuration)

filippo2991
Associate II
Posted on April 18, 2011 at 17:52

stm32l151: TIMx input capture to count input pulses (input filter configuration)

2 REPLIES 2
lowpowermcu
Associate II
Posted on May 17, 2011 at 14:32

Hi filippo,

The filter on input capture channel isn't a divider.

As it is named, it is a filter.

In my understanding, if you set the filter @ 7 (TIM_ICFilter = 0x7) there is 7 sampling on internal clock (I think MSI  at your case) to make the decision if the input channel is set at high level or low level.

I suggest to use   TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV8;

It should suit you.

Otherwise let me know .

Ciao,

MCU Lüfter

filippo2991
Associate II
Posted on May 17, 2011 at 14:32

Hello Lüfter,

in my understanding if I set

TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV8;

I get 1 input capture event every 8 input pulses; this isn't what I want.

What I want is what you wrote:

''if you set the filter @ 7 (TIM_ICFilter = 0x7) there is 7 sampling on internal clock > (I think MSI  at your case) to make the decision if the input channel is set at high > level or low level.''

where I supposed that setting TIMx->PSC with the following

TIM_PrescalerConfig(TIM4, 0xffff, TIM_PSCReloadMode_Update);

the filter would check 7 samples at fDTS=fMSI / 0xffff frequency. 

Isn't that the behaviour?

Thanks and best regards,

Fil