Skip to main content
Yvo
Associate
March 11, 2021
Solved

Can STM32H743 (With TIM1/TIM8) control two 3-ph Inverters?

  • March 11, 2021
  • 10 replies
  • 2227 views

Hi everyone,

Thanks in advance for your time.

Im starting my first application in ST: a power converter controller.

I need to be able to control two three-phase inverters with SPWM modulation, for which I think STM32H743 is the microcontroller I need. It has (as many others) advanced control timers TIM1 and TIM8, but I have a doubt about them:

Can each of them generate THREE PWM signals phase-shifted 120º modulated by SPWM, PLUS THREE complementary, for a total of 6? (For example, TIM1_CH1, TIM1_CH1N, TIM2_CH2, TIM1_CH2N, TIM1_CH3, TIM1_CH3N). And same with TIM8 for another 6?

As far as I understood, each timer can only generate ONE pulsed signal in all of its channels AND its complementary on its CHX_N channels.

Any help, contact or guide will be appreciated since I'm a M.Sc. Student and this is for my master thesis.

Thank you!

This topic has been closed for replies.
Best answer by rpip.1

Yes TIM1 can generate 3  phase-shifted 120º pwm. complementary signal is produced by corresponding CHxN channel . PWM work in Upcounting mode , toggle mode, setting in OCxM. then set each CCRx to 1xa 2xa 3xa . for example ccr1 = 900 ccr2 = 600 ccr3 = 300 , then generate 3  phase-shifted 120º pwm. for modulated by SPWM , you can use dma to map a series CCRx to each CCRx register.

10 replies

Cristiana SCARAMEL
ST Employee
March 11, 2021

Hello @Yvory Sahjit García García​,

since your question is about STM32 MCU, I moved your thread from the topic PMMC to "STM32 MCUs Products".

"If you feel a post has answered your question, please click ""Accept as Solution"""
rpip.1
rpip.1Best answer
Associate II
March 12, 2021

Yes TIM1 can generate 3  phase-shifted 120º pwm. complementary signal is produced by corresponding CHxN channel . PWM work in Upcounting mode , toggle mode, setting in OCxM. then set each CCRx to 1xa 2xa 3xa . for example ccr1 = 900 ccr2 = 600 ccr3 = 300 , then generate 3  phase-shifted 120º pwm. for modulated by SPWM , you can use dma to map a series CCRx to each CCRx register.

Piranha
Principal III
March 14, 2021

Toggle mode only produces a signal with a constant 50% width, and that is not a PWM!

waclawek.jan
Super User
March 15, 2021

What is SPWM?

Show us the expected waveform, indicating what should be variable.

JW

Curtis B.
Associate III
March 15, 2021

I think he means Space Vector PWM. Can be done with one timer and 3 PWM channels...

waclawek.jan
Super User
March 16, 2021

> I think he means Space Vector PWM.

Okay, so that's just another way of saying "3 PWMs with the same period but independent width and phase".

> Can be done with one timer and 3 PWM channels...

How?

And what do you mean by "PWM channel" - a standard TIM capture-compare channel?

JW

@Curtis B.​ 

Yvo
YvoAuthor
Associate
March 16, 2021

Hi, all

@Community member​ , with SPWM I mean Sine-Pulsed Width Modulation (https://ieeexplore.ieee.org/abstract/document/5489272), the kind of modulation which varies its duty ratio following a sinusoidal function and which is the result of compairing an up-down carrier with a sinusoidal signal. If the same carrier is compared with three sinusoidals phase-shifted 120º, the result is a three-phase SPWM able to control a 3-phase power converter. The signals are presented in the following picture:

0693W000008x5FfQAI.pngI've found out that TIM1 and TIM8 are suitable exactly for that kind of modulation, since the counter does the carrier shape, and the comparators of each channel CCR1, CCR2 and CCR3 can be a sinusoidal function with an arbitrary amplitude and frequency.

Thank you all for your help!

Curtis B.
Associate III
March 16, 2021

Ok, my bad :D

@Community member​ : I use center aligned TIM1 with 3 PWM Generation channels. I have a few lines of code that determine the sector depending on the desired u_alpha, u_beta, and calculate the neccessary CCRx values.

waclawek.jan
Super User
March 16, 2021

What is sector?

Can you give me concrete numbers, content of ARR and CCRx? We are getting off-topic here so maybe starting a new thread or privately...

Thanks.

JW

waclawek.jan
Super User
March 16, 2021

> I mean Sine-Pulsed Width Modulation

OK so you basically want to use the PWM as a form of DAC. This does not require phase-shifted PWM pulses, then, unless I am missing something.

Precalculate the required values for CCRx for each period, put them into a table, and fill them into CCRx using DMA and the TIMx_DMAR mechanism. There should be an example for this in the examples in CubeH7, try to look there.

JW