Skip to main content
Visitor II
May 16, 2024
Question

unable to read 32kHz oscillator signal on ETR pin

  • May 16, 2024
  • 7 replies
  • 2699 views

Hi all,

i'm working with a STM32F469i-discovery board trying to read the  external signal at 32kHz coming from an RTC module. The oscillating signal voltage is a CMOS type. I'm using TIM2_ETR input located on pin PA15 configured as follow. I'm not able to read any pulse on the pin and every time that I run the system the oscillator voltage fall to 0.3V instead of the 2.5V that I can measure when the system is not running.

I test the oscillator signal on Arduino board and I can read the right frequency just connectin the oscillator output to Arduino pin8.  Thanks for the support.

santulaz_0-1715841214088.png

santulaz_1-1715841237699.png

santulaz_2-1715841274580.png

 

 

    This topic has been closed for replies.

    7 replies

    Super User
    May 16, 2024

    Hi,

    you need to choose PA5 (or other) -> = an  input , NOT any push-pull output ! (or whatever pin cube gives you with your case as ETR clk input)

    AScha3_0-1715842656512.png

     

    santulazAuthor
    Visitor II
    May 16, 2024

    Hi, thankyou for your replay, I'm not able to select any other pin configuration, if I link PA15 to TIM2_ETR this is the only configuration possible from the menu. If I set PA15 as input i loose the connection to TIM2_ETR that is automatically changed to PA5.

     

    santulaz_0-1715843968979.png

     

    Super User
    May 16, 2024

    If you choose etr2 as clk , you see a pin as input in gpio -> this pin is your clk input now !

    just look, what cube shows you...you might choose another pin by remap, if possible, then this is the input.

    But you cannot choose any pin, you like !

    Super User
    May 16, 2024

    Ok, i just tried on a H743 here, cube giving me PA0 as ETR input (or PA5, or PA15 ).

    So you did everything ok, i think.

    Select one of them , the this is your etr-clk input (try PA5) .

    No put your 32k clk on this pin, and what happens ?

    Super User
    May 16, 2024

    Don't set Channel 1 to Output Compare.

    JW

    santulazAuthor
    Visitor II
    May 16, 2024

    it always count until 6 and it stop, I also change RTC module 3 times but the result is the same, oscillator stop working (voltage dorp to 0.3V), if i disconnect the oscillator from the board it restart wiht the sandard behavior.

     

    Channel 1  "output compare no output" is the only possibility that is given for this configuration

    santulaz_0-1715851579847.png

     

    Super User
    May 16, 2024

    >Channel 1  "output compare no output" is the only possibility that is given for this configuration

    no.

    set CC1 : disable :

    AScha3_0-1715867173606.png

     

    Super User
    May 16, 2024

    > Channel 1 "output compare no output" is the only possibility that is given for this configuration

    That might be OK, but what I see in registers is definitively not "no output".

    In particular CCER=1 means, that CH1 is enabled; and as in CCMR1 it is set to Output compare, given pin turns to output (TIM2_CH1 is shared with TIM2_ETR on PA15).

    I don't use Cube/CubeMX so can't tell how can you avoid this using Cube/CubeMX. It may be a bug in Cube/CubeMX.

    I generally recommend you to use register-based programming instead, but some here find that an extereme approach.

    JW

    santulazAuthor
    Visitor II
    May 16, 2024

    you are righ, i tested this configuration on both pins (PA5 and PA15), no changes, it reach a value of 7 and stops counting

    santulaz_0-1715869081209.png

     

    Super User
    May 16, 2024

    Ok, what you see on pin with scope ? clk signal ok ?

    +

    set counter period to some lower value for test, maybe 2000 .

    Super User
    May 16, 2024

    In particular CCER=1 means, that CH1 is enabled; and as in CCMR1 it is set to Output compare, given pin turns to output (TIM2_CH1 is shared with TIM2_ETR on PA15).

    I don't use Cube/CubeMX so can't tell how can you avoid this using Cube/CubeMX. It may be a bug in Cube/CubeMX.

    I generally recommend you to use register-based programming instead, but some here find that an extereme approach.

    JW

     

    PS. Maybe similar https://community.st.com/t5/stm32-mcus-boards-and-hardware/tim2-tim3-tim4-ert-mode-on-nucleo-h743zi2/td-p/676201