HAL HRTIM How to Use

group HRTIM_How_To_Use

HRTIMER Main features

High resolution timer (HRTIM) peripheral essentially addresses digital power applications, such as switch mode power

supplies, that require high PWM switching frequencies. It can generate up to twelve signals and to handle a large

variety of input signals for control, synchronization or protection purposes. Its modular architecture makes

possible to address several conversion topologies and multiple parallel converters, with the possibility to

reconfigure them during run-time.

Main HRTIM features are listed below:

  • 7 timers (7x16 bits counters)

    • One master timer providing synchronization signals to the 6 timing units (timers A to F).

    • 6 timing units working either independently or coupled with the other timers, including the master timer.

  • 12 outputs that can be controlled by any timer (including the master timer). A total of 32 set and reset events are available per output.

  • 16 external events, available for any timing unit. External event global conditioning is

    common to all timing units but additional filtering capabilities can be customized at timing unit level.

  • 8 fault inputs allowing to disable the outputs in case of an abnormal operation.

  • Direct connections to built-in peripherals (Comparators, ADCs, DACs, general purpose timers).

  • External synchronization input/output.

  • Versatile output stage allowing to:

    • configure the output polarity,

    • configure the PWM idle and safe state levels,

    • insert a deadtime between 2 complementary PWM signals,

    • add a chopper modulation.

  • Burst mode controller that can take over the control of one or multiple timers in case of light-load operation.

How to use the HAL HRTIM driver

Initialization

HRTIM clock initialization

The HRTIM clock source must be enabled in the reset and clock control unit (RCC).

HRTIM I/O’s initialization

Alternate function configuration of the GPIO’s connected to the HRTIM inputs/outputs.

  • HRTIM inputs:

    • HRTIM_SYNCIN - synchronization input

    • HRTIM_EVTx - External events

    • HRTIM_FLTx - Fault inputs

  • HRTIM outputs:

    • HRTIM_SYNCOUT - synchronization output

    • HRTIM_CHxy - main HRTIM timer outputs

The HRTIM inputs are initialized first, prior to the HRTIM registers.

The HRTIM outputs must be initialized after the HRTIM control registers programming, and once the counters are

enabled. This is to ensure that the outputs states are correctly defined inside the HRTIM before passing the

control from the GPIO circuitry to the HRTIM.

Other peripherals initialization

As listed below, the HRTIM interacts with many of the MCU peripherals. It is not mandatory to have all of them

initialized to have the HRTIM operating.

  • Nested vectored interrupt controller (NVIC)

    • One interrupt vector per timer

    • One interrupt vector for HRTIM fault signaling

  • DMA controller

    • One DMA channel per timer

  • Comparators

    • Comparator output can be connected to an HRTIM external event or an HRTIM fault input.

  • ADCs

    • Analog to digital conversion can be triggered by the HRTIM. Reversely, ADC analog watchdogs can be

      connected to HRTIM external events.

  • DACs

    • Digital to analog conversion can be synchronized with HRTIM operation by means of HRTIM DAC triggers.

  • General purpose timers

    • GP-Timer’s output trigger can be connected to an HRTIM external event, or the HRTIM synchronization input

      or it can trigger the HRTIM registers update or the burst mode controller.

HRTIM initialization

First HAL_HRTIM_Init()

must be called to associate the physical HRTIM peripheral to the HRTIM handle. When

needed the

HAL_HRTIM_SetDMA()

function can be called to associate a DMA channel to a timer (including the master

timer).

Callback functions registration

The compilation flag USE_HAL_HRTIM_REGISTER_CALLBACKS when set to 1 allows the user to configure dynamically the

driver callbacks.

Use Function HAL_HRTIM_Register<Callback_name>() to register a callback.

It takes as parameters the HAL peripheral handle, and a pointer to the user callback function.

These functions allow to register following callbacks:

  • HRTIM DMA related callback functions registration:

  • HRTIM related callback functions registration:

  • Timers related callback functions:

  • Capture/compare related callback functions:

    • HAL_HRTIM_RegisterCompareMatchCallback()

      : Registered callback function is invoked when a compare match

      event is generated. This function takes the timer and the

      compare unit identifiers as input arguments.

    • HAL_HRTIM_RegisterCaptureCallback()

      : Registered callback function is invoked when a capture event

      is generated. This function takes the timer and the capture

      unit identifiers as input arguments.

  • HRTIM outputs related callback functions:

    • HAL_HRTIM_RegisterOutputSet_callback() : Registered callback function is invoked when the output transition from its INACTIVE to its ACTIVE level. This function

      takes HRTIM output identifier as input argument.

    • HAL_HRTIM_RegisterOutputReset_callback() : Registered callback function is invoked when the output

      transition from its ACTIVE to its INACTIVE level. This function

      takes HRTIM output identifier as input argument.

The table below maps the callback names to their default handlers and registration functions:

Callback name

Default value

Callback registration function

DMAHalfCallback

HAL_HRTIM_DMAHalfCallback

HAL_HRTIM_RegisterDMAHalfCallback

DMACpltCallback

HAL_HRTIM_DMACpltCallback

HAL_HRTIM_RegisterDMACpltCallback

DMAStopCallback

HAL_HRTIM_DMAStopCallback

HAL_HRTIM_RegisterDMAStopCallback

DMAErrorCallback

HAL_HRTIM_DMAErrorCallback

HAL_HRTIM_RegisterDMAErrorCallback

FaultCallback

HAL_HRTIM_FaultCallback

HAL_HRTIM_RegisterFaultCallback

SystemFaultCallback

HAL_HRTIM_SystemFaultCallback

HAL_HRTIM_RegisterSystemFaultCallback

BurstModePeriodCallback

HAL_HRTIM_BurstModePeriodCallback

HAL_HRTIM_RegisterBurstModePeriodCallback

UpdateCallback

HAL_HRTIM_UpdateCallback

HAL_HRTIM_RegisterUpdateCallback

RepetitionCallback

HAL_HRTIM_RepetitionCallback

HAL_HRTIM_RegisterRepetitionCallback

ResetCallback

HAL_HRTIM_ResetCallback

HAL_HRTIM_RegisterResetCallback

DelayedProtectionCallback

HAL_HRTIM_DelayedProtectionCallback

HAL_HRTIM_RegisterDelayedProtectionCallback

XbarOvrTriggerCallback

HAL_HRTIM_XbarOvrTriggerCallback

HAL_HRTIM_RegisterXbarOvrTriggerCallback

XbarOvrRearmDelayCallback

HAL_HRTIM_XbarOvrRearmDelayCallback

HAL_HRTIM_RegisterXbarOvrRearmDelayCallback

CompareMatchCallback

HAL_HRTIM_CompareMatchCallback

HAL_HRTIM_RegisterCompareMatchCallback

CaptureCallback

HAL_HRTIM_CaptureCallback

HAL_HRTIM_RegisterCaptureCallback

OutputSet_callback

HAL_HRTIM_OutputSet_callback

HAL_HRTIM_RegisterOutputSet_callback

OutputReset_callback

HAL_HRTIM_OutputReset_callback

HAL_HRTIM_RegisterOutputReset_callback

By default, after HAL_HRTIM_Init()

has been called, all interrupt callbacks are set to the corresponding weak

functions HAL_HRTIM_*Callback().

Callbacks can be registered in HAL_HRTIM_STATE_INIT state only.

When the compilation flag USE_HAL_HRTIM_REGISTER_CALLBACKS is set to 0 or not defined, the callback registration

feature is not available and all callbacks are set to the corresponding weak functions.

HRTIM configuration

This configuration step consists in configuring global HRTIM resources/features determining the overall HRTIM

peripheral behavior.

HRTIM global interrupts configuration

Interrupt sources for the whole HRTIM:

  • System fault and fault 1 to 6,

  • Burst mode period completed. Interrupt sources for a timer:

  • Compare 1 to 4 event (master timer an timing units),

  • Registers update (master timer an timing units),

  • Repetition event update (master timer an timing units),

  • Synchronization event (master timer only),

  • Delayed protection triggered (timing units only),

  • Counter reset or roll-over event (timing units only),

  • Output 1 and output 2 reset (timing units only),

  • Output 1 and output 2 set (timing units only),

  • Capture 1 and 2 events.

  • Crossbar override triggered.

  • Crossbar override rearm delay elapsed. The HRTIM global interrupt sources and the timer related interrupt sources to enable

    are specified by calling

    HAL_HRTIM_SetConfigInterrupts()

    . The HRTIM global interrupt

    sources are enabled from within

    HAL_HRTIM_SetConfigInterrupts()

    while timer related interrupts sources

    are enabled when the timer is started in interrupt mode (see

    HAL_HRTIM_TIM_Start_IT()).

HRTIM DMA configuration

DMA requests for a timer:

  • Compare 1 to 4 event (master timer an timing units),

  • Registers update (master timer an timing units),

  • Repetition event update (master timer an timing units),

  • Synchronization event (master timer only),

  • Delayed protection triggered (timing units only),

  • Counter reset or roll-over event (timing units only),

  • Output 1 and output 2 reset (timing units only),

  • Output 1 and output 2 set (timing units only),

  • Capture 1 and 2 events.

  • Crossbar override triggered.

  • Crossbar override rearm delay elapsed. The individual DMA requests are ORed into 7 channels as follows:

  • 1 channel for the master timer,

  • 1 channel per timing unit.

The handle of the DMA channel associated to a timer is registered in the HRTIM handle by calling HAL_HRTIM_SetDMA()

. The information needed to configure a DMA channel when a timer is started in DMA mode,

i.e. the DMA requests to enable the source address, the destination address and the size of the DMA transfer

are stored inside a configuration structure housed by the application. The pointer to the DMA configuration of

a timer is registered in the HRTIM handle by calling

HAL_HRTIM_SetConfigDMA()

. When the timer is started in

DMA mode, this pointer is used to recover information needed to enable the DMA request(s) and start the DMA

transfer.

HRTIM external events

The function HAL_HRTIM_EEV_SetConfig()

configures the global settings for an external event, including the

source, sensitivity, digital filter and fast mode.

Here are the key points:
  • Filter choice is limited to HAL_HRTIM_FDIV1 for external events 6 to 10 and 11 to 13.

  • Mode choice is limited to HAL_HRTIM_EEV_SYNCHRONOUS for 1 to 5 and 14 to 16.

  • Sampling Clock Frequency: The frequency of the sampling clock used for digital filtering (fEEVS) is

    determined by a programmable prescaler, which can be configured using

    HAL_HRTIM_EEV_SetPrescaler().

HRTIM Faults

The function HAL_HRTIM_FLT_SetConfig()

configures the global settings for a fault input, including the

source, polarity, and digital filter. The frequency of the sampling clock used for digital filtering (fFLTS)

is determined by a programmable prescaler, which can be configured using HAL_HRTIM_FLT_SetPrescaler().

HRTIM outputs

The function HAL_HRTIM_OUT_SetConfig()

configures an HRTIM output, including set and reset events,

polarity, and output levels (ACTIVE or INACTIVE) when the output is in IDLE or FAULT state. Outputs can be

paired for deadtime insertion by calling HAL_HRTIM_TIM_EnableDeadtime()

, which generates complementary

signals on the two outputs from a single reference PWM waveform.

HRTIM Synchronization

The HRTIM can act as a slave unit, synchronized with other internal or external hardware resources.

The synchronization input source is selected by calling

HAL_HRTIM_SetSynchroInputSource()

. You can choose

how a timer reacts to a synchronization event (counter reset, counter start, or both) by calling

HAL_HRTIM_TIM_SetSlaveMode().

The HRTIM can also act as a master unit to synchronize on-chip or off-chip resources. The event triggering a

pulse generation on the synchronization output and the pulse polarity are configured by calling

HAL_HRTIM_SetSynchroOutput().

ADC triggers

The HRTIM supports 10 independent triggers for both the regular and injected sequencers of the ADCs.

The function

HAL_HRTIM_SetADCSynchro()

allows you to select the source(s) of an ADC trigger. A post-scaling

unit allows reducing the ADC trigger rate, which can be adjusted by calling

HAL_HRTIM_SetADCPostscaler().

DAC triggers

The HRTIM offers DAC triggers, allowing DAC values to be updated synchronously with update events from the

master and/or slave timers. For each timer, you can select the DAC trigger output where the timer update event

is propagated by calling HAL_HRTIM_TIM_SetDACTrigger().

Each timing unit (Timer A..F) features two DAC trigger outputs for synchronizing a sawtooth wave generated by a

DAC with a PWM signal:

  • One trigger to reset the sawtooth.

  • Another trigger to decrease the DAC values.

Both triggers can be configured by calling HAL_HRTIM_TIM_SetDualChannelDACTriggers()

. Enable dual channel

DAC triggers by calling

HAL_HRTIM_TIM_EnableDualChannelDAC().

Timers configuration

The following steps customize the functioning of a timer. Some steps apply to both the master timer and timing

units, while others are specific to timing units (timers A..F).

Time base (master and timers A..F)

The function HAL_HRTIM_TIM_SetConfig()

handles the configuration of a timer. This function must be called

before any other timer-related configuration functions.

The timer configuration structure specifies:

  • Counter period

  • Repetition counter value

  • Prescaler value

  • Timer operating mode (continuous or single shot)

  • Counter mode (up or up-down)

Registers update (master and timers A..F)

Some timer configuration registers are shadowed with preload registers, allowing on-the-fly waveform

modifications without abnormal transients. Enable preload mode by calling

HAL_HRTIM_TIM_EnablePreload()

.

When enabled, write accesses to the timer’s configuration registers are done to the preload registers, which

are transferred to the active registers after an update request. Specify the update event source by calling HAL_HRTIM_TIM_SetUpdateSource()

.

The update request generation can be synchronized with an update event, on-chip sources (general-purpose

timers), or a DMA burst operation. The function HAL_HRTIM_TIM_SetUpdateGating()

allows to select one or the

other option the desired update request generation option.

Generate an update event by calling HAL_HRTIM_Update()

. Temporarily disable update event generation by

calling

HAL_HRTIM_TIM_DisablePreload() and re-enable it later by calling HAL_HRTIM_TIM_EnablePreload().

Combined external events (timers A..F)

External events can be combined and used for different purposes:

The source(s) of combined external event can be configured differently for each timing unit by calling HAL_HRTIM_TIM_SetCombinedEventSource().

Counter reset (timers A..F)

The timer’s counter can be reset before reaching the period value (variable frequency operation). The events

triggering the counter reset are specified by calling

HAL_HRTIM_TIM_SetResetSource()

. Note that counter can

be reset by software anytime by calling

HAL_HRTIM_TIM_Reset().

Compare units (master and timers A..F)

Compare match events can be used for various purposes:

Set the compare value of a compare unit by calling HAL_HRTIM_TIM_SetCompareValue().

Reserved compare units

Functioning mode

Concerned HAL function

CMP1 and/or CMP2 and/or CMP3

Interleaved mode

HAL_HRTIM_TIM_SetInterleavedMode()

CMP2

Triggered half mode

HAL_HRTIM_TIM_SetTriggeredHalfMode()

CMP4

Balanced idle mode

HAL_HRTIM_TIM_SetConfigDelayedProtection()

CMP1 or CMP3

Autodelayed mode

HAL_HRTIM_TIM_SetAutoDelayedMode()

CMP2

Dual channel DAC

HAL_HRTIM_TIM_EnableDualChannelDAC()

Capture units (timers A..F)

Specify the events triggering a capture by calling HAL_HRTIM_TIM_SetCaptureTrigger()

. Retrieve captured

information (capture value and direction) by calling

HAL_HRTIM_TIM_GetCapture().

Event filtering (timers A..F)

Apply specific filtering schemes (blanking or windowing) to external events used in a timing unit by calling HAL_HRTIM_TIM_SetEventFilter()

. Filter out events based on the number of occurrences using the external

event counter, configured by calling

HAL_HRTIM_TIM_SetEventCounter() and enabled by calling HAL_HRTIM_TIM_EnableEventCounter().

Fault filtering (timers A..F)

Filter out faults based on the number of occurrences using the fault counter, which allows the fault to be

considered only after a programmable number of occurrences (1 to 32). Configure the fault counter by calling

HAL_HRTIM_FLT_SetCounter().

Deadtime (timers A..F)

Insert deadtime to generate complementary signals on the two outputs from a single reference PWM waveform.

Configure rising and falling deadtime values and signs by calling

HAL_HRTIM_TIM_SetConfigDeadtime()

.

Enable deadtime by calling

HAL_HRTIM_TIM_EnableDeadtime()

. For functional safety, write-protect the

values or signs of the rising/falling deadtimes by calling

HAL_HRTIM_TIM_LockDeadtime()

. Additionally to regular deadtime mode two alternative deadtime options are available to handle situations where

the signals are independently defined. The desired deadtime mode is selected by calling

HAL_HRTIM_TIM_SetDeadtimeMode(). If not called, regular deadtime insertion mode applies (when enabled).

Specific modes

The HRTIM offers specific modes and features to offload the CPU and to address various conversion topologies.

Burst mode controller

The burst mode controller can take over the control of any of the 10 PWM outputs.

It is configured by calling HAL_HRTIM_SetConfigBurstMode(). The burst mode configuration consists of defining:

  • the source of the burst mode controller counter clock,

  • the number of periods during which output are forced to their INACTIVE level (idle period),

  • the burst repetition rate (period),

  • the events triggering the burst mode operation,

  • the burst mode prescaler (if the main HRTIM clock is selected as the burst mode clock).

    In this case the burst mode controller counter clock (fBRST) ranges from fHRTIM to fHRTIM / 32768.

The timer output programming for burst mode is handled by HAL_HRTIM_OUT_SetBurstMode()

. Following options

are proposed:

  • output isn’t affected by the burst mode operation,

  • output is immediately forced to its INACTIVE level every time during the burst idle period,

  • output is forced to its INACTIVE level after a deadtime (delayed entry) every time the burst idle period is

    entered. In that case deatime is specified by

    HAL_HRTIM_TIM_SetConfigDeadtime()

    and it must be enabled

    for the timing unit by calling

    HAL_HRTIM_TIM_EnableDeadtime().

During the burst mode operation, the timer counter clock can be maintained or stopped and kept in reset state

during the burst idle period.

HAL_HRTIM_TIM_SetBurstMode() allows to select one or the other option.

Interleaved modes

Interleaved modes automatically update the compare registers when a new period is programmed

(

HAL_HRTIM_TIM_SetPeriod()).

Select an interleaved mode by calling HAL_HRTIM_TIM_SetInterleavedMode():

  • Disabled,

  • Dual interleave (half-mode),

  • Triple interleaved,

  • Quad interleaved.

Push-pull mode

In push-pull mode, a timer’s outputs are alternately enabled and put in idle state to maintain balance between

the two PWM outputs. Enable push-pull mode by calling

HAL_HRTIM_TIM_EnablePushPull(). HAL_HRTIM_TIM_GetPushPullCurrentStatus()

can be called to know on which output the signal is currently active.

Note that both outputs must have identical waveforms for balanced operation (

HAL_HRTIM_OUT_SetConfig()

).

In push-pull mode,

HAL_HRTIM_TIM_SetPushPullAdcTrigger()

can be called to have the ADC triggers issued only

when output 1 (resp. outpu2) is active.

Auto delayed mode

Auto delayed mode allows an output to change upon a capture event with a programmable delay or after a timeout.

Compare unit 2 is associated with capture unit 1 and compare unit 4 is associated with capture unit 2.

auto delayed mode by calling HAL_HRTIM_TIM_SetAutoDelayedMode()

. Set compare values by calling

Configure

HAL_HRTIM_TIM_SetCompareValue().

The table below lists such constraints when autodelayed mode in enabled on compare unit 2:

Reserved capture/compare units

Autodelayed mode

CPT1

Enabled

CPT1 and CMP1

Enabled with timeout CMP1

CPT2 and CMP3

Enabled with timeout CMP3

The table below lists such constraints when autodelayed mode in enabled on compare unit 4:

Reserved capture/compare units

Autodelayed mode

CPT2

Enabled

CPT2 and CMP1

Enabled with timeout CMP1

CPT2 and CMP3

Enabled with timeout CMP3

Triggered-half mode

Enable triggered-half mode by calling HAL_HRTIM_TIM_SetTriggeredHalfMode()

. In this mode, the switching

period of the timing unit acting as the master converter is captured, divided by 2, and stored in the compare 2

register by hardware. The compare 2 event can then trigger a second timing unit managing the slave converter.

Chopper mode

When chopper mode is enabled, a programmable carrier waveform is superimposed on the active PWM signal.

Configure the high-frequency carrier signal parameters by calling

HAL_HRTIM_TIM_SetConfigChopper()

.

Enable chopper mode by calling

HAL_HRTIM_TIM_EnableChopper().

DMA Burst

The DMA burst mode is used to dynamically re-configure the HRTIM. The DMA burst operation is triggered by a

DMA request generated by the timer used as DMA burst source.

Typical sequence to configure and start a DMA burst:

  • Initialize the DMA channel of the timer used as the DMA burst source (HAL_DMA_Init()).

  • Configure the timer used as the DMA burst source (HAL_HRTIM_TIM_SetConfig().

  • Fill the memory buffer used to reconfigure the HRTIM registers.

  • Fill the DMA burst configuration structure: . Select the timer used as the DMA burst source. . Select the source of the DMA request triggering the DMA burst (e.g., HAL_HRTIM_DMA_UPDATE). . Select the HR-Timer register(s) to be written by the DMA.

  • Configure the DMA burst (HAL_HRTIM_SetConfigDMABurst()).

  • Initiate the DMA burst operation (HAL_HRTIM_StartDMABurst()).

  • Start the timer used as the DMA burst source (HAL_HRTIM_TIM_Start()).

The DMA burst operation starts when the timer used as DMA burst source generates a DMA request. The transfer

from the memory buffer to the HRTIM registers is then entirely managed by the HRTIM DMA burst controller.

A callback function is invoked upon completion.

The function HAL_HRTIM_TIM_SetUpdateGating()

allows to select how the registers are updated versus a DMA

burst operation when the preload mode is enabled (

HAL_HRTIM_TIM_EnablePreload()

). When the preload

mode is disabled, HRTIM registers are updated as soon as they are written by the DMA.

Delayed Protection

The HRTIM features specific protection schemes for resonant converters, allowing delayed shutdown of PWM

outputs either once the active pulse is completed (delayed idle mode) or once a push-pull period is completed

(balanced idle mode).

Protection is triggered by specific events (Events F or G for timers A, B, and C,

and events H or I for timers D, E, and F). Configure and enable delayed protection mode by calling

HAL_HRTIM_TIM_EnableDelayedProtection().

Delayed idle mode:

Delayed idle mode can be applied to a single output or both outputs. Configure it by calling HAL_HRTIM_TIM_SetConfigDelayedProtection().

To exit from delayed idle:

Balanced idle mode:

Before enabling balanced idle mode at the output level ( HAL_HRTIM_TIM_SetConfigDelayedProtection()):

To exit from Balanced idle: Assumption: protection was triggered while output 1 was active ( HAL_HRTIM_TIM_GetPushPullIdleStatus()

returns HAL_HRTIM_PUSHPULL_IDLE_OUT1_OUT2).

Initiate the re-start sequence for output 1 first and re-enable outputs (

HAL_HRTIM_OUT_Enable()

) when the

current push-pull status indicates the signal is applied on output 1

( HAL_HRTIM_TIM_GetPushPullCurrentStatus() returns HAL_HRTIM_PUSHPULL_CURRENT_OUT1_OUT2).

Crossbar override

It is possible to override the output crossbar programming and take over the output control to force a level

based on a fixed setting or based on a given external.

At timing unit level, the crossbar override is configured by calling HAL_HRTIM_TIM_SetConfigXbarOvr()

. Crossbar

override mode is entered when one of the configured triggers is active.

The crossbar override mode provides several options defined independently for each output by calling HAL_HRTIM_OUT_SetXbarOvrForceMode()

. When Force on event mode is selected, the event(s) forcing the output level

is(are) selected by calling

HAL_HRTIM_OUT_SetXbarOvrForcingEvents()

. When delayed fault operation is selected,

delay 1 and delay 2 can be configured by calling

HAL_HRTIM_TIM_SetXbarOvrDelay().

Once configured, the crossbar override can be enabled by calling HAL_HRTIM_TIM_EnableXbarOvr()

or disabled by

calling

HAL_HRTIM_TIM_DisableXbarOvr().

When the crossbar override operates in latched mode, crossbar override mode is maintained until a software

intervention to disengage it. This can be done when the triggering condition has disappeared by calling

HAL_HRTIM_TIM_RearmXbarOvr(). The function HAL_HRTIM_TIM_GetXbarOvrTriggerStatus()

can be called to check whether

the crossbar override mode can be rearmed.

It is also possible to have the DAC values updated synchronously with the crossbar override mode triggering

when dual channel DAC crossbar override is enabled. This is achieved by calling

HAL_HRTIM_TIM_EnableDualDACXbarOvr().

HRTIM waveform generation control

Enable/disable HRTIM outputs

HRTIM outputs can be enabled and disabled at any time by calling HAL_HRTIM_OUT_Enable() or HAL_HRTIM_OUT_Disable()

respectively. Both functions can control a single output or several outputs

simultaneously.

Start/stop Timers

The timers can be started and stopped at any time by calling HAL_HRTIM_TIM_Start*() or HAL_HRTIM_TIM_Stop*()

respectively. These functions can control a single timer or several timers simultaneously.

Three execution modes are proposed:

On-the-fly changes

Force output level

Force an HRTIM output to its ACTIVE or INACTIVE level by calling HAL_HRTIM_OUT_Set() or HAL_HRTIM_OUT_Reset() respectively.

Force registers update

When preload mode is enabled ( HAL_HRTIM_TIM_EnablePreload()

), force an immediate update of the registers by

calling

HAL_HRTIM_Update(). This can be done for several timers simultaneously.

Force counter reset

Force a reset of the counter for one or several timers simultaneously by calling HAL_HRTIM_TIM_Reset().

Force capture

Trigger a capture on a capture unit by calling HAL_HRTIM_TIM_Capture().

Trigger burst mode operation

When burst mode is enabled ( HAL_HRTIM_EnableBurstMode()

), start the burst mode operation immediately by

calling

HAL_HRTIM_StartBurstMode().

Swap outputs

Swap the timer’s outputs by calling HAL_HRTIM_TIM_EnableSwapMode()

, connecting output 1 signal to the

output 2 pin and vice versa.

Period change

To change the period of a PWM signal, use the function HAL_HRTIM_TIM_SetPeriod()

. The new period value is

applied based on the preload mode setting:

Duty cycle change

The function HAL_HRTIM_TIM_SetCompareValue()

is used to change the duty cycle of a PWM signal. The new

compare value is applied based on the preload mode setting:

Disable update request

When preload mode is enabled using HAL_HRTIM_TIM_EnablePreload()

, it is possible to temporarily disable

the transfer of data from preload registers to active registers by calling

HAL_HRTIM_DisableUpdate()

.

Call

HAL_HRTIM_EnableUpdate()

to re-enable this transfer later. This process allows to disable and

resume updates for multiple timers simultaneously.

To disable updates on both HRTIM instances simultaneously, you can send remote update disable requests using

the

HAL_HRTIM_DisableRemoteUpdate()

function. However, keep in mind that, by default, all remote update

disable requests are ignored. To allow these requests, you must first call the

HAL_HRTIM_EnableRemoteUpdateRequest() function.

Status and errors

Note

The Dual channel DAC trigger mode must not be used simultaneously with other modes using CMP2 (auto

delayed mode, interleaved and balanced idle modes).

Note

Some compare units can be reserved by the hardware and become unavailable for other purposes. The table below lists such constraints:

Note

When compare unit 2 or compare unit 4 operate in autodelayed mode, some capture/compare units are

reserved by the hardware and become unavailable for other purposes.

Note

The triggered-half mode must not be used simultaneously with other modes using CMP2 (dual channel DAC

trigger, interleaved and balanced idle modes).