Author Topic: Best way to add external dacs  (Read 10859 times)

0 Members and 1 Guest are viewing this topic.

Offline rhdfTopic starter

  • Contributor
  • Posts: 44
  • Country: se
Best way to add external dacs
« on: February 05, 2016, 11:11:01 am »
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...)




 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7390
  • Country: nl
  • Current job: ATEX product design
Re: Best way to add external dacs
« Reply #1 on: February 05, 2016, 11:14:58 am »
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.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: Best way to add external dacs
« Reply #2 on: February 05, 2016, 12:17:00 pm »
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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline rhdfTopic starter

  • Contributor
  • Posts: 44
  • Country: se
Re: Best way to add external dacs
« Reply #3 on: February 05, 2016, 12:48:13 pm »
PWM is an option I  have considered. The problem comes that day I need more outputs than available pins ...
 

Offline Scrts

  • Frequent Contributor
  • **
  • Posts: 797
  • Country: lt
Re: Best way to add external dacs
« Reply #4 on: February 05, 2016, 01:46:30 pm »
Maybe I2C, SPI or I2S DAC would help? Not sure about STM32F4 I2S interface supporting more than 2 channels.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Best way to add external dacs
« Reply #5 on: February 05, 2016, 01:51:35 pm »
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.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: Best way to add external dacs
« Reply #6 on: February 05, 2016, 05:42:12 pm »
PWM is an option I  have considered. The problem comes that day I need more outputs than available pins ...
In 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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline cloudscapes

  • Regular Contributor
  • *
  • Posts: 198
Re: Best way to add external dacs
« Reply #7 on: February 06, 2016, 12:31:36 am »
single dac -> multiplexer -> simple opamp sample & hold

I want to build a synth as well, so I've been thinking about how to do it
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Best way to add external dacs
« Reply #8 on: February 06, 2016, 02:01:53 am »
Hi

There 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
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: Best way to add external dacs
« Reply #9 on: February 06, 2016, 02:05:21 am »
I wouldn't call DACs cheap. A good DAC (IOW: not one from Microchip or Rohm) still costs a few dollars each.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Best way to add external dacs
« Reply #10 on: February 06, 2016, 02:12:37 am »
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.
================================
https://dannyelectronics.wordpress.com/
 

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1719
  • Country: se
Re: Best way to add external dacs
« Reply #11 on: February 06, 2016, 11:20:11 am »
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).
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: Best way to add external dacs
« Reply #12 on: February 06, 2016, 12:16:49 pm »
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).
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Best way to add external dacs
« Reply #13 on: February 06, 2016, 02:35:26 pm »
I wouldn't call DACs cheap. A good DAC (IOW: not one from Microchip or Rohm) still costs a few dollars each.

Hi

The 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
 

Offline rhdfTopic starter

  • Contributor
  • Posts: 44
  • Country: se
Re: Best way to add external dacs
« Reply #14 on: February 06, 2016, 04:57:59 pm »
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).

That 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
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Best way to add external dacs
« Reply #15 on: February 06, 2016, 05:13:07 pm »
Hi

Be 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
 

Offline rhdfTopic starter

  • Contributor
  • Posts: 44
  • Country: se
Re: Best way to add external dacs
« Reply #16 on: February 09, 2016, 12:06:34 am »
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.
 ;D
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Best way to add external dacs
« Reply #17 on: February 09, 2016, 12:14:06 am »
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.
 ;D

Hi

If 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
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Best way to add external dacs
« Reply #18 on: February 09, 2016, 12:55:56 am »
Quote
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.

Which part would be that?
================================
https://dannyelectronics.wordpress.com/
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Best way to add external dacs
« Reply #19 on: February 09, 2016, 01:14:23 am »
Hi

It'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
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Best way to add external dacs
« Reply #20 on: February 09, 2016, 01:19:28 am »
Quote
It's a part from Maxim.

And its part number is?
================================
https://dannyelectronics.wordpress.com/
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Best way to add external dacs
« Reply #21 on: February 09, 2016, 01:43:50 am »
Hi

I'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
 

Offline rhdfTopic starter

  • Contributor
  • Posts: 44
  • Country: se
Re: Best way to add external dacs
« Reply #22 on: February 09, 2016, 10:24:44 am »
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
I realize that, but there are obviously still a market for 2 and 4 channel-dacs in DIP-packages ;) Are 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)
 

Offline cloudscapes

  • Regular Contributor
  • *
  • Posts: 198
Re: Best way to add external dacs
« Reply #23 on: February 09, 2016, 02:23:10 pm »
If he's building a synth, then I wouldn't consider this project "small sized" ;)
I'd be extremely interested in seeing the result!
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Best way to add external dacs
« Reply #24 on: February 09, 2016, 06:21:12 pm »
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
I realize that, but there are obviously still a market for 2 and 4 channel-dacs in DIP-packages ;) Are 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)

Hi

Yes, 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
 

Offline rhdfTopic starter

  • Contributor
  • Posts: 44
  • Country: se
Re: Best way to add external dacs
« Reply #25 on: May 10, 2017, 08:10:53 am »
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 2

TLV5630 from TI, in tsop20 or soic20 (nice for prototype)
http://www.mouser.se/Search/ProductDetail.aspx?qs=7KMwW2o1%252bmQiAwmvIPv%2fNg%3d%3d

and MAX5725BAUP+
http://www.mouser.se/Search/ProductDetail.aspx?qs=0JU57JYmZjtBqXkYujZL9A%3d%3d

the 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 for
http://www.midibox.org/dokuwiki/aout_ng
 

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: Best way to add external dacs
« Reply #26 on: May 10, 2017, 01:54:29 pm »
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.
 
The following users thanked this post: SeanB

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16618
  • Country: us
  • DavidH
Re: Best way to add external dacs
« Reply #27 on: May 10, 2017, 02:36:06 pm »
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.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: ca
Re: Best way to add external dacs
« Reply #28 on: May 10, 2017, 03:29:49 pm »
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.

 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16618
  • Country: us
  • DavidH
Re: Best way to add external dacs
« Reply #29 on: May 10, 2017, 03:44:22 pm »
PIC16F1773 (or PIC16F1776) has 3 10-bit DACs and costs $2. You can use 2 of them to get 6 channels for $4.

These 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.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: ca
Re: Best way to add external dacs
« Reply #30 on: May 10, 2017, 04:31:30 pm »
These 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.

The only important thing is if the specs meet the OP's requirements or not.
 

Online JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: Best way to add external dacs
« Reply #31 on: May 10, 2017, 06:35:18 pm »
- 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
 

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: Best way to add external dacs
« Reply #32 on: May 10, 2017, 07:37:24 pm »
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.
 

Offline rhdfTopic starter

  • Contributor
  • Posts: 44
  • Country: se
Re: Best way to add external dacs
« Reply #33 on: May 10, 2017, 10:10:50 pm »
For what I'm building now  I might get away with using the maxim-part since its more or less a one-off

basicly 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 ;) )

 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Best way to add external dacs
« Reply #34 on: May 13, 2017, 01:28:09 am »
See attached, 16 16 bit PWMs on one PSOC chip. Looking
at remaining resources probably could do another 8 16
bit PWMs.

And I did not do this but probably could add 4 8 bit analog DACs
with OpAmp buffered outputs.

There is also a wavedac component that can gen sine, tri, ramp, square
wave outputs. Not sure that may be limited to either 2 or 4 channels.


Regards, Dana.
« Last Edit: May 13, 2017, 01:31:00 am by danadak »
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Best way to add external dacs
« Reply #35 on: May 13, 2017, 01:47:17 am »
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 filter
to drive 2 filtered channels back into time domain signals. Also you would use the
SAR or DelSig onboard to feed samples to the digital filter. And the DMA to automate
it.

One chip.


Regards, Dana.
« Last Edit: May 13, 2017, 01:50:21 am by danadak »
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf