Best way to add external dacs - Page 1
Forum section: electronics / general

author: rhdf
author_rank: Contributor
timestamp: February 05, 2016, 11:11:01 am
content: How would you solve the "simple" task to add 5-6 dac channels to a MCU (stm32f4)?what I need is 5 (or 6) voltages that updates "simultaneous" They will be used as controlvoltages for a syntheziser.At the moment I have one MCP4822 (dual 12 bit dac) that is controlled with 2 encoders just so i can adjust 2 parameters for testing other parts of the circuit. Triple that might work, but its not that "nice" since I then have to make sure the right chip gets the right data. (A 6 channel 12bit SPI dac would be nice...)

author: tszaboo
author_rank: Super Contributor
timestamp: February 05, 2016, 11:14:58 am
content: Ti and AD, Linear sells bunch of multichannel DACs. Try 8 channel, they dont make it in 6. Just forget microchip, their analog stuff is not nice anyway.

author: nctnico
author_rank: Super Contributor
timestamp: February 05, 2016, 12:17:00 pm
content: Another option would be to use PWM. If the signals don't need to change fast you might even be able to do it in software and apply filtering in hardware.

author: rhdf
author_rank: Contributor
timestamp: February 05, 2016, 12:48:13 pm
content: PWM is an option I have considered. The problem comes that day I need more outputs than available pins ...

author: Scrts
author_rank: Frequent Contributor
timestamp: February 05, 2016, 01:46:30 pm
content: Maybe I2C, SPI or I2S DAC would help? Not sure about STM32F4 I2S interface supporting more than 2 channels.

author: mikerj
author_rank: Super Contributor
timestamp: February 05, 2016, 01:51:35 pm
content: AD5628/48/68 are octal 12/14/16 bit DACs with an SPI interface (up to 50MHz). You can preload the input registers for each channel and then either send a single SPI command or toggle the LDAC pin to transfer the input registers to the DAC code registers, so all outputs update simultaneously. They have a very good on board reference as well (5ppm/C). The only snag is they are expensive parts.

author: nctnico
author_rank: Super Contributor
timestamp: February 05, 2016, 05:42:12 pm
content: Quote from: rhdf on February 05, 2016, 12:48:13 pmIn that case you can use a microcontroller with more pins. Another option is to use one DAC, CMOS switches and a FET input opamp (like the TL071/72/74) and create a sample & hold. That way you can create many precise control voltages very cheap.

author: cloudscapes
author_rank: Regular Contributor
timestamp: February 06, 2016, 12:31:36 am
content: single dac -> multiplexer -> simple opamp sample & holdI want to build a synth as well, so I've been thinking about how to do it

author: uncle_bob
author_rank: Unknown
timestamp: February 06, 2016, 02:01:53 am
content: HiThere are an enormous number of DAC's from 8 bit through 20 bit that you can load a bunch off off of a single SPI port. You daisy chain the output of one to the input of the other. Shift out bits times DAC's worth of data and send a single pulse to load them all. One clock line, one data output line and one strobe line. You may have a single chip select line as well depending on the DAC. Update will be simultaneous to within however good the timing on the parts is (nanoseconds). No pops, burps, clicks or buzz.With 12 to 16 bit DAC's as cheap as they are today, there is not a lot to be saved in a one up design trying to shave off a couple of bits. The days of 8 bit is all my audio setup can afford are long gone.Bob

author: nctnico
author_rank: Super Contributor
timestamp: February 06, 2016, 02:05:21 am
content: I wouldn't call DACs cheap. A good DAC (IOW: not one from Microchip or Rohm) still costs a few dollars each.

author: dannyf
author_rank: Super Contributor
timestamp: February 06, 2016, 02:12:37 am
content: You are looking for a dac with a latxh pin. Multi channel output makes programming easy.Spi is good for high speed, assuming that you prefer a serial interface.

