cancel
Showing results for 
Search instead for 
Did you mean: 

How to start all channels in a timer simultaneously under STM32Cube HAL

Hz Lin
Associate II

This should be a simple use case but to my surprise it does not seems obvious how to do it. Say I have 3 PWM channels in the same timer, how do I turn them on simultaneously?

If I do 

  if (HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1) != HAL_OK) Error_Handler();
  if (HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_2) != HAL_OK) Error_Handler();
There could be delay between the two steps. Is there a model where I can
1) Enable PWM CH1, 2) Enable PWM CH2, 3) start timer
 
What is the proper way to achieve this?
 
1 REPLY 1
MasterT
Lead

Configure timer in Slave mode: Trigger mode
The counter can start in response to an event on a selected input.
In the following example, the upcounter starts in response to a rising edge on TI2 input:

Details in Reference Manual for uCPU