8

I am using the Atmel AT32UC3C2512C and looking into the datasheet there are two kinds of PWM modes: Center Aligned and Left Aligned.

I would like to know when one is supposed to use each one of these modes, and pros and cons of them.

mFeinstein
  • 4,293
  • 11
  • 45
  • 84

1 Answers1

10

PWM can be symmetric (center aligned) or asymmetric (rising edge / left aligned or falling edge / right aligned):

PWM types (source)

As mentioned in the above referenced Texas Instruments application note:

It has been shown that symmetric PWM signals generate fewer harmonics in the output currents and voltages

  • The advantage of symmetric PWM thus is better utilization of applied power, with less power wasted on undesired harmonics.
  • Disadvantage 1: Slightly more complicated PWM generation mechanism when using timer/counter overflows. It is simply easier to count down and reset-at-zero a timer determining duty cycle to change PWM state, and set (start) the timer based on another timer at the PWM frequency. This gives left aligned PWM.
  • Disadvantage 2: The best resolution available for duty cycle for a symmetric PWM is two clock ticks of the PWM timer/counter, as opposed to 1 clock tick for asymmetric

The first disadvantage may be moot as many modern microcontrollers have symmetric PWM mode built into their PWM modules, so the programmer does not need to do much extra.

For very harmonic-sensitive purposes, such as control of sensitive motors and actuators, the lower harmonic overhead of symmetric PWM is critical. Not so for heating or lighting purposes.


Unconfirmed:

There is one specific situation where apparently symmetric PWM is considered important - though I have not found definitive validation of this premise. This is when PWM is used for driving LEDs for a color graphical "advertorial / entertainment" display such as the big TV-type displays used at railway stations and other public places

It is surmised that the leading or trailing edges of all LEDs on such displays being synchronized causes some people to notice flicker in a moving visual far more than if the edges were to be offset as per intensity of each LED, as happens with symmetric PWM.

Anindo Ghosh
  • 50,188
  • 8
  • 103
  • 200
  • There can be effects (in both modes, depending on the exact implementation) when you change PWM setting (duty cycle, frequency) while running. Glitches or errors can be introduced, so it's worth reading up about how it's working and pausing to think about how you do it if the output is critical or glitches will be noticeable. – John U Aug 23 '13 at 09:41
  • Thanks for the headsup Jhon, but my MCU already have a built-in protection against PWM glitches (Control Registers double buffering and Write Protections) – mFeinstein Aug 23 '13 at 13:12
  • I believe 'symmetric' is also referred to as 'phase correct', because it doesn't make strange jumps in duty cycle when changing PWM value. – jippie Aug 23 '13 at 16:47
  • That's true @jippie, feel free to edit that in :-) – Anindo Ghosh Aug 23 '13 at 16:51
  • 1
    With regard to LED signs, I would expect that having all the lights switch at once (very rapid change in current) could cause a momentary supply-voltage transient. Staggering the switching would alleviate that problem. – supercat Aug 23 '13 at 22:21
  • @supercat Sounds logical. – Anindo Ghosh Aug 23 '13 at 22:22
  • Sounds logical...but I cant see how this relates to PWM...yes a symmetrical will help if the LEDs have different PWM values...but if all have the same (say worst case:white board) it's the same for symmetrical and asymmetrical...so I believe there is more to LED control than just PWM type, since systems are better designed when a worst case scenario is evaluated.... – mFeinstein Aug 25 '13 at 01:23
  • @AnindoGhosh does this has anything to do with H-Bridge control, like the deadband time for the upper and lower part of the circuit? – mFeinstein Aug 25 '13 at 17:12
  • @mFeinstein I am not sure I understand what you mean. Deadband timing is to do with shoot through prevention in a bridged configuration, while symmetric / asymmetric applies to a single PWM signal, whether driving a bridge, a switch, or anything else (or nothing). – Anindo Ghosh Aug 25 '13 at 17:16
  • Yes, I just wanted to know if one kind of PWM is better than the other to make the complementary outputs for motor control – mFeinstein Aug 25 '13 at 17:18
  • @mFeinstein If I were dealing with that requirement, I'd go with symmetric every time - it makes dead-banding trivial: Just keep the duty cycle of one half a fixed number of ticks smaller than the other. – Anindo Ghosh Aug 25 '13 at 18:11
  • @AnindoGhosh: It doesn't make dead-band timing quite trivial since one one must still ensure that whichever side's "on" time is increased will always written after the side whose "on" time is decreased. Still, H-bridge control with dead-band requires four edges per PWM cycle, something which a pair of symmetric outputs will naturally have and asymmetric outputs won't. – supercat Aug 25 '13 at 18:27
  • @mFeinstein: I've not seen the sorts of problems alluded to, so I can't comment on them. I would expect LEDs to generally be modulated at a rate significantly above the update rate. If one were to display a scrolling message of 75% red 25% green on a black background and it were modulated once each time the message moved, symmetric PWM would cause each illuminated pixel to appear as a yellow dot centered on a larger red dot; asymmetric PWM would cause the yellow dot to appear at the leading or trailing edge. – supercat Aug 25 '13 at 18:35
  • @mFeinstein: If one *wants* the dots in a scrolling display to remain identifiable as dots, it may be helpful to subject the rows of dots as a whole to a PWM pattern which is synchronized with the update rate and has a duty cycle of no more than 25%. (this naturally occurs with scanned multiplexed displays). For best results, though, such duty cycle should probably be independent of brightness (e.g. during each 16ms interval have each LED be off for 12ms and enable a 100Khz PWM for 4ms). – supercat Aug 25 '13 at 18:42