Skip to content

[HRTIM ?] PWM glitches when using extreme duty cycle values 0.0 and 1.0 #144

@pierre-haessig

Description

@pierre-haessig

[HRTIM ?] PWM glitches when using extreme duty cycle values 0.0 and 1.0

Nov-Dec 2025

Using the Ownverter 1.1 board, with 1.0 Power API code, there are glitches when using duty cycle values equal or close to 0.0 or 1.0.

Here are two cases, with slightly different symptoms. Both were created using three-phase islanded inverter application https://github.com/pierre-haessig/ownverter-islanded/tree/completed (using the completed branch, since main is the student version with a few blanks to be filled.)

  • sinusoidal duty cycles PWM
  • square wave modulation

In all cases, experimental conditions are: three-phase inverter connected through an inductive filter (630 µF) to either a balanced R=10Ω load or R+L load (L=76 mH).

In all cases, the control task period is 0.1 ms = 100 µs (10 kHz)

Sinusoidal duty cycles PWM

In this application, with pure R load, the duty cycles are computed as:

duty_a = duty_offset + duty_amplitude * ot_sin(v_angle);
duty_b = duty_offset + duty_amplitude * ot_sin(v_angle - 2.0/3.0*PI);
duty_c = duty_offset + duty_amplitude * ot_sin(v_angle - 4.0/3.0*PI);

with duty_offset set to 0.5 and duty_amplitude set to 0.5, so that the duties reach 0 or 1 once per electric period (50 Hz/20 ms).

Here are the resulting oscilloscope captures, with incremental zoom around the top of the sinusoid:

  • yellow-(C1): inverter voltage (phase to PGND or phase to Neutral, I don't remember)
  • pink (C2): current through load
  • green and cyan (C3, C4): swiching signals (CHA1 and CHA2 pins)
Ownverter_islanded_sine_duty-glitch_2025-11-10 Ownverter_islanded_sine_duty-glitch_2025-11-10-zoom1
Ownverter_islanded_sine_duty-glitch_2025-11-10-zoom2 Ownverter_islanded_sine_duty-glitch_2025-11-10-zoom3

Observations:

  • the sinusoidal current is heavily perturbed 6 times per period, in fact each time one of the three phases has its duty cycle close to 0 or 1.
  • zooming to the top of the sinusoid, we see that the glitches corresponds to undue switchings while the PWM output should stay constant.
  • the switchings happen at integer multiple of the control period (100 µs), so that they are linked to calls to setDutyCycle, with changing values of duty

Square wave modulation

The square wave modulation is done by setting the duty cycle to 0.0 or 1.0 on appropriate half periods:

if (square_wave) {
    if (v_angle <= PI) duty_a = 1.0;
    else duty_a = 0.0;
    if (ot_modulo_2pi(v_angle - 2.0/3.0*PI) <= PI) duty_b = 1.0;
    else duty_b = 0.0;
    if (ot_modulo_2pi(v_angle - 4.0/3.0*PI) <= PI) duty_c = 1.0;
    else duty_c = 0.0;
}

The resulting oscilloscope captures are obtained here with a pure R load (still with L filter, so that L/R = 63 µs).

Results are even more suprising than with sine PWM.

Ownverter_islanded_square_duty-glitch_2025-11-10

Zoom around a half period switch point Zoom around a constant duty region
Ownverter_islanded_square_duty-glitch_2025-11-10_zoom-a1 Ownverter_islanded_square_duty-glitch_2025-11-10-zoom-b1
Ownverter_islanded_square_duty-glitch_2025-11-10_zoom-a2
Ownverter_islanded_square_duty-glitch_2025-11-10_zoom-a3 Ownverter_islanded_square_duty-glitch_2025-11-10-zoom-b2
Ownverter_islanded_square_duty-glitch_2025-11-10_zoom-a4 Ownverter_islanded_square_duty-glitch_2025-11-10-zoom-b3

Observations:

  • despite the fact that the duty is kept constant, there almost are periodic glitches (every 300 to 400 µs)
    • it doesn't seem periodic with the control task
  • even more surprising, no glitch is visible on the PWM output (CHA1 and CHA2 pins) which are constant!

Metadata

Metadata

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions