cancel
Showing results for 
Search instead for 
Did you mean: 

HELP with Burst Mode HRTIM

GiovanniL
Associate

 

Hi everyone,

I am working on an STM32G4 project using the HRTIM1 peripheral.

My goal is to generate a burst of exactly 3 PWM pulses on Timer A and Timer B simultaneously, triggered by an External Event (Sync Input / EEV).

The Goal:

  1. System waits for an external trigger (e.g., from TIM3 via TRGO or physical pin).

  2. Upon trigger, HRTIM Timer A and Timer B start.

  3. They output exactly 3 PWM cycles.

  4. They stop and wait for the next trigger (Single-Shot Retriggerable).

The Configuration:

I am using STM32CubeIDE and HAL, but I also tried direct register access.

  • Master Timer: Acts as a dummy/pass-through for synchronization.

  • Timer A & B:

    • Mode: Single-Shot Retriggerable.

    • Prescaler: Div1.

    • Period: 1000 ticks.

    • Repetition Counter: 2 (Targeting $N+1 = 3$ pulses).

    • Start on Sync: Enabled.

    • Reset on Sync: Enabled.

    • Preload Enable: Disabled (To force immediate register update).

The Problem:

Despite setting REPxR = 2, I consistently see only 1 pulse on the scope when the trigger arrives. It seems the timer resets and starts, but the Repetition Counter value is ignored or treated as 0 for the first run.

 

Any help will be appreciated

 

Thank you

1 REPLY 1
Imen.D
ST Employee

Hello @GiovanniL 

Did you set the repetition counter before enabling the timer?

After configuring the HRTIM and before enabling it or waiting for the external trigger, generate an update event to ensure the repetition counter is loaded. 

Check the repetition counter value during operation through the HRTIM debug registers.

STM32G4-WDG_TIMERS-High_Resolution_Timer_HRTIM.pdf

AN4539 HRTIM cookbook - Application note

STM32CubeG4/Projects/NUCLEO-G474RE/Examples/HRTIM/HRTIM_Basic_MultiplePWM at master · STMicroelectronics/STM32CubeG4 · GitHub

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen