-
Notifications
You must be signed in to change notification settings - Fork 15
Description
[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)
![]() |
![]() |
|---|---|
![]() |
![]() |
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.
| Zoom around a half period switch point | Zoom around a constant duty region |
|---|---|
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
![]() |
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!











