cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WL PWM start and stop issue

MichaelMor
Associate II

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?

1 REPLY 1
IIRHO.1
ST Employee

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.