cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to setup a One-Pulse Mode Timer. The timer is resetting all the time.

RPG
Senior

Hi.

I am trying to configure a timer with PWM in one-pulse mode (TIM5) as slave of another timer that sends N pluses to trigger TIM5.

I am unable to do it could you give me a hand to understand what I am doing wrong?

TIM1 when started should triggers an specified amount of pulses. I thought I could use Repetition Counter but for now I am not getting any pulses.

I am using a STM32G474RE MCU.

To start the timers I use:

HAL_TIM_PWM_Start(&htim5, TIM_CHANNEL_4);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_5);

tim1.png

tim5.png

Thanks in advance,

Raúl Pérez Gómez

5 REPLIES 5
Issamos
Lead II

Hello @RPG 

Can you add the board /chip that you are using. Also, this video may help you.

Best regards.

II

RPG
Senior

Just edited the post to add the MCU.

I am using a STM32G474RE MCU.

Thanks for the help.

Oh yes I watched that video to start. But I cannot get it to work. And he is using the trigger on the TM1. I don't have a pin to trigger the timer. I though that would be enough to call HAL_TIM_Start function, or am I wrong? Maybe I am missing something I have to set before I call the start function? I would like to set the number of pulses TIM1 should trigger and then start it until it stops.

Issamos
Lead II

Than, those two groups (G1&G2) of exemples can help you to do the configuration you are looking for.

Best regards.

II

I see I am making a mistake... I should use HAL_TIM_OnePulse_Start instead of HAL_TIM_PWM_Start.

Let me try ...