Skip to main content
Associate II
August 2, 2023
Question

STM32WL PWM start and stop issue

  • August 2, 2023
  • 1 reply
  • 1465 views

Hi All,

I've configured TIM1 and TIM2 of my board (STM32WL55JC1) CH1 of both TIM to PWM output which is synchronized by output compare of TIM1 CH2, its working well for the first run then I stop PWM for 5 minutes by following commands:
HAL_TIM_OC_Stop(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Stop(&htim2, TIM_CHANNEL_1);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_1);


And turn on again via the following commands:
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
HAL_TIM_OC_Start(&htim1, TIM_CHANNEL_2);

But when I run PWM again they don't sync anymore (see following picture from first run and after stop and start )
Any ideas how to stop PWM and start and they will be sync again?

This topic has been closed for replies.

1 reply

IIRHO.1
ST Employee
August 2, 2023

Hello @MichaelMor and welcome to ST Community.

I suggest you to:

  1. stop the PWM outputs of TIM1 CH1 and TIM2 CH1 and then stop TIM1 CH2 (output compare) .
  2. start TIM1 CH2 (output compare) and then start the PWM outputs of TIM1 CH1 and TIM2 CH1.

This may ensure that the synchronization signal is active before the PWM outputs are started.

Best Regards.

Issam

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.