author: newbrain
author_rank: Super Contributor
timestamp: February 06, 2016, 11:20:11 am
content: If you still want to use MCP4822, that's possible without too much hassle, assuming you have enough GPIO pins available.You'll need one separate /CS outputs from the MCU per DAC (as the 4822 only has a serial data in -> no daisy chaining) and another output to be connected to the all /LDAC inputs (pin 5) on the DACs to load them at the same time (as dannyf suggested).

author: nctnico
author_rank: Super Contributor
timestamp: February 06, 2016, 12:16:49 pm
content: Be careful with Microchip's DACs: their logic levels are choosen very stupidly so they don't work if you have mixed logic levels (for example powering a microcontroller from 3.3V and the DAC from 5V).

author: uncle_bob
author_rank: Unknown
timestamp: February 06, 2016, 02:35:26 pm
content: Quote from: nctnico on February 06, 2016, 02:05:21 amHiThe price delta (even on good DACS) has dropped to the point that anything under 12 bits is not really worth chasing. If you have a size constraint that forces you to some sort of single package part, that's different. Yes, if you get the sample rate high enough, this falls apart, we aren't talking about those sort of DAC's here.Bob

author: rhdf
author_rank: Contributor
timestamp: February 06, 2016, 04:57:59 pm
content: Quote from: newbrain on February 06, 2016, 11:20:11 amThat is one of my ideas, but there is that thing with the (in my case) 3 separate chips. Sure the are dirt-cheap and have internal reference.After all good tips in here I'm starting to look at a solution with a 8-channel dac. 2-3 extra channels at the moment, but who knows.I might come up with some crazy idea where I need them.Then I just have to handle one CS and "LDAC" pin

author: uncle_bob
author_rank: Unknown
timestamp: February 06, 2016, 05:13:07 pm
content: HiBe careful with the "8 channel" parts. There are two very different approaches to them and the manufacturers are not very careful about telling you which one you are getting. Some are a single DAC with an output mux. Others are a full eight independent DAC's. With the mux parts, you only get one output at a time. When the DAC is not tied to an output, that line just floats (or grounds). If you need 8 simultaneous outputs. You can't do it with a mux.I have seen this being done for years. Even today I'll get handed a part and look at it. From the data sheet, it's 8 independent parts. Dig down into the programming details on page 97 and surprise !!! There is only one DAC data register. It's a mux part.=========If you get into a case that requires multiple chips selects, a 74 series demultiplexer chip is a cheap and dirty way to come up with the required signals without using a lot of MCU pins.Bob

author: rhdf
author_rank: Contributor
timestamp: February 09, 2016, 12:06:34 am
content: Just realized that 8-channel dacs is pretty cheap ( as in price/channel) compared to 4-channel versions. But one thing that's interesting is that most of them comes in tiiiiiny packages, like tssop16. Why not in "normal" sizes like soic16?With some rough planning i can fit a MCU, 8 channel dac and a audio-dac + all passives needed for them on something like a creditcard sized PCB.

author: uncle_bob
author_rank: Unknown
timestamp: February 09, 2016, 12:14:06 am
content: Quote from: rhdf on February 09, 2016, 12:06:34 amHiIf it's a TSSOP, that's a *big* package these days. A small package would be one of 1.x by 2.x mm packages with no leads. That's considered a "big" package for a fixed voltage regulator these days. It's also a do-able package for MCU's.The why is pretty easy. Things like cell phones (or worse watches) are the volume users of semi's these days. Size is a really big deal in this stuff.Bob

author: dannyf
author_rank: Super Contributor
timestamp: February 09, 2016, 12:55:56 am
content: QuoteWhich part would be that?

author: uncle_bob
author_rank: Unknown
timestamp: February 09, 2016, 01:14:23 am
content: HiIt's a part from Maxim. There are a lot of similar parts. I have no idea what they get used in. Whatever the application, somebody must like to do it that way. My guess is it's some sort of built in test sort of thing. Poke at each point and make sure it wiggles correctly. Once you have poked at all 8 points, shut the DAC down and continue the boot process.Bob

author: dannyf
author_rank: Super Contributor
timestamp: February 09, 2016, 01:19:28 am
content: QuoteAnd its part number is?

author: uncle_bob
author_rank: Unknown
timestamp: February 09, 2016, 01:43:50 am
content: HiI've got it on a demo board at work. I'll try to dig it up tomorrow, if I can even find the darn thing.Bob

author: rhdf
author_rank: Contributor
timestamp: February 09, 2016, 10:24:44 am
content: Quote from: uncle_bob on February 09, 2016, 12:14:06 amI realize that, but there are obviously still a market for 2 and 4 channel-dacs in DIP-packagesAre there really that many small sized products where you need a lot of DAC-cannels?.I won't have any problems fitting the pcp in the enclosure, thats for sure(the size of it will be dictated by a bunch of encoders and buttons with some kind of usable spacing)

author: cloudscapes
author_rank: Regular Contributor
timestamp: February 09, 2016, 02:23:10 pm
content: If he's building a synth, then I wouldn't consider this project "small sized"I'd be extremely interested in seeing the result!

author: uncle_bob
author_rank: Unknown
timestamp: February 09, 2016, 06:21:12 pm
content: Quote from: rhdf on February 09, 2016, 10:24:44 amHiYes, there is just about zero demand anymore for DIP parts in new designs. They hang around mainly for re-builds of old designs or the repair business. Cell phones have a lot of internal controls, thus a lot of DC loops. Even stuff in your car gets crammed into a small package. The feature list grows, what goes in grows, the car gets smaller .... parts have to shrink.Dug into my Maxim part, it seems to have wandered off. It may have been an ADC or mixed signal part. I don't see an obvious candidate in their selector guides.Bob

author: rhdf
author_rank: Contributor
timestamp: May 10, 2017, 08:10:53 am
content: And a year later..I put this on hold for a while but are back on track now.Looking at possible candidates for a 8 ch SPI dac I've found 2TLV5630 from TI, in tsop20 or soic20 (nice for prototype)http://www.mouser.se/Search/ProductDetail.aspx?qs=7KMwW2o1%252bmQiAwmvIPv%2fNg%3d%3dand MAX5725BAUP+http://www.mouser.se/Search/ProductDetail.aspx?qs=0JU57JYmZjtBqXkYujZL9A%3d%3dthe max-part is half the price, and I cant find any big differences (maybe I don't now what to look (out) for)The TI dac is used by in the Midibox "Aout-NG" for more or less the same purpose as I plan to use it forhttp://www.midibox.org/dokuwiki/aout_ng

author: dmills
author_rank: Super Contributor
timestamp: May 10, 2017, 01:54:29 pm
content: IMHO go with the TI unless you are only building one unit....The Maxim part you will be able to get a few of now, but you just try getting a few hundred in a year or so, there is a reason folks are reluctant to design their stuff in unless you are buying many wafers worth on 6 months lead.I have been burned far too often by muppets designing in Maxim, yes, I know they have some unique and interesting parts, just say no!I will make a partial exception for the jellybean RS-232/485 stuff providing there is a pin compatible second source.It is a pity, but the business model seems to be to occasionally run a wafer of the obscure stuff to provide ready sample availability and then only run production quantities if someone places an order large enough to warrant it.I suspect that anyone who has been around a few years has probably been bitten.Regards, Dan.

author: David Hess
author_rank: Super Contributor
timestamp: May 10, 2017, 02:36:06 pm
content: There is a big price premium going from 8 to 10 or 12 bits for multichannel DACs. If 8 bits is enough, then separate DAC channels are the way to go. Above 8 bits, multiplexers and track and holds with one DAC is competitive in price but not in layout space.This gets tricky if simultaneous updating is absolutely required. If that is required with a multiplexor and track and holds, then another switch and track and hold stage is required for each channel and offhand I do not know of any designs which went to that much effort.Tektronix had good results with a 12 bit DAC, multiplexor, and 8 to 16 track and holds in their early designs but they did not require simultaneous updating.

