cancel
Showing results for 
Search instead for 
Did you mean: 

Rising and falling slope counting with TIM4 counter STM32L152xxx ?

stst9192
Associate II
Posted on October 30, 2012 at 11:43

Hi guys,

Does someone knows how to configure TIM4 in counter mode for counting any slope on TI2 for SMT32L152xxx ?

any help appreciated, Tom ;).

3 REPLIES 3
Posted on October 30, 2012 at 12:06

In TIM4_SMCR, select TI1F_ED in TS bits, and External clock mode 1 in SMS bits.

JW
stst9192
Associate II
Posted on October 30, 2012 at 13:38

Thx, but ..this does not work for TI2

tom

stst9192
Associate II
Posted on October 30, 2012 at 14:19

Hi @all,

I've found out this works for TI2 (I did not set the CCER properly for both edges...) :

    TIM4->SMCR  = 0x00000067;

    TIM4->CCMR1 = 0x00000000;

    TIM4->CCER  = 0x000000a0;

    TIM4->CR1  = 0x00000001;

Txh for everyone reading, Tom.