Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new

Use a controller IC when a standard topology and control method fit, because it brings tested protection, soft start and gate drive in one part; use an analog op-amp compensator when you need a custom loop with no sampling delay; use digital control on a microcontroller when you need flexibility, communication, adaptive behaviour or many converters on one chip. The deciding numbers for digital control are its delay and its PWM resolution. A sampled loop with 1.5 sampling periods of delay loses 54° of phase at a 10 kHz crossover with 100 kHz sampling, and a 170 MHz timer at 200 kHz gives only 850 duty steps.

The idea: three ways to drive the same car

Think of the control loop as the driver of a car. A controller IC is a car with cruise control built in: you set the speed with a few resistors and capacitors, and it handles the common cases very well, with the safety features already fitted. An analog compensator is a driver you train yourself: an op-amp and a handful of parts, reacting continuously and instantly, but you add the safety features. Digital control is a driver who looks at the road through a camera that updates every few microseconds: very clever, able to learn and to talk to other systems, but always reacting to a picture that is slightly old.

That last point is the whole trade-off of digital control. The delay and the coarseness of its actions (the PWM resolution) are what this article puts numbers on.

What are the three options?

Controller IC Analog compensator Digital (MCU, DSP)
Loop Fixed method (voltage or peak current mode), external R and C set the compensator Type II or III network around an op-amp or the controller's error amplifier Difference equation in firmware
Protection, soft start Built in You add it You write it
Delay None to speak of None to speak of Sampling and computation, about 1–1.5 periods
Flexibility Low Medium High: adaptive gains, mode changes, telemetry
Parts One IC, few passives Op-amp, reference, network MCU, ADC front ends, gate drivers
Best for Standard DC-DC and flyback Custom analog loops, legacy designs Inverters, PFC, motor drives, multi-converter systems

Why does digital control lose phase margin?

A digital loop samples the error, computes, then updates the PWM. A common total delay is 1.5 sampling periods: one for computation and half for the PWM's zero-order hold. A pure delay TdT_d adds a phase lag of

φd=360∘⋅fc⋅Td\varphi_d = 360^\circ \cdot f_c \cdot T_d

With fs=100f_s = 100 kHz (Ts=10T_s = 10 µs) and Td=1.5 TsT_d = 1.5\,T_s:

Crossover fcf_c Phase lag
5 kHz 27°
10 kHz 54°

At fc=fs/10f_c = f_s/10, the delay alone eats most of a 60° phase margin target, so digital loops usually cross lower, or sample twice per period, or use a predictive update.

The phase of a buck's control-to-output transfer function at 100 kHz sampling, from the plant model of Voltecx's design.voltageLoop, with no delay and with 1.5 sampling periods of delay. The two curves part as the frequency rises: 27° apart at 5 kHz and 54° at 10 kHz (vertical lines), which is phase the compensator can no longer use.

On a whole converter the effect is easy to see. design.compare designs every method for the same 60° of phase margin on a 48 V to 12 V, 10 A buck at 200 kHz, and keeps a PI's gain margin at 6 dB or more. The analog Type III crosses at 20 kHz; the digital PI, with its 1.5 periods of delay, can only cross at 4.1 kHz.

The output of the 48 V to 12 V, 10 A buck for a load step from 5 A to 10 A, for the four control methods design.compare designs for 60° of phase margin, on the averaged model in Voltecx. Voltage mode with a Type III network dips 1.74 V and recovers in about 60 µs; the digital PI, crossing at only 4.1 kHz, dips 2.88 V and rings for longer.

What does PWM resolution do?

A digital PWM puts each edge on a timer count, so the duty can only take N=fclk/fswN = f_{clk}/f_{sw} values. With a 170 MHz timer clock at 200 kHz, N=850N = 850. In a buck from 48 V, one count moves the output by

ΔVout=VinN=48850=56 mV\Delta V_{out} = \frac{V_{in}}{N} = \frac{48}{850} = 56\ \text{mV}

which is 0.47 % of a 12 V output. If the ADC resolves the output more finely than one PWM step, the loop hunts between two duty values: a limit cycle. Two cures: a high-resolution PWM, whose sub-count edge step can be 150 ps on some MCUs (TI's F28379D data sheet gives this typical MEP step), giving 150 ps×200 kHz×48 V=1.4150\,\text{ps} \times 200\,\text{kHz} \times 48\ \text{V} = 1.4 mV per step; or enough integral gain and dither so that the average duty is right.

The output of the 48 V buck at 200 kHz, open loop, as the commanded duty cycle rises by three timer counts in fifths of a count, simulated in Voltecx with the pwm block's timer resolution. With 850 counts the output moves in 56 mV steps and ignores everything in between; with the 150 ps high-resolution step it follows the command smoothly, 11 mV per fifth of a count.

How do you choose?

  • Standard buck, boost or flyback, under a few hundred watts, no communication: a controller IC. Check that its control method suits your topology, for example peak current mode for a boost with an RHP zero.
  • A loop the ICs don't offer, but no need for software: an analog compensator, often around the error amplifier of a simple PWM controller.
  • Inverters, PFC, motor drives, grid-tied systems, or anything with a state machine, telemetry or adaptive control: digital. Budget the delay and PWM resolution first.

Common mistakes

  • Designing a digital loop as if it were analog. Add the 1–1.5 periods of delay to the model before you pick the crossover; otherwise the margin you designed for is not the margin you get.
  • Ignoring PWM resolution. If one timer count moves the output more than the ADC can see, the loop hunts. Compute Vin/NV_{in}/N and compare it with an ADC count at the output.
  • Choosing an IC whose control method does not fit. A voltage-mode controller on a boost with a low RHP zero leaves very little bandwidth; peak current mode suits it better.
  • Forgetting what the IC gives for free. Soft start, cycle-by-cycle current limit, UVLO and gate drive all have to be designed and tested again in an analog or digital solution.
  • Assuming digital is cheaper because it has fewer parts. The MCU, its ADC front ends and the firmware effort often cost more than a controller IC for a single converter.

How to do it in Voltecx

  • Compare control methods on your converter. design.compare (Design › Automate › Compare Topologies and Control) designs voltage mode with a Type III network, peak current mode with a Type II network (Ridley's model), average current mode with two PIs and a digital PI, all for the same phase margin, and simulates each through a load step on a buck, boost or buck-boost.
  • Controller ICs. The behavioural IC library includes a pwmController (peak-current-mode, UC384x type), a syncBuckController (voltage mode, LM5145 type) and a syncBoostController (peak current mode, LM5122 type). Place them with ic.place; each is a subsystem with named pins.
  • Analog compensators. The Voltage loop task (design.voltageLoop) gives a PI or a Type II or III transfer function; the opAmp IC model (with TL072, OPA2171 and TLV9062 presets) builds the network around a real op-amp's gain-bandwidth.
  • Digital. design.digitalize turns a loop design into a difference equation in your number format (Tustin, prewarped at the crossover, or matched poles and zeros). The pwm block takes the timer counts and an hrpwm step, and an ISR execution time, so the simulation shows the real delay and resolution. Code generation writes the C for the MCU.
  • In development: a choice of control implementation inside automatic design (digital firmware, an analog op-amp compensator or a controller IC).

See the design tools overview.

Frequently asked questions

Is digital control better than analog control for power supplies?

Not by itself. Digital control adds flexibility, communication and adaptive behaviour, but also delay and quantisation. For a standard DC-DC converter a controller IC is often simpler, cheaper and faster.

How much phase does a digital control delay cost?

360°⋅fc⋅Td360° \cdot f_c \cdot T_d. With 1.5 sampling periods of delay and crossover at a tenth of the sampling frequency, that is 54°.

What is a limit cycle in digital power control?

A steady oscillation between duty values that happens when the ADC resolves the output more finely than the PWM can adjust it. Higher PWM resolution, or integral gain with dither, removes it.

Can I simulate a controller IC's loop before I build it?

Yes, with a behavioural model of the IC that includes its error amplifier, ramp and current-sense path. It is not the vendor's transistor-level model, so check the data sheet's application circuit against it.