S1119 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S11 · Lesson 19 · Digital control of converters

Sampling the output once per period, digital PWM resolution and the output steps it allows, limit cycles and how to avoid them, the delay budget, and dithering for extra resolution

A growing share of converters are controlled by a microcontroller or a dedicated digital controller rather than an op amp and a comparator. Digital control brings programmable compensation, telemetry, nonlinear tricks and easy multi-phase management. It also brings quantization in two places, the ADC that reads the output and the digital PWM that sets the duty cycle, and delay from sampling and computation. Get the resolutions in the wrong order and the output hunts endlessly between levels; ignore the delay and the phase margin vanishes.

  • The curve is the output voltage step a digital PWM can make, Vgfs/fclk, for a buck from 12 V switching at the slider's frequency, against the PWM counter's clock.
  • At 500 kHz and a 100 MHz clock the counter has only 200 steps per period: 60 mV per step at the output, coarser than many regulation specifications.
  • Higher switching frequencies make it worse, which is why fast digital controllers need hundreds of megahertz of effective clock, or tricks like dithering and delay-line PWM.

Predict

A digital buck from 12 V switches at 500 kHz with a 100 MHz PWM clock; its ADC resolves 10 mV at the output. What happens in steady state?

Name it

Sampling and delay

The controller samples the output once per switching period, often mid-pulse to avoid switching noise, computes a new duty cycle and loads it for the next period. The delay from sample to effect is the computation time Tc plus about half a period for the PWM's hold, so at crossover the loop loses

Δϕ=ωc(Tc+Ts/2)

of phase margin. Crossover is usually kept below fs/10 for this reason. The compensator itself is designed in the s-domain and mapped to a difference equation (S9 lesson 41's Tustin method) or designed directly in z.

Digital PWM resolution

A counter clocked at fclk can set the pulse width in steps of 1/fclk, so there are fclk/fs steps per period, log2⁡(fclk/fs) bits. For a buck each step moves the output by

ΔVDPWM=Vgfsfclk

Limit cycles

With integral action, the output can only settle where the ADC reads zero error. If no achievable PWM level falls inside that ADC bin, the loop toggles between levels forever. The no-limit-cycle conditions are a PWM step finer than the ADC step, ΔVDPWM<ΔVADC, and modest integral gain.

Dithering

Alternating the duty cycle between adjacent steps over a pattern of 2k periods averages to intermediate values, adding k bits of effective resolution at the cost of a small, slow ripple that the output filter removes.

Worked example

A buck makes 1.2 V from 12 V at 500 kHz with a 100 MHz DPWM clock. What output step does the DPWM allow, and what clock would get below a 10 mV ADC step?

Show the solution
  1. Steps per period. 100MHz500kHz=200 which is 7.6 bits.
  2. Output step. ΔV=12V200=60mV
  3. Clock for a 10 mV step. fclk=VgfsΔV=12×500 kHz10 mV=600MHz
  4. How it's done. Hybrid DPWMs combine a counter with a delay line to reach such effective clocks without a 600 MHz counter.

Answer the DPWM moves the output in 60 mV steps, and getting below 10 mV would take a 600 MHz clock.

Worked example

A digital loop samples once per 200 kHz period, takes 2 µs to compute, and crosses over at 20 kHz. How much phase does the delay cost?

Show the solution
  1. Total delay. Td=Tc+Ts/2=(2+2.5)μs=4.5μs
  2. Phase lost at crossover. ϕ=2π×20 kHz×4.5μs=0.565rad=32.4°
  3. What it means. A compensator designed for 60° in the analog world would be left with under 30°, so the delay must be included in the design, or the crossover lowered.

Answer the 4.5 µs delay costs 32.4° of phase at crossover.

Worked example

The 200-step DPWM above adds a 4-period dither pattern. What effective resolution results?

Show the solution
  1. Intermediate values. Four periods let the average duty take three intermediate values between adjacent steps: 2 more bits.
  2. Effective resolution. N=200×4=800ΔV=12V/800=15mV
  3. The cost. The dither leaves a small ripple at fs/4=500 kHz/4=125kHz well above the loop's crossover and attenuated by the LC filter.

Answer 800 effective steps (2 more bits), 15 mV per step at the output.

Check

A digital PWM counts at 200 MHz for a buck switching at 250 kHz from 48 V.

(a)

How many duty steps per period?

(b)

What output step does each give?

Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.

Check

A digital buck from 12 V at 200 kHz has an ADC step of 20 mV at the output.

(a)

What DPWM clock is needed to avoid limit cycles without dithering?

Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.

(b)

With a 100 MHz counter, how many bits of dithering would close the gap?

Check

A digital loop samples once per 200 kHz period, computes in 0.5 µs and crosses over at 20 kHz.

(a)

How much phase does the delay cost?

Check

A 200-step DPWM on a 48 V buck adds a dither pattern lasting 2 to the power 2 periods.

(a)

How many effective steps result?

(b)

What effective output step?

Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.

Check

A 100 MHz counter drives a PWM at 100 kHz.

(a)

How many bits of duty resolution is that?

Check

A loop samples at 100 kHz and computes in 3 µs. Its compensator was designed for 50° of margin ignoring delay, at a crossover of 100/10 kHz.

(a)

What margin remains?

Check

Why does a digitally controlled converter with an integrator need a DPWM finer than its ADC?

Check

A digital buck from g volts switches at f with a DPWM clock c, computes in T and crosses over at x (hertz).

Step 1

What output step does one DPWM count give?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Check

Write settle(target, dpwm_step, adc_step, ki, n): simulate an integrating controller over n periods. Each period the output is the duty count times dpwm_step; the ADC reports the error rounded to a multiple of adc_step; an accumulator adds ki times the reported error, and the count is the accumulator rounded to a whole number of dpwm_steps. Start from zero and return the number of distinct outputs over the last 50 periods.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why do digital converter controllers limit their crossover to a tenth of the switching frequency or less?

Practice

Keep practicing

9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.