cancel
Showing results for 
Search instead for 
Did you mean: 

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

Nsg1987
Senior

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

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.

View solution in original post

1 REPLY 1
Sarra.S
ST Employee

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.