Accurate, Fast Settling Analog Voltages from Digital PWM Signals


Pulse width modulation (PWM) is a common technique for generating analog voltages from a digital device such as a microcontroller or FPGA. Most microcontrollers have dedicated PWM generation peripherals built in, and it only takes a few lines of RTL code to generate a PWM signal from an FPGA. This is a simple, practical technique if the analog signal’s performance requirements are not too stringent, as only one output pin is required and the code overhead is very low when compared to a digitalto- analog converter (DAC) with an SPI or I2C interface. Figure 1 shows a typical application, with a digital output pin that is filtered to produce an analog voltage.

Figure 1. PWM-to-Analog
Figure 1. PWM-to-Analog

You don’t have to dig very deep to uncover the myriad deficiencies of this scheme. A 12-bit analog signal should ideally have less than 1LSB of ripple, requiring a 1.2Hz lowpass filter in the case of a 5kHz PWM signal. The impedance of the voltage output is determined by the filter resistor, which can be quite large if the filter capacitor is to be kept to a reasonable size. Thus the output must only drive a high impedance load. The slope (gain) of the PWM to analog transfer function is determined by the microcontroller’s (probably inaccurate) digital supply voltage. A more subtle effect is that mismatch between the digital output pin’s effective resistance to the supply in the high state, and resistance to ground in the low state must be small compared to the filter resistor’s value in order to maintain linearity. Finally, the PWM signal must be continuous in order to hold the output voltage at a constant value, which may present a problem if the processor is to be put into a low power shutdown state.

PWM-to-Analog Improved?

Figure 2 shows an attempt to remedy these shortcomings. An output buffer allows the use of a high impedance filter resistor while providing a low impedance analog output. The gain accuracy is improved by using an external CMOS buffer, powered by a precision reference such that the PWM signal swings between ground and an accurate high level. This circuit is serviceable, but the parts count is high and there is no way to improve on the 1.1 second settling time, and no way to “hold” the analog value without a continuous PWM signal.

Figure 2. Improved PWM-to-Analog?
Figure 2. Improved PWM-to-Analog?

Improved PWM-to-Analog!

The LTC2644 and LTC2645 are dual and quad PWMto- voltage output DACs with internal 10ppm/°C reference that provide true 8-, 10- or 12-bit performance from digital PWM signals. The LTC2644 and LTC2645 overcome these problems by directly measuring the duty cycle of the incoming PWM signal and sending the appropriate 8-, 10- or 12-bit code to a precision DAC at each rising edge.

An internal 1.25V reference sets the full-scale output to 2.5V, and an external reference can be used if a different full-scale output is required. A separate IOVCC pin sets the digital input level, allowing a direct connection to 1.8V FPGAs, 5V microcontrollers, or any voltage between. DC accuracy specifications are excellent, with 5mV offset, 0.8% maximum gain error, and 2.5LSB (12-bit) maximum INL. Output settling time is 8μs from the rising edge of the PWM input to within 0.024% of the final value (1LSB at 12 bits). The PWM frequency range is 30Hz to 6.25kHz for 12-bit versions.

Versatile Output Modes

Figure 4 shows a typical supply trim/margining application that takes advantage of yet another unique feature of the LTC2644. Tying IDLSEL high selects “sample/ hold” operation; outputs are high impedance at start-up (no margining), a continuous high level on the input causes the output to hold its value indefinitely, and a continuous low level puts the output into a high impedance state. Thus the supply can be trimmed once at power-up with a PWM burst followed by a high level. Pulling the PWM signal low allows the circuit to cleanly exit a margining operation. Tying IDLSEL to GND selects “transparent mode,” in which a continuous high level on the input sets the output to full-scale, and a continuous low level sets the output to zero-scale.

Figure 3. 4-Channel PWM-to-Analog
Figure 3. 4-Channel PWM-to-Analog

Figure 4. Margining Application
Figure 4. Margining Application


Don’t despair if you come face to face with the limitations of typical PWM to analog techniques. The LTC2645 makes it possible to produce accurate, fast-settling analog signals from pulse-width modulated digital outputs while maintaining low parts count and code simplicity.



Mark Thoren

Mark Thoren joined Linear Technology (now part of Analog Devices) in 2001 as an applications engineer supporting precision data converters. He’s since held various roles in mixed-signal applications including developing evaluation systems, training, technical publications, and customer support. Mark is now a systems engineer in ADI’s System Development Group, where he works on reference designs and the ADI University Program. Mark has a B.S. in agricultural mechanical engineering and an M.S. in electrical engineering, both from University of Maine, Orono.


Chad Steward