cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Input capture Filter

luk
Associate II
Posted on February 09, 2017 at 13:38

Hey,

I'm using the Input Capture of TIM8 to measure the period of a signal. The Timer runs at 16MHz and the MCU (STM32F405) at 144MHz. I'm also using the ICFilter at the moment. The value is set at 0x02. My question is now how ong has to be the signal change to validate an transition?

(1/144MHz)*4 or (1/16MHz)*4?

Thanks for your help  
3 REPLIES 3
Posted on February 09, 2017 at 13:52

The Timer runs at 16MHz and the MCU (STM32F405) at 144MHz.

What do you mean by this? There's no direct provision to run the Timer's at other than fAPB or 2x fAPB clock, and APB can't be divided down from the system clock  by a number other than powers of 2. I doubt you clock the timer from another timer in master-slave fashion, which would allow this frequency ratio, do you?

So I suspect you have TIM_ARR is set so that the timer reloads at 16MHz rate, is it so? If so, then those 16MHz has nothing to do with the input capture - in fact that would be nonsense to filter input capture to multiple of a timer reload event.

The input capture filter can be derived either from the timer input clock or from the DTS prescaler - read the description of IC1F field in TIMx_CCMR1, and for the DTS prescaler, CKD field in TIMx_CR1, in RM0090.

JW

Posted on February 22, 2017 at 10:48

Thanks for your help.

So with this code the signal change has to last for at least 

(1/144MHz)*4. Is this correct?

TIM_TimeBaseStructure.TIM_Period = 0xFFFF;

TIM_TimeBaseStructure.TIM_Prescaler = 8;

TIM_TimeBaseStructure.TIM_ClockDivision = 0;

TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;

TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;

TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;

TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Falling;

TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;

TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;

TIM_ICInitStructure.TIM_ICFilter = 0x02;

Thank you,

mark

Posted on February 24, 2017 at 08:48

Yes, I'd say so.

JW