Skip to main content
Nsg1987
Associate III
August 2, 2023
Solved

How to provide delay for PWM generated with TIM8 in reset mode STM32G474

  • August 2, 2023
  • 1 reply
  • 1376 views

Hello,

TIMER8 is configured with Reset Mode. where, external pulse is given to TIM8_ETR (PA0) and timer is configured in reset mode as follows.

Nsg1987_0-1690956461270.png

Nsg1987_1-1690956483467.png

The timer pulses are synchronized with the external signal and it works fine.

Now, I want to provide delay after sync with external pulse. i.e. the timer PWM should start after few microseconds.

Is there any way to provide delay after sync (not keeping controller busy in the delay)?

Thanks,

Nikhil

 

    This topic has been closed for replies.
    Best answer by Sarra.S

    Hello @Nsg1987

    One way is to configure one of the timer's output compare channels to generate an interrupt after a certain delay. In the interrupt handler, you can start the PWM output, in this case, the delay is the number of timer counts to wait before the PWM.

    Another approach is to use DWT for delay loops 

    1 reply

    Sarra.SBest answer
    ST Employee
    August 2, 2023

    Hello @Nsg1987

    One way is to configure one of the timer's output compare channels to generate an interrupt after a certain delay. In the interrupt handler, you can start the PWM output, in this case, the delay is the number of timer counts to wait before the PWM.

    Another approach is to use DWT for delay loops 

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.