How Microcontroller On-Chip DACs Generate Precision Analog Signals

Some 32-bit microcontrollers have on-chip digital-to-analog converters (DACs) for frequency or voltage generation. For many applications, this configuration not only provides more functionality, but also saves board space. However, these applications may require dedicated DAC functionality not available in the microcontroller.

Author: Bill Giovino

Some 32-bit microcontrollers have on-chip digital-to-analog converters (DACs) for frequency or voltage generation. For many applications, this configuration not only provides more functionality, but also saves board space. However, these applications may require dedicated DAC functionality not available in the microcontroller.

This article begins by discussing the capabilities and limitations of microcontroller on-chip DACs, then presents examples of high-precision external DAC solutions, and finally shows how they can be used to generate precision analog signals.

How the On-Chip DAC Works

To enable designers to generate custom analog signals, microcontroller manufacturers have begun adding on-chip DAC peripherals to microcontrollers. These units can be used to generate precision voltages, as well as custom waveforms including sine and triangle waves. In addition, the DAC can also be used for speech synthesis.

The output voltage produced by the DAC can be as low as 0 volts or as high as the DAC’s analog reference voltage. The voltage is proportional to the digital value in the DAC data register, and the accuracy depends on the resolution of the DAC. For example, if the resolution of the DAC is 8 bits and the reference voltage is 5 volts, the 1 LSB accuracy of the DAC is 5/255 = 0.0196 volts. Therefore, ideally, if the 8-bit DAC data register contains 01h, the DAC output would be equivalent to 1 LSB or 0.0196 volts. If the 8-bit DAC data register contains the value F1h (241), the output of an ideal DAC would be 4.7236 volts. Ideally, if 01h is added to the DAC data register, the output voltage value should increase by 1 LSB.

Of course, like any analog circuit, there is no ideal DAC. The difference between the DAC output value and the ideal value of the data register is called the differential nonlinearity (DNL) error and is measured in LSBs. For example, a typical microcontroller DAC might specify a DNL of ±2 LSB.

In addition, the DAC suffers from linear gain error, which is measured as a percentage increase to the ideal output, typically 0.5% on the output voltage.

For an ideal DAC, the plot of the output value versus the contents of the DAC data register would be a straight line. For an actual DAC, it will also be a straight line by adding the linearity error caused by the variation of the DAC circuit parameters. In reality, this line is not really a straight line, but bends outward to form a nonlinear curve. This nonlinearity is also a result of voltage and temperature changes in the DAC circuit. Such nonlinear errors are called integral nonlinear (INL) errors. For microcontroller DACs, this error can be ±4 LSB or more.

When generating frequencies, the fastest output frequency of the microcontroller DAC is limited to the microcontroller’s CPU frequency.

All DACs require an accurate reference voltage to provide precision analog signals. On newer microcontrollers, the DAC reference voltage is usually derived from a dedicated analog reference pin. This analog reference voltage inside the microcontroller is kept separate from the internal digital logic to minimize power supply ripple. However, high-speed digital logic may cause some small disturbances. While DAC peripherals are less susceptible to power supply ripple when generating sine waves, this ripple can be noticeable when a stable and accurate output voltage is required, or when generating synthetic speech or musical tones.

While using a higher reference voltage minimizes the effects of power supply ripple, it also prevents the DAC from producing smaller voltages, while also reducing the accuracy of the DAC by 1 LSB.

Single-Chip External DAC for Small Signals

The DAC peripheral on most microcontrollers provides sufficient accuracy for common applications. However, there are situations where extreme precision and/or speed is required, and the use of an external DAC may be necessary.

Texas Instruments has a range of external DACs that can generate analog signals for a variety of design problems. For example, if you are running out of board space, you can use the DAC80508MYZFT 16-bit DAC, which is very small, measuring only 2.4 x 2.4 mm, in a DSBGA package. The DAC has eight outputs and can interface with most microcontrollers via an SPI interface with clock rates up to 50 megahertz (MHz) (Figure 1).

How Microcontroller On-Chip DACs Generate Precision Analog Signals
Figure 1: The DAC80508 can be connected to most microcontrollers via the SPI interface and has eight identical analog output channels. (Image credit: Texas Instruments)

The DAC80508 can use either an external analog reference or the DAC’s digital supply voltage to generate its own 2.5 volt internal reference with an accuracy of ±5 mV. The reference voltage drift is as low as two parts per million per degree Celsius (ppm/°C). This drift value provides a highly stable reference voltage over a temperature range of -40°C to +125°C. Alternatively, the reference voltage can be divided by 2 to provide an analog signal with a 1.25 V upper limit.

The DAC80508 has a precision not found in most microcontroller DAC peripherals. INL and DNL are both ±0.5 LSB typical and ±1 LSB maximum. Gain error is ±0.5% typical and ±1% maximum. With 16-bit resolution, this level of accuracy is ideal for converting digital audio signals to analog. For example, the product can be used to convert Pulse Code Modulation (PCM) digital audio transmitted over fiber optic cables, or to convert digital audio from storage devices. After converting digital audio to 16-bit audio data, the DAC80508 can convert these data to analog audio signals sent over a normal RCA cable. If the reference voltage is set to 1.25 volts, this accuracy is sufficient to generate a line-level audio signal.

In addition, the DAC80508 features an output gain amplifier that doubles the output voltage to generate an output voltage twice the reference voltage.

Using the DAC80508 to generate analog waveforms is very simple through the SPI interface. Each SPI command packet sent to the DAC data register is 32 bits wide. Each command packet contains the channel address to be written, and the 16-bit data to be written to the register. Any DAC80508 output channel can be programmed to produce an output voltage as soon as data is written to the register, or to retain all values ​​in the DAC data register until the SPI writes to the internal broadcast register. Writing a logic ‘1’ to any of the eight broadcast register bit positions will only update the corresponding DAC output with the value in the DAC data register. This generates a synchronization signal suitable for generating waveforms for test equipment.

Avoid signal errors and noise

When used in noisy industrial environments, occasional interference is inevitable, especially in high voltage environments. To prevent output signal errors due to SPI interference, the DAC80508 can optionally generate an 8-bit checksum at the end of each SPI packet (Figure 2). If the checksum is valid, write to the DAC data register. But if the checksum is invalid, no data will be written. Optionally, when the checksum is invalid, the DAC can pull the SPI SDO pin low, acting as an active low alarm pin. The microcontroller firmware should be responsible for handling invalid checksums.

How Microcontroller On-Chip DACs Generate Precision Analog Signals
Figure 2: 32-bit SPI packet structure. When the DAC data register SPI packet of the DAC80508 contains an 8-bit checksum, the packet is sent MSB first, and the last few bits (7:0) contain the checksum. The checksum is automatically generated by the DAC80508. (Image credit: Texas Instruments)

No matter how accurate the DAC is marked, accuracy can only be guaranteed with a clean power supply. It is critical that the VDD of the DAC80508 has low noise and no ripple. Extra care must be taken if the DAC80508 is used in a DC-DC converter, as these supplies are inherently very noisy. Filtering VDD is important, so a 1-10 microfarad (μF) capacitor must be placed between VDD and analog ground, as well as a 0.1μF capacitor. Low ESR ceramic capacitors should be used and placed as close as possible to the VDD pin.

Analog signal outputs should be kept near the edge of the printed circuit board and should be adequately isolated from digital components. This not only prevents interference with the DAC analog outputs, but also prevents these analog signals from interfering with other signals on the printed circuit board.

High-speed high-performance DAC

Sometimes demanding applications require extreme performance. DACs can even generate gigahertz-level signals. This feature of DACs is especially important for radar equipment when direct analog circuitry cannot produce the accuracy required for radar. For such applications, Texas Instruments’ DAC38RF82IAAV high-speed RF dual-channel DAC can be used to generate waveforms above 1 gigahertz (GHz) in a relatively small 10 mm x 10 mm BGA package (Figure 3).

How Microcontroller On-Chip DACs Generate Precision Analog Signals
Figure 3: The DAC38RF82 is an ultra-high performance DAC capable of generating waveforms above 1 GHz. The DAC connects to the host microprocessor through a low-power, 8-channel JEDSD204B 12.5 Gb/s interface. (Image credit: Texas Instruments)

The DAC38RF82 supports three resolutions. When set to 16-bit resolution, RF signals up to 2 GHz can be generated. When 12-bit resolution is selected, a 2.66 GHz signal can be generated. The fastest mode is set to 8-bit resolution, where the DAC38RF82 can generate 4.5 GHz waveforms. Of course, these speeds exceed the capabilities of any microcontroller’s on-chip DAC peripheral.

The performance of the DAC38RF82 is high enough for use in baseband transmitters such as cell towers, and can also be used to generate custom waveforms for applications such as high-end test equipment. Additionally, the DAC38RF82 can be used to generate radar signals for autonomous vehicles.

This device is more complex than the DAC80508. To generate signals up to 4.5 GHz, an extremely fast data interface is required. The DAC38RF82 uses the JESD204B serial data interface, which can reach speeds of up to 9 Gb/s in 8-bit mode. With these interface speeds, the device can interface with FPGAs or ASICs.

When used in 12-bit or 16-bit mode, the DAC38RF82 can generate two RF waveforms, while in high-speed 8-bit mode, only one waveform is supported. The device requires three supply voltages, 1V, 1.8V, and -1.8V. Given the typical application requirements of this device, these supply voltages must be very clean and ripple-free. Ideally, the three main and relatively independent parts of the DAC (digital subsystem, analog subsystem, and clock subsystem) should each have their own partitioned power supplies to avoid any unexpected interactions.

The DNL of the DAC is typically ±3 LSB, the INL is typically ±4 LSB, and the gain error is typically ±2%. Accuracy for a given application can be ensured by selecting the appropriate DAC data register values ​​during testing.

Start DAC38RF82 development

To be able to generate such high frequencies with sufficient accuracy, the evaluation board plays a key role in the development process. The DAC38RF82 is powered by the DAC38RF82EVM evaluation and development board, which supports all the features of this high-end DAC. The DAC38RF82 requires the TSW14J56EVM data capture interface board to generate digital signals that connect to the DAC38RF82EVM. The data capture board is connected to the PC via the USB 3.0 interface.

How Microcontroller On-Chip DACs Generate Precision Analog Signals
Figure 4: The digital data generated by the TSW14J56EVM on the right is fed through the JESD204B interface to the DAC38RF82EVM on the left to generate RF signals for testing. (Image credit: Texas Instruments)

The included evaluation software contains everything needed to evaluate, test and program the DAC38RF82 for the target application.

Layout is especially important when using such high-speed devices. The DAC38RF82 must be located on the edge of the printed circuit board and separated from all other components as much as possible. Designers must strictly adhere to the principle of using short RF traces and preferably using bypass capacitors between the power pins and ground. Other layout suggestions include using bypass capacitors with pad vias and as short a tap as possible to avoid parasitic inductance. Additionally, designers should use 100Ω differential coplanar waveguides as output traces.

in conclusion

Microcontrollers with general-purpose on-chip DACs are suitable for generating kilohertz-level voltages and waveforms with reasonable accuracy. To generate precision voltages or very high speeds, an external DAC can be used to significantly improve the accuracy and performance of the application, but it is also necessary to make some improvements in design practices in terms of power and layout.

The Links:   6MBI25L-120 LM215WF3-S2L4 SHARP-LCD