Showing results for 
Search instead for 
Did you mean: 

Timer in one pulse mode

Associate III


I have a trigger ( the pink trace) who triggers one delay of 200µs with the help of the timer 3 ( a channel toggles each event, the red trace) . A IT is also generated . Another channel of this timer 3 is used to trigger a one pulse mode pwm with a 100µs period and a duty cycle of 50%. This is the green trace. But I would like to have this result for each pulse of the trigger signal( pink trace) . And it' do not !!



How can I rearm this PWM?  The file is  attached

Thanks for your help !

ST Employee

Hello @MichelM38

To make sure I understood your request, you want the TIM3 that's used in one pulse mode to be triggered at every rising edge of the trigger signal?


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.

Associate III

The tmr3 will trigger the tmr4 in one pulse mode. the tmr3 is used to delay the PWM and another signal. The tmr2 is used as an input capture ( later it will be used to determine the periode), the tmr3 is used to delay the PWM and another signal .

So the tmr2 on which the trigger signal is applied will launch the tmr3 which generate a delay of 80µs. At the end of this delay, tmr4 will be triggered for a pwm pulse in one pulse mode. the tmr3 is used to delay the PWM and another signal .

Senior II

You should reset counter in input capture callback too.

Like this

Associate III

It's already done, for the tmr3 and tmr4. And the result is not ok..

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)


if (htim == &htim2)


__HAL_TIM_SET_COUNTER(&htim3, 0);

HAL_TIM_OC_Start(&htim3, TIM_CHANNEL_2);

HAL_TIM_OC_Start(&htim3, TIM_CHANNEL_1);

__HAL_TIM_SET_COUNTER(&htim4, 0);

HAL_TIM_OnePulse_Start(&htim4, TIM_CHANNEL_1);





I looks like HAL_TIM_OnePulse_Start is missing the call to actually start the timer. Probably is a reason but I don't know what it is. I suspect the HAL channel state may also be busy. Try stopping the pulse before starting it.

HAL_TIM_OnePulse_Stop(&htim4, TIM_CHANNEL_1);

HAL_TIM_OnePulse_Start(&htim4, TIM_CHANNEL_1);


Or just ignore the HAL state stuff and start the timer directly:





If you feel a post has answered your question, please click "Accept as Solution".

time 2 won't use after first trigger?

it's require reset counter too.



I tried your suggestion. Now the pwm pulses with each trigger pulse. But it seems that it is the trigger signal applied to the input capture of tmr2 that starts the pwm, not the output capture of tmr3 whereas the trigger of pwm(tmr4) is normally the output comparison of tmr3.


Not sure I follow what you want to achieve. Perhaps clearly draw what signals you're trying to get and indicate what's different.

If you feel a post has answered your question, please click "Accept as Solution".

Also, if you can't accomplish what you want by clicking in CubeMX, it's better to avoid Cube/HAL entirely and program at register level.