cancel
Showing results for 
Search instead for 
Did you mean: 

timer input filter in encoder mode available ?

mehmet.karakaya
Associate III
Posted on December 18, 2010 at 19:33

timer input filter in encoder mode available ?

4 REPLIES 4
lowpowermcu
Associate II
Posted on May 17, 2011 at 14:18

Hi mehmed,

In the reference manual it is described in the encoder mode section:

''Select the TI1 and TI2 polarity by programming the CC1P and CC2P bits in the TIMx_CCER register. CC1NP and CC2NP must be kept cleared. When needed, you can program the input filter as well.''

but when using ST library, It is not clear (for me at least) how to do it but I can do it as following (my own code uses TIM2)

/* Set TI1 and TI2 filters by writing to CCMR1 register */

TIM2->CCMR1 |= 0x3000; /* set TI1 filter at 3, filter bits are bits from 15 to 12 */

TIM2->CCMR1 |= 0x0030; /* set TI2 filter at 3, filter bits are bits from 7 to 4 */

Hope that kelps you !

Herzlich,

 

MCU Lüfter
lowpowermcu
Associate II
Posted on May 17, 2011 at 14:18

Hi mehmed,

In the reference manual it is described in the encoder mode section:

''Select the TI1 and TI2 polarity by programming the CC1P and CC2P bits in the TIMx_CCER register. CC1NP and CC2NP must be kept cleared. When needed, you can program the input filter as well.''

but when using ST library, It is not clear (for me at least) how to do it but I can do it as following (my own code uses TIM2)

/* Set TI1 and TI2 filters by writing to CCMR1 register */

TIM2->CCMR1 |= 0x3000; /* set TI1 filter at 3, filter bits are bits from 15 to 12 */

TIM2->CCMR1 |= 0x0030; /* set TI2 filter at 3, filter bits are bits from 7 to 4 */

Hope that kelps you !

Herzlich,

 

MCU Lüfter

mehmet.karakaya
Associate III
Posted on May 17, 2011 at 14:18

hello MCU Lüfter ( danke vielmals )

I have another question

in the manual , in TIMER1&8 explanation an abreviation is used

OCx_EN and OCxN_EN

what are these?

what are these?lowpowermcuMonday, December 20, 2010 1:36 PMtimer input filter in encoder mode available ?

Hi mehmed,

In the reference manual it is described in the encoder mode section:

''Select the TI1 and TI2 polarity by programming the CC1P and CC2P bits in the TIMx_CCER register. CC1NP and CC2NP must be kept cleared. When needed, you can program the input filter as well.''

but when using ST library, It is not clear (for me at least) how to do it but I can do it as following (my own code uses TIM2)

/* Set TI1 and TI2 filters by writing to CCMR1 register */

TIM2->CCMR1 |= 0x3000; /* set TI1 filter at 3, filter bits are bits from 15 to 12 */

TIM2->CCMR1 |= 0x0030; /* set TI2 filter at 3, filter bits are bits from 7 to 4 */

Hope that kelps you !

Herzlich,

 

MCU Lüfter

lowpowermcu
Associate II
Posted on May 17, 2011 at 14:18

Hi mehmet,

I think OCx means Output Compare and x is 1, 2, 3 oder 4 (that depends on the nimber of channels in the timer).

So  OCx_EN means Ouput compare x ENable but in the documentation it is used CC1E/CC2E, CC3E...

so OCx_EN for channel 1 is CC1E: Capture Compare 1 Output Enable.

In my understanding, there is a typo.

Perhaps an ST engineer can confirm this for us.

WIth regards,

 

MCU Lüfter