2022-11-08 03:35 AM
Hello,
I try to synchronise 6 PWM outputs for an BLDC controller.
I use 3 timers :
My target is STM32F446RET6 and I'm using STM32CubeIDE.
I read that I add to use master/slave mode. I'm not sure it is the best way, but I configured TIM2 (slave) as follow :
I chose TIM1 for my master timer :
For now, the PWM outputs don't start.
I think I'm missing something. For example I chose ITR1 but I can't find in datasheet where does it come from.
Thanks for your help,
Best regards,
Valentin
Solved! Go to Solution.
2022-11-09 12:35 AM
Thanks JW, it helped me. Now it is working only using CubeMX.
Here is the configuration of the master timer :
Configuration of the slave timer :
And we have to start both timers :
HAL_TIM_OC_Start(&htim4, TIM_CHANNEL_1); // master timer
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4); // slave timer
2022-11-08 03:41 AM
Read the TIM chapter in RM.
If clicking in CubeMX does not bring you success, ditch Cube and write your own program.
JW
2022-11-09 12:35 AM
Thanks JW, it helped me. Now it is working only using CubeMX.
Here is the configuration of the master timer :
Configuration of the slave timer :
And we have to start both timers :
HAL_TIM_OC_Start(&htim4, TIM_CHANNEL_1); // master timer
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4); // slave timer