cancel
Showing results for 
Search instead for 
Did you mean: 

Two PWM outputs, same period & polarity, 180 out of phase

pete23
Associate II
Posted on August 06, 2011 at 00:00

I'm using the STM32F103RCT6.  I need two PWM outputs, where the period and polarity of each is the same, but one output is 180� out of phase from the other.

 

A duty cycle change must affect both concurrently.  The complementary output configuration is close, but not quite.

I need to be able to do this:

0690X00000602PHQAY.bmp

Any ideas?

#stm32-pwm
5 REPLIES 5
donald2
Associate II
Posted on August 06, 2011 at 01:45

Errrm, isn't that really a wish for two in-phase PWM outputs, one with the opposite polarity.  The duty cycle of the second is the complement of the primary duty cycle.

There are several ways to synchronize the phases.  The most sophisticated (overkill for this simple task) is using the ''commutator'' ability -- PWM values can be sequentially pre-loaded into registers, and then activated simultaneously.  But with only two signals you have many simpler choices.

pete23
Associate II
Posted on August 11, 2011 at 01:26

If they were in phase with opposite polarity, when one output was 1, the other output would always be 0 (i.e. complementary outputs), dead-time aside.  I'm looking for a Push-Pull configuration.  See this post:

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fhow%20to%20generate%20pwm%20for%20push-pull%20converter&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE...

And this one:

http://www.cypress.com/?rID=35431

donald2
Associate II
Posted on August 12, 2011 at 00:26

You complement the duty cycle (100% - D%) and invert the polarity.

When the first output is 1%, the second output is 99%.  But inverted, so it looks like 1% but 180 degrees out of phase.

donald2
Associate II
Posted on August 12, 2011 at 08:54

To be clear, you need to use the phase-correct AKA center-aligned PWM mode (up/down counting).

You may want to enable the preload registers to get a synchronized change in duty cycle, although most applications won't care if there is a slight phase glitch with a change in duty cycle.

pete23
Associate II
Posted on August 12, 2011 at 22:58

That did the trick.  Thanks for your help!