Accurate, Fast Settling Analog Voltages from Digital PWM Signals

Linear Technology LTC2644 LTC2645 LTC3850

Introduction

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 digital-to-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.

Accurate, Fast Settling Analog Voltages from Digital PWM Signals
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 1 LSB of ripple, requiring a 1.2 Hz lowpass filter in the case of a 5 kHz 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.

Accurate, Fast Settling Analog Voltages from Digital PWM Signals
Figure 2. Improved PWM-to-Analog?

Improved PWM-to-Analog!

The LTC2644 and LTC2645 are dual and quad PWM to- voltage output DACs with internal 10 ppm/°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 (Figure 3).

Accurate, Fast Settling Analog Voltages from Digital PWM Signals
Figure 3. 4-Channel PWM-to-Analog

An internal 1.25 V reference sets the full-scale output to 2.5 V, 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.8 V FPGAs, 5 V microcontrollers, or any voltage between. DC accuracy specifications are excellent, with 5 mV offset, 0.8% maximum gain error, and 2.5 LSB (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 (1 LSB at 12 bits). The PWM frequency range is 30 Hz to 6.25 kHz 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.

Accurate, Fast Settling Analog Voltages from Digital PWM Signals
Figure 4. Margining Application

Conclusion

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.

linear.com