2025-12-01 6:43 AM - edited 2025-12-01 6:46 AM
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:
System waits for an external trigger (e.g., from TIM3 via TRGO or physical pin).
Upon trigger, HRTIM Timer A and Timer B start.
They output exactly 3 PWM cycles.
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