Author Topic: STM32G4 3Phase HRTIM Programming  (Read 1597 times)

0 Members and 1 Guest are viewing this topic.

Offline epenneTopic starter

  • Newbie
  • Posts: 3
  • Country: us
STM32G4 3Phase HRTIM Programming
« on: May 20, 2026, 04:26:40 pm »
Hello!

I have an STM32G474QET6 which I am using as a 3-phase + complement generator. I need to maintain deadtime, and freely vary the frequency and duty cycle of the PWM output throughout the duration of the PWM "shot". Frequency and duty cycle are defined as arrays uploaded over homebrew SCPI commands by a human user. Previously I used an STM32L4 for this purpose via direct upload of ARR, CCR (calculated via off-board python script simulating timer behavior) to each timer's register + complement register on a PeriodElapsed callback from the master timer. As far as I can tell, this is a reasonably standard way to do this sort of thing.

Unfortunately, the lack of preload of timers on the L4 and the lack of gated outputs demanded that I redesign the device to tackle some unclean PWM output behavior. I selected the STM32G4 due to the fact it has HRTIM. I underestimated the complexity of using HRTIM devices and at the moment suffer from a bit of paralysis in selecting the best path forward for programming this behavior on my new STM.

What is the most straight-forward way to maintain this functionality on an STM32G4? Should I forget about HRTIM and simply use the advanced timer complementary outputs? Which mode HRTIM should I be using? Does anyone have a similar project they would be willing to share?

Thank you in advance, and my apologies if I didn't provide enough specifics. I am happy to provide examples of my previous work on the L4 to clarify where needed.
 

Offline Hiemal

  • Regular Contributor
  • *
  • Posts: 101
  • Country: us
Re: STM32G4 3Phase HRTIM Programming
« Reply #1 on: May 21, 2026, 01:18:10 am »
https://www.st.com/resource/en/application_note/an4539-hrtim-cookbook-stmicroelectronics.pdf

This is a really good starting point for using the HRTimer.

There's no real "straightforward" way to use it, you just have to prod through the reference manual and understand what and how everything works.




 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->