author: NorthGuy
author_rank: Super Contributor
timestamp: May 10, 2017, 03:29:49 pm
content: PIC16F1773 (or PIC16F1776) has 3 10-bit DACs and costs $2. You can use 2 of them to get 6 channels for $4.Since they're MCUs it'll be very easy to communicate and synchronize. And they have plenty of pins for that. You can control them from your MCU, or you can remove your MCU and use PICs themselves for control.You can run them at 3.3 or 5V (or anywhere in between). You can use DIP for prototyping/breadboarding, then switch to QFN for production.

author: David Hess
author_rank: Super Contributor
timestamp: May 10, 2017, 03:44:22 pm
content: Quote from: NorthGuy on May 10, 2017, 03:29:49 pmThese have 10 bits of resolution but they have more like 8 bits of guaranteed accuracy (2 LSB INL!) which is common for microcontroller and cheap DACs; check the specifications which do not even include drift with temperature. For some applications this is tolerable but these parts really should be compared with good 8 bit DACs and not good 10 bit DACs.

author: NorthGuy
author_rank: Super Contributor
timestamp: May 10, 2017, 04:31:30 pm
content: Quote from: David Hess on May 10, 2017, 03:44:22 pmThe only important thing is if the specs meet the OP's requirements or not.

author: JPortici
author_rank: Super Contributor
timestamp: May 10, 2017, 06:35:18 pm
content: - Never use maxim parts unless you can't find any alternative. Reasons have been already said.- I like spi. Try and see if you can find daisy-chainable DACs (that has an SDO output) so you can use a sigle CS pin, then DMA triggered by a pwm channel is your friend (the pwm channels generates the CS signal AND the DMA trigger)- I also like PWM, if ripple/settling time (i would use this instead of rise time) is acceptable for the application. just use a bigger chip if you fear of running out of pins, those ARM like to come in big packages.- I don't like I2C, i find it harder to automate

author: dmills
author_rank: Super Contributor
timestamp: May 10, 2017, 07:37:24 pm
content: Concur, SPI is usually the way to go.I2C is IMHO far more software pain then saving a few pins for slave selects usually justifies, it is easy to get it to 'work' but getting it to work with industrial grade reliability is IME a much tougher proposition, and it is painfully slow.73 Dan.

author: rhdf
author_rank: Contributor
timestamp: May 10, 2017, 10:10:50 pm
content: For what I'm building now I might get away with using the maxim-part since its more or less a one-offbasicly its a small board with MCU, audio-codec and a DAC + the needed passives.The purpouse is some kind of test-rig/prototype to wich i can hook up the analog stuff.(since my synthproject never will come near a production-line I can probably buy all the Dac:s in mousers stock and have supply for looong time)

author: danadak
author_rank: Super Contributor
timestamp: May 13, 2017, 01:28:09 am
content: See attached, 16 16 bit PWMs on one PSOC chip. Lookingat remaining resources probably could do another 8 16bit PWMs.And I did not do this but probably could add 4 8 bit analog DACswith OpAmp buffered outputs.There is also a wavedac component that can gen sine, tri, ramp, squarewave outputs. Not sure that may be limited to either 2 or 4 channels.Regards, Dana.

author: danadak
author_rank: Super Contributor
timestamp: May 13, 2017, 01:47:17 am
content: I was able to add 4 Wave DACs and the Digital Filter 2 channel, IIR or FIR or BiQuads.....See attached. Note you would use 2 of the WaveDacs as ordinary DACs for the filterto drive 2 filtered channels back into time domain signals. Also you would use theSAR or DelSig onboard to feed samples to the digital filter. And the DMA to automateit.One chip.Regards, Dana.