Synchronize Timer 1 and Timer 8 on STM32F446RE
- November 26, 2020
- 5 replies
- 3600 views
Hi,
I'd like to run synchronous PWMs on TIM1 and TIM8 of an STM32F446RE. I use TIM2 to trigger both timers.
My setup:
Master: TIM2
- MSM bit is set
- TRGO = Enable bit (CNT_EN)
Slaves: TIM1 and TIM8
- Slave mode = Reset mode
- Trigger source = ITR1
I appended my CubeMX configuration and the according excerpts of the documantation I read (AN4013 & F466 reference manual) as screenshots to this post.
To start the timers I use the following code:
HAL_TIM_Base_Start(&htim2);
HAL_TIM_PWM_Start(&htim8, CH_LVL_1);
HAL_TIM_PWM_Start(&htim1, CH_LVL_2);I want to set the enable bits on TIM1 and TIM8 simultaneaously by the TRGO event of TIM2. The call of HAL_TIM_PWM_Start(...) should only enable the PWM output on the MCUs pins.
If I use the formerly shown procedure, unfortunatly both PWMs (on TIM1 and TIM8) are phase shiftet by 900 ns, so I assume the enable bits on TIM1 and TIM8 are set by software by the function HAL_TIM_PWM_Start(...).
Can you tell me what I am missing?
Thank you in advance.
