RM0440
26.3.6
Up-down counting mode
The HRTIM is natively designed with up-counters. It offers however an operating mode with
up-down counters, also called center-aligned mode.
This mode is enabled using the UDM bit in the HRTIM_TIMxCR2 register. This bit must not
be changed once the timer is operating (TxEN bit set). It is only available for the TIMA..F.
The master timer only works in up-counting mode.
Not all HRTIM features are supported in up-down counting. This section details the
functional differences versus up-counting mode.
The period in HRTIM_PERxR must be preloaded (or static) in up-down mode. It can be
updated only on period event or on counter reset.
The set/reset crossbar programming differs as follows:
The events coming from the timing units are setting/resetting the outputs depending on the
counter up/down direction:
•
If the event is enabled in the HRTIM_SETxyR register, it sets the output during up-
counting and reset it during down-counting.
•
If the event is enabled in the HRTIM_RSTxyR register, it resets the output during up-
counting and set it during down-counting.
•
If the events are enabled both in HRTIM_SETxyR and HRTIM_RSTxyR registers, the
output toggles.
This applies to :
–
–
–
The
Figure 202
The timing unit: period, compare 1..4, register update (6 events)
The master timer: period, compare 1..4, HRTIM synchronization (6 events)
All other timing units (e.g. timer B..F for timer A): TIMEVNT1..9 (9 events
described in
Table
209)
below shows how to generate basic waveforms.
Figure 202. Basic symmetric waveform in up-down counting mode
Counter
CMP4
CMP3
CMP2
CMP1
Set on CMP1
HRTIM_CHx1
Set on CMP1
Reset on CMP2
HRTIM_CHx2
RM0440 Rev 1
High-resolution timer (HRTIM)
MSv45797V2
835/2083
1040
Need help?
Do you have a question about the STM32G4 Series and is the answer not in the manual?