Getting started with HRTIM

Revision as of 15:12, 17 November 2023 by Registered User (→‎Block diagram overview)

This article explains what WDG is and how to use it through examples.

1. What is a HRTIM ?

HRTIM stands for High Resolution Timer. HRTIM is a highly accurate timer which can generate complex waveforms such as PWM, phase-shifted, constant Ton... with highly very fine timing resolution (184 ps on the STM32G4 series). In

1.1. HRTIM modes

Up-counters can operate in three modes :

  • Continuous (also called Free-running) : it rolls over to zero when it exceeds the value
  • Non-retriggerable :
  • Retriggerable :

1.2. Block diagram overview

As we can see on the figure below, the HRTIM have a modular architecture. Let's have a look at each block :

HRTIM Block Diagram.png

  • Block 1 Timer :
  • Block 2 Crossbar :
  • Block 3 Output :
  • Block 4 Input :
  • Block 5 Interface :

2. Configure the HRTIM to generate a simple PWM

2.1. Objective

  • In this project, you will learn how to setup WWDG in STM32CubeIDE
  • How to Generate Code in STM32CubeIDE and use HAL functions
  • Create a simple application to test and periodically refresh the WWDG
  • Verify the correct functionality on toggling LED

2.2. Creating the project in STM32CubeIDE

  • File > New > STM32 Project in main panel.

create STM32CubeIDE project.png

2.3. Configure HRTIM

2.4. Generate project and edit main.c

The easiest way to generate the code is to save your current project : Ctrl + S

2.5. Compile and flash

  • Click on Build button Built.png
  • Click on Debug button (to run step by step) Debug.png
  • Or on Run button (to execute) Run.png


3. References



No categories assignedEdit