cancel
Showing results for 
Search instead for 
Did you mean: 

HRTIMER Synchronize 4 independent instances

avieira95
Associate II

Is it possible to synchronize two separate pairs of HRTIMER channels using the HRTIMER Master?

My goal to is to synchronize HRTIMER_E with HRTIMER_C and HRTIMER_F with HRTIMER_A. Each HRTIMER pair needs to operate independently of each other.

The reason for this is as follows: HRTIMER_E1 and E2 control a resonant converter. A fault coming from COMP6 (hrtim_flt3) needs a blanking source, which can only come from HRTIMER_C, therefore these timers need to work in sync. HRTIMER_F1 and F2 control another resonant converter, where a fault coming COMP2 (hrtim_flt1) needs a blanking source that can only come from HRTIMER_A.

The two resonant converters work independently, so the syncing of the timer pairs needs to be independent.

A workaround is to use external event capture instead of the faults to keep the blanking source within the timers driving the converters. I like the faults because they can turn the outputs off in hardware.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello, 

If timer units have the same period and clock prescaler, starting the timers at the same time ensures they keep synchronized and roll-over simultaneously. To achieve this you need to enable them with the same register access or use the HAL as bellow:

HAL_HRTIM_WaveformCounterStart(&hhrtim1, HRTIM_TIMERID_TIMER_A | HRTIM_TIMERID_TIMER_F);

You may use also the Master timer to keep timer units roll-over/reset at the same time. For this you need to declare an event coming from Master timer (Master timer period or compare for instance) as a reset root for the target timers.

 

Best regards.

View solution in original post

2 REPLIES 2

Hello, 

If timer units have the same period and clock prescaler, starting the timers at the same time ensures they keep synchronized and roll-over simultaneously. To achieve this you need to enable them with the same register access or use the HAL as bellow:

HAL_HRTIM_WaveformCounterStart(&hhrtim1, HRTIM_TIMERID_TIMER_A | HRTIM_TIMERID_TIMER_F);

You may use also the Master timer to keep timer units roll-over/reset at the same time. For this you need to declare an event coming from Master timer (Master timer period or compare for instance) as a reset root for the target timers.

 

Best regards.

Hello,

Note that some master events can be used to reset the counters of the timing units (period, compare match 1..4). 

The counter reset events are defined in the  ResetTrigger fied of the HRTIM_TimerCfgTypeDef structure. It it configured within the HAL_HRTIM_WaveformTimerConfig function.

Best regards.