cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with the configuration of the Input Capture Filter

kurchr01
Associate
Posted on December 11, 2013 at 14:33

Hi community,

i've got a question dependig on the configuration of the input capture filter of the stm32f407.

I found the following lines in the datasheet (depending TIMx_CCMR1 register):

===============================================================

Bits 7:4IC1F: Input capture 1 filter

This bit-field defines the frequency used to sampleTI1 input and the length of the digital filter

applied to TI1. The digital filter is made of an event counter in which N events are needed to

validate a transition on the output:

0000: No filter, sampling is done at fDTS1000: fSAMPLING=fDTS/8, N=6

0001: fSAMPLING=fCK_INT, N=21001: fSAMPLING=fDTS/8, N=8

0010: fSAMPLING=fCK_INT, N=41010: fSAMPLING=fDTS/16, N=5

0011: fSAMPLING=fCK_INT, N=81011: fSAMPLING=fDTS/16, N=6

0100: fSAMPLING=fDTS/2, N=61100: fSAMPLING=fDTS/16, N=8

0101: fSAMPLING=fDTS/2, N=81101: fSAMPLING=fDTS/32, N=5

0110: fSAMPLING=fDTS/4, N=61110: fSAMPLING=fDTS/32, N=6

0111: fSAMPLING=fDTS/4, N=81111: fSAMPLING=fDTS/32, N=8

Note: In current silicon revision, fDTSis replaced in the formula by CK_INT when ICxF[3:0]= 1, 2 or 3

===============================================================

My settings are:

f_clk_int = 84MHz, fDTS = 0.25*f_clk_int, maximum allowed input frequency = 5KHz

I want to configure the filter in that way, that a input signal must at least have a puls width of 100�s. If I have a sample frequency(fDTS) of 21MHz, I would need a filter counter value (N) of 2100. But, where can I set this counter value? I think my main problem is that I don't understand the datasheet in that case.

I would be happy if anyone could help me.

Simon

#input-capture-filter
2 REPLIES 2
chen
Associate II
Posted on December 11, 2013 at 15:41

Hi

You are right the timer is immensely complicated if you are using it for more than just up/down & overflow counting.

What mode are you using the timer in InputCapture or OutputCompare?

Posted on December 11, 2013 at 17:59

Your presentation of the table is distracting.

0000: No filter, sampling is done at fDTS
0001: fSAMPLING=***_INT, N=2
0010: fSAMPLING=***_INT, N=4
0011: fSAMPLING=***_INT, N=8
0100: fSAMPLING=fDTS/2, N=6
0101: fSAMPLING=fDTS/2, N=8
0110: fSAMPLING=fDTS/4, N=6
0111: fSAMPLING=fDTS/4, N=8
1000: fSAMPLING=fDTS/8, N=6
1001: fSAMPLING=fDTS/8, N=8
1010: fSAMPLING=fDTS/16, N=5
1011: fSAMPLING=fDTS/16, N=6
1100: fSAMPLING=fDTS/16, N=8
1101: fSAMPLING=fDTS/32, N=5
1110: fSAMPLING=fDTS/32, N=6
1111: fSAMPLING=fDTS/32, N=8

I think you'll have to do the analysis of the pulse width by measuring it's beginning and trailing edges.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..