The enduring simplicity of PWM DACs will always earn them a place in the designer’s cookbook, but slow response time and the problem of PWM ripple tend to limit their appeal and utility. The usual way of attenuating PWM ripple, an RC low pass filter, can never succeed in completely eliminating it, and only makes output settling time agonizingly slow if you try. Figure 1 shows a different approach, which can overcome these drawbacks – using a synchronous S&H (sample & hold).

Figure 1  S1’s sample-hold operation eliminates PWM ripple.

The Design Idea relies on the inherently periodic nature of PWM ripple, which makes it have exactly the same voltage at any synchronously chosen point in the VC1 waveform, as shown in Figure 2. Therefore, if VC1 is synchronously sampled, as by Figure 1’s analog switch S1 and transfer capacitance C2, then held (hence Sample-and-Hold) to produce output Vout as by C3, the result will be a smooth, ripple-free Vout regardless of how large the AC component at VC1 might be. This is illustrated in the plots of DAC dynamic behavior in Figure 2. 

Figure 2  DAC settles to 8-bit accuracy in under 15 PWM cycles.

Moreover, because synchronous sampling inherently eliminates ripple independent of how short the RC1 time constant may be, it follows that the RC1 product can be made quite short indeed. This can dramatically cut settling time, as in Figure 1, where RC1 = 100 µs = Tc = the PWM period, resulting in settling (to 8-bit precision) in less than 15·Tc = 1.5 ms for the example case. But of course, as with all good things, we know there must a limit. So the question becomes: How short can RC1 be made consistent with proper DAC function, and what design factors set that limit?

A closer look at the VC1 waveform suggests the answer: Vout is sampled, not from the average value of VC1, but from the the ripple maxima. Therefore:

Vout = VsTp/Tc + Vripple


Vripple = Vs(Tp/Tc)(1 – Tp/Tc) / (2·R(C1+C2)/Tc)

Summing this non-linear component with the DAC Vout function therefore makes the DAC transfer function nonlinear too, resulting in an integral nonlinearity (INL) error that, with the example circuit constants, can be as large as 8.3% of full-scale. For many applications, this much INL would be unacceptable. Fortunately, there’s a simple (software) fix: Numerical pre-emphasis of the DAC setting. For example, using the constants of Figure 1, where…

R(C1+C2) = 3/2·Tc

If we alter Tp

Tp′ = Tp(0.6 + 0.4·Tp/Tc) + 0.015·Tc

The Vripple term will disappear from Vout and 8-bit INL is restored.

Figure 3  INL Error caused by rectified ripple.

It’s worth mentioning the “optional” elements Vs and S2 which generate the RC1 input waveform from a precision reference (Vs), and thus avoid superimposing the noise and dodgy regulation often characteristic of logic power supplies (and therefore riding on the PWM logic signal) on Vout. Of course if the accuracy requirements of your application are sufficiently undemanding to make this unnecessary, they can be omitted, and R simply connected directly to the PWM signal.

Worth mentioning because, as I said at the outset, enduring simplicity is one of the main charms of PWM DACs!

Figure 4  DAC responses at three different output settings

Related articles:

W. Stephen Woodward is one of EDN's most prolific and innovative Design Ideas authors, with dozens of contributions to his credit.