HAL HRTIM Overview

Introducing HRTIM

group HRTIM_Introduction

  • The HRTIM hardware abstraction layer (HAL) provides a set of APIs to interface with STM32 High-Resolution Timer (HRTIM).

  • The STM32 High-Resolution Timer (HRTIM) peripheral is primarily used for advanced power conversion and motor control applications, offering precise control of switching signals with high timing resolution and complex waveform generation.

  • The HRTIM HAL driver simplifies the configuration, initialization, and management of the high-resolution timer operations by supporting various modes such as polling, interrupt, and DMA, enabling flexible and efficient high-resolution timer control.

  • This abstraction layer ensures portability and ease of use across different STM32 series.

Module and files

The following diagram illustrates the HRTIM module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the HRTIM module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.


@startuml
<style>
componentDiagram {
   arrow {
      FontSize 8
   }
}
</style>

title HRTIM Software Component Diagram

package "HAL" {
    [HAL_RCC]
    [HAL_DMA]
    [HAL_HRTIM]
}

package "Low Layer" {
    [LL_HRTIM]
    [CMSIS]
    [HRTIM Interrupt Service Routine]
}

package "HW" {
    [STM32_HW]
}

[Appli] --> [HAL_HRTIM] : HAL HRTIM API
[Appli] <-- [HAL_HRTIM] : HAL HRTIM callbacks
[HAL_HRTIM] --> [LL_HRTIM] : LL HRTIM API
[HAL_HRTIM] -l-> [HAL_DMA] : Start or Abort DMA transfer
[HAL_HRTIM] -l-> [HAL_RCC] : HRTIM hardware instance\nclock enable
[HAL_DMA] -l-> [HAL_HRTIM] : DMA transfer callback
[HAL_HRTIM] <-- [HRTIM Interrupt Service Routine]
[LL_HRTIM] --> [CMSIS]:HRTIM registers definition
[STM32_HW] -u--> [HRTIM Interrupt Service Routine]: HRTIMx IRQ
[STM32_HW] <-u-- [LL_HRTIM] : HRTIM registers R/W
@enduml

Configuration table

The following table lists the configuration defines for the HAL HRTIM module, specifying their locations, default values, and descriptions:

group HRTIM_Configuration_Table

Configuration inside the HRTIM driver

Config defines

Where

Default value

Note

USE_HAL_HRTIM_MODULE

(1)

1

HAL HRTIM module is enabled

USE_HAL_HRTIM_MODULE

(1)

1

HAL HRTIM module is enabled

USE_HAL_HRTIM_DMA

(1)

1

Enable the DMA code inside HRTIM

USE_HAL_HRTIM_REGISTER_CALLBACKS

(1)

0

Enable register callback feature

USE_HAL_HRTIM_CLK_ENABLE_MODEL

(1)

HAL_CLK_ENABLE_NO

Enable the gating of the peripheral clock

USE_HAL_CHECK_PARAM

(1)

0

Enable run time parameter check

USE_HAL_CHECK_PROCESS_STATE

(1)

0

Enable atomic access to process state check

USE_ASSERT_DBG_PARAM

(2)

NONE

Enable the params assert

USE_ASSERT_DBG_STATE

(2)

NONE

Enable the state assert

USE_HAL_HRTIM_GLOBAL_CALLBACKS

(1)

1

Enable HRTIM global events callback functions support

USE_HAL_HRTIM_TIMER_CALLBACKS

(1)

1

Enable timer events callback functions support

USE_HAL_HRTIM_CAPTURE_COMPARE_CALLBACKS

(1)

1

Enable capture/compare unit events callback functions support

USE_HAL_HRTIM_OUTPUT_CALLBACKS

(1)

1

Enable HRTIM output events callback functions support

USE_HAL_HRTIM_XBAR_OVR_CALLBACKS

(1)

1

Enable crossbar override events callback functions support

(1) from hal_conf.h

(2) from PreProcessor env