Skip to main content
RPG
Associate III
September 8, 2023
Question

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

  • September 8, 2023
  • 5 replies
  • 2656 views

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

This topic has been closed for replies.

5 replies

Issamos
Super User
September 8, 2023

Hello @RPG 

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

Best regards.

II

RPG
RPGAuthor
Associate III
September 8, 2023

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.

RPG
RPGAuthor
Associate III
September 8, 2023

Just edited the post to add the MCU.

I am using a STM32G474RE MCU.

Thanks for the help.

Issamos
Super User
September 8, 2023

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

Best regards.

II

RPG
RPGAuthor
Associate III
September 8, 2023

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

Let me try ...