How to use DAC7821? - Page 1
Forum section: electronics / projects

author: rcbuck
author_rank: Frequent Contributor
timestamp: August 29, 2020, 07:08:48 pm
content: I want to use the TI DAC7821 to generate a 0-5 volt sine wave output. I'm not sure I understand the data sheet. Equation 1 beneath Figure 25, page 11 appears to say multiply-by Vref. If so, and Vref is 5V, I should just get an inverted sine wave since my op amp is biased at 1/2 VDD. Correct?Looking at Figure 28 in the data sheet I think the attached circuit will work. Is that correct or wrong?I know I can get a voltage output DAC but I want to use the DAC7821 because of its speed capabilities.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 30, 2020, 04:18:53 am
content: Raising +in doesn't work because the output pins have to be very close to ground.You need a negative supply, one way or another. Either negative VREF or an inverting op-amp.Or lift the whole thing up a few volts, but then you need level shifting for all the digital signals (and probably an elevated supply too).Tim

author: rcbuck
author_rank: Frequent Contributor
timestamp: August 30, 2020, 05:46:47 am
content: Tim,Not sure what you mean by the output pins have to be very close to ground?The data sheet says Vref has a range of -15 to +15 volts. Why do you need a negative supply? What happens if Vref is +5 and there is no negative supply? What would the output of the DAC be?Ray

author: Ian.M
author_rank: Super Contributor
timestamp: August 30, 2020, 07:32:48 am
content: It looks like you may be able to shift the analog ground without needing to level shift the digital signals. If you were to bias Iout2 at 1/2 Vcc, the external OPAMP would then give an output from Vcc/2 to (Vcc - Vref), without needing a negative supply if its RRIO. N.B. Vref > Vcc/2. You can fix that up to get a full 0V to Vcc swing with a x2 differential amplifier stage.With Vref, Iout1 and Rfb disconnected try biassing Iout2 at 2.5V via a 100K series resistor to limit the Iout2 pin current. Measure the voltage drop across the resistor - it should be under 20mV. If its not, stop - my idea is no good.Assuming Iout2 drew negligible current with the other R-2R ladder pins disconnected, you can remove the 100K resistor, reconnect the other pins, connect Iout2 direct to the output of a rail splitter (or other low impedance Vcc/2 supply) + use that point as an elevated analog ground. N.B. the effective Vref is relative to the potential of Iout2.

author: bson
author_rank: Unknown
timestamp: August 30, 2020, 07:49:48 am
content: You'd need to connect Iout2 to 2.5V as well, and it needs to be a four quadrant source such as an op amp buffer.(Edit: Ian.M beat me to it.)

author: rcbuck
author_rank: Frequent Contributor
timestamp: August 30, 2020, 05:56:33 pm
content: I think I may have chosen the wrong part for a simple task. This type of DAC requires a lot of extra parts and complexity to use.I did find a Maxim data sheet that shows how it may be able to accomplish what I want to do (see attached image). If I change the voltage at Iout1 to +2.5 volts would I get a 0-5 volt output? I am going to use an op amp buffer regardless of what DAC I end up using so the extra op amp is not an issue.What I need is a 12 bit DAC to generate a 60 kHz sine wave output with a 0-5 volt output. It has to have a parallel data interface and run in single supply mode, no negative voltages. I have found a couple of voltage type DACs that have 7 usec settling times. Is that fast enough for 60 kHz? If not, does anyone have a suggested part number? The fast settling time was the only reason I was looking at MDAC parts.

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 30, 2020, 10:35:55 pm
content: Quote from: rcbuck on August 30, 2020, 05:56:33 pmUse an audio DAC that can do 192kHz sample rate.

author: rcbuck
author_rank: Frequent Contributor
timestamp: August 31, 2020, 01:11:13 am
content: As far as I can tell from Mouser and Digikey no such animal exists.I think I'll try a DAC7621 and see if the 7 usec settling time is fast enough for a 60 kHz output.

author: BrianHG
author_rank: Super Contributor
timestamp: August 31, 2020, 02:02:13 am
content: This guy will do it:TLV5619CDW5v, buffered voltage output, rail to rail output buffer...https://www.ti.com/product/TLV5619#tech-docsThere are cheaper solutions using high speed serial interface DACs. Like 384Khz 32bit audio DACs with voltage output.https://www.arrow.com/en/products/pcm5102aqpwrq1/texas-instruments?utm_term=instock&utm_campaign=arrow_findchips_2019&utm_currency=&utm_medium=aggregator&utm_source=findchips&utm_content=inv_listingThey have a 2.1v RMS voltage output (+/- 2.5v, IE 5vp-p output, but it goes from -2.5v to +2.5v out), so you may need DC shift the output.

author: rcbuck
author_rank: Frequent Contributor
timestamp: August 31, 2020, 02:24:24 am
content: I should have mentioned one more thing. It needs to have a 12 bit data bus. My processor instruction time is 72 MHz and I need to do other things between the 16.6667 usec sine wave updates. So I don't have time for serial transmissions or multiple addressing modes.Cost is also a factor. I would like to keep the DAC below $10. Ultimately the real solution is probably a much faster processor (STM32F407) so the DAC specs can be changed to serial mode.At this time I am just trying to prove my idea will work. The DAC7821 will certainly work if it were simple to implement.

author: rcbuck
author_rank: Frequent Contributor
timestamp: August 31, 2020, 02:27:14 am
content: Brian, we cross posted.I may have to use the TLV5619 and pay more just to confirm my idea works. Thanks for the suggestion.

author: exmadscientist
author_rank: Frequent Contributor
timestamp: August 31, 2020, 02:37:14 am
content: You might also find it helpful to refer to another manufacturer's better-written datasheet to learn how to use the part you prefer. One of the ways ADI makes money is to write better datasheets than the other guy, hoping that seduces you into just using their part... this has certainly worked on me!In that vein you might take a peek at, say, the AD5445 datasheet:https://www.analog.com/media/en/technical-documentation/data-sheets/AD5424_5433_5445.pdf, particularly its section on single-supply operation.

author: BrianHG
author_rank: Super Contributor
timestamp: August 31, 2020, 02:38:40 am
content: Quote from: rcbuck on August 31, 2020, 02:27:14 amIt's only $7.53 here:https://www.rocelec.com/part/TISTLV5619CDW?utm_medium=buyNow&utm_source=findChipsAnd the interface is dumb, 12 bits and load_dac. Make the vref at 2.5v, or 1/2vcc with 2 divider resistors and a cap and the output will be 0v to VCC.

author: BrianHG
author_rank: Super Contributor
timestamp: August 31, 2020, 02:43:19 am
content: Quote from: exmadscientist on August 31, 2020, 02:37:14 amI cant argue here. Analog devices data sheets have always been top notch with every chart and example hookup well documented.Also cheaper, but you need an IV converter 2 stage opamp for the output with dual supply or rail to rail output opamps:https://www.rocelec.com/part/ANAAD5445YRU-REEL?utm_medium=buyNow&utm_source=findChips

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 31, 2020, 02:54:01 am
content: Quote from: rcbuck on August 31, 2020, 02:24:24 amWhat microcontroller are you using that doesn't have hardware SPI with FIFO and maybe even DMA?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 31, 2020, 04:41:30 am
content: How about a separate oscillator into an MDAC? Only need to update it once in a while. By "sine wave" I presume there are no phase or frequency changes; or really amplitude either, as a sine wave is eternal. But "sine wave" is typically used loosely, so I'm making light of these here......Which can be injection locked, or digitally tuned; of course the hardware-complexity tradeoff quickly gets out of hand, but there may be a middle ground where it's suitable.Also, distortion, spurs, etc.? SINAD? Not crazy I guess if 12 bits is adequate, but depends on how much overhead you need for the sample rate.(If distortion doesn't need to be impressive, it could even be a well-filtered timer output (square wave) into an MDAC, in which case phase/frequency is directly controllable again.)Tim

author: ejeffrey
author_rank: Super Contributor
timestamp: August 31, 2020, 02:06:01 pm
content: Quote from: rcbuck on August 31, 2020, 02:24:24 amCan you use a DDS chip? They can be pretty cheap and generate good sine waves. You can update the tuning words over SPI as quickly as your micro can keep up.

author: rcbuck
author_rank: Frequent Contributor
timestamp: September 01, 2020, 10:21:10 pm
content: I am using a dsPIC33EV256GM106 that does have SPI. But the Processor is not fast enough to have a SPI DAC work at 60 kHz and generate 48 sample points from a lookup table.The sine wave will not change frequency. However, I want to change the phase by 180 degrees every 2 seconds Distortion isn't really a concern.I have finally decided a R2R ladder DAC is the simplest guaranteed way to work. At least for my initial testing.Attached jpg is an example of what I want to do. You can see the 180 degree change at the center of the sine wave pattern.I may be approaching this from the wrong perspective. As ejeffrey mentioned, DDS may be the real answer. The AD9838 has IOUT and IOUTB outputs. Page 15 of the data sheet says the outputs are differential in operation. I could make the phase change using a SPDT switch such as the NLAS4157 or TS5A3159. The only problem is the phase change would just be random (without additional hardware) instead of at zero crossing. But that shouldn't matter in my application since there is no hardware being controlled.Has anyone worked with the AD9838 part? Do the pads wrap around the outside of the case or are the side pads just for alignment?

author: NiHaoMike
author_rank: Super Contributor
timestamp: September 01, 2020, 11:24:08 pm
content: Quote from: rcbuck on September 01, 2020, 10:21:10 pmYou don't need a sample rate 48x the output frequency. Theoretically, it can be done with just 2x the output frequency, but in practice, 4x or more makes it easier to filter the output. The easiest way to do it is to use an audio DAC that oversamples internally.

author: ejeffrey
author_rank: Super Contributor
timestamp: September 02, 2020, 03:58:12 am
content: Quote from: rcbuck on September 01, 2020, 10:21:10 pmThis is made for a DDS! No need to use a switch to flip the phase, the DDS has this capability built in. It has two phase registers, and you can flip back and forth using a single control register write. There are other DDS chips that actually have input pins that you can drive with a GPIO to select between different phase/frequency registers, but the AD9838 does not have this feature. At 0.5 Hz however it isn't really needed.You can make this synchronous by using the same clock (or divided copy) for both the microcontroller and the DDS chip. That should allow you to do zero crossing switching if you are careful, no extra hardware needed.QuoteI haven't worked with the AD9838 but I have worked with higher speed analog devices DDS chips. They are great for this type of application. As for the package, yes the leads wrap around the side of the package a bit. These are small but you can solder them by hand with some magnification -- except for the exposed pad. I've soldered packages like this on a hot plate with no problem.