cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431RB Two PWMs with 180 degree phase shift

sshan.2
Associate II

I have configured the TIM1 with PWM CH1 and CH1N, with 62.KHz frequency .

I am getting the 180 degree phase shift for 50 % duty cycle .If i vary duty cycle to 30 % then CH1 =30% and CH1N will be 70 % and it is inverted .I need same duty cycle with 180 degree Phase on two PWM ports .

please can some one answer this how to achieve this ??

13 REPLIES 13

On the 'G4 you could use Asymmetric/Combined mode to arbitrarily phase-shift one or two waveforms, but for this particular application it's probably simpler to use plain PWM and center-aligned (up-down counting) mode.

JW

sshan.2
Associate II

can you please share the required STM32cube IDE PWM Setting links or documents to test this

I don't use CubeIDE.

Individual timer modes are described in the Timer chapter of Reference manual.

JW​

I believe he was referring to cubeMX

we dont need to firmware by ourselves, lets talk

@Community member​ was refferring to this i believe.

Now you could play with TIM1->CR 1 and TIM->CR2(complement) to get what you wanted.

0693W00000Y7s8nQAB.png

we dont need to firmware by ourselves, lets talk

Interested in this too.

But such configuration outputs signals to separate channels (TIM1_CH and TIM1_CH2N). Can they be coupled to protect outputs from occasional high levels on both leading to short circuit?

In other words is it possible to output 30% duty on two pins, 180 degrees phase-shifted and protected with deadtime insertion using TIM1?

> In other words is it possible to output 30% duty on two pins, 180 degrees phase-shifted and protected with deadtime insertion using TIM1?

No.

JW

Thank you for your fast reply.

And what are the closest means to implement this? HRTIM?

I don't know HRTIM, but I doubt there's anything like this, i.e. hardware enforcement of mutual exclusivity of outputs.

So the closest means may be to implement it so that you don't make software errors in setting up the two channels. Or adding the "mutual exclusive" hardware externally.

JW