Skip to main content
stst9192
Associate
October 30, 2012
Question

Rising and falling slope counting with TIM4 counter STM32L152xxx ?

  • October 30, 2012
  • 3 replies
  • 706 views
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 ;).

    This topic has been closed for replies.

    3 replies

    waclawek.jan
    Super User
    October 30, 2012
    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
    stst9192Author
    Associate
    October 30, 2012
    Posted on October 30, 2012 at 13:38

    Thx, but ..this does not work for TI2

    tom

    stst9192
    stst9192Author
    Associate
    October 30, 2012
    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.