cancel
Showing results for 
Search instead for 
Did you mean: 

Safely reading a filterred input with an IRQ Handler (input capture mode with input filter)

SSieg.3
Associate

On an STM32F0 I would like to read a digital signal using the input filter. I configure an input (e.g., TIM1_CH1) in input capture mode and I properly set the input capture filter (IC1F) to remove noise of the input. Also, I need to detect both edges of the input, so I properly set the CC1 bits.

To detect a change of the input, I activate the interrupt.

My question is: when I read the signal (a bit of GPIOx_IDR) within the IRQ Handler, will this be the signal TI1FP1 or will it capture what is seen then at the actual input (TIM1_CH1)? Could it happen, that I read a wrong signal because of the interrupt delay if the external signal changed already? Is there a better way to safely read the signal without using two timer channels to split the detection of rising and falling edges?

1 REPLY 1

> will this be the signal TI1FP1 or will it capture what is seen then at the actual input (TIM1_CH1)

It's the actual input. I don't know of a way to read TI1FP1 directly. But you can detect "second arriving edge" by observing the overcapture flag.

JW