Skip to main content
philipweiss
Associate II
October 26, 2017
Question

STM32L476RE: Can I have two timers (TIM2 and TIM3 for example) using the same external clock source?

  • October 26, 2017
  • 2 replies
  • 1930 views
Posted on October 27, 2017 at 00:54

I need to create two synchronized signals.  I'd like to use a PWM output for one, and to have the software create the second signal based on an interrupt from the same clock used to create the PWM output.

I'd like to use STM32CubeMX, but I couldn't find a way synchronize TIM2 and TIM3, or make them use the same external clock source.

    This topic has been closed for replies.

    2 replies

    waclawek.jan
    Super User
    October 27, 2017
    Posted on October 27, 2017 at 02:01

    I don't understand. Draw a diagram.

    JW

    philipweiss
    Associate II
    October 27, 2017
    Posted on October 27, 2017 at 02:31

    Thank you for your prompt reply.

    I hope that this helps:

    0690X00000608SrQAI.png
    S.Ma
    Principal
    October 27, 2017
    Posted on October 27, 2017 at 10:18

    You could use CH1 or both timer connected together to have a common clock source (pin)

    You might also use a single timer with long period and use 2 output channels, the one with slowest period as output compare and the other one using DMA to make burst of pulses during the same period.

    Uwe Bonnes
    Chief
    October 27, 2017
    Posted on October 27, 2017 at 11:13

    Easiest way is to connect the input signal to the TIXx_ETR or TIMx_TI1 pins of both timers.

    philipweiss
    Associate II
    October 27, 2017
    Posted on October 27, 2017 at 17:49

    Thank you.  I will verify that I have both pins available.