STM32WL PWM start and stop issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-08-01 11:20 PM
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?
- Labels:
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-08-02 5:28 AM
Hello @MichaelMor and welcome to ST Community.
I suggest you to:
- stop the PWM outputs of TIM1 CH1 and TIM2 CH1 and then stop TIM1 CH2 (output compare) .
- 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.
