Why do most MCU's (even newest) have only 5-6bits D to A ? - Page 1
Forum section: electronics / general

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 19, 2020, 08:00:50 pm
content: Seems odd when a device can have a 10-bit or 12-bit A 2 D, why D 2 A is so limited!

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 19, 2020, 08:02:44 pm
content: Many of the STM32 L4/F4 series have one or two 12-bit DACs.

author: coppice
author_rank: Super Contributor
timestamp: January 19, 2020, 08:10:54 pm
content: The MCU market has very little demand for a DAC that can't be met with a PWM channel. That's why very few MCUs have a proper DAC, and the ones that do have a DAC with a very specific purpose in mind. Some peripherals will get thrown into MCU because it costs so little to do so. DACs are not in that category. A good DAC takes significant silicon, and adds significant test costs, so you really have to see a demand for it.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 19, 2020, 08:26:18 pm
content: Ok, but the output of a DAC is static, the output of a PWM RC DAC is dynamic.So why are 5-6Bit DAC's being now found in newer MCU's?What is that "specific purpose"?What can a 5-6Bit DAC be used for?

author: Yansi
author_rank: Super Contributor
timestamp: January 19, 2020, 08:30:09 pm
content: I am yet to see a 5-6bit DAC in a MCU. Where did ya get that and what manufacturer pushes this lil thing?Last time I have seen something like a 5-6bit DAC was some RF tuner block chipset and don't remember what was such DAC dedicated for.

author: ogden
author_rank: Super Contributor
timestamp: January 19, 2020, 08:33:18 pm
content: Quote from: Yansi on January 19, 2020, 08:30:09 pmRight. What's the problem to name that "newer MCU" with 5-6 bit DAC?!

author: jaromir
author_rank: Unknown
timestamp: January 19, 2020, 08:34:15 pm
content: DA and AD circuitry on MCU is exactly in the piece of silicon where no precise analog circuitry wants to live in - in middle of digital land, sitting on lots of common mode noise.There are exceptions, of course.dsPIC33FJ128GP802 has stereo 16-bit DA. Years ago I used it to implement audio frequency network analyzer/sine generator/spectrum analyzer

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 19, 2020, 08:35:22 pm
content: Many newest PIC MCU's, even some new ARM have 5/6 bit DACs.i.e. PIC12F1572 (5-bit DAC) with 10-bit A2DPIC16F18466 (5-bit DAC) with 12-bit A2DThe 16F18466 has a 12-bit A2D sitting on that noisy silicon!

author: techman-001
author_rank: Frequent Contributor
timestamp: January 19, 2020, 08:38:49 pm
content: Quote from: SiliconWizard on January 19, 2020, 08:02:44 pmThe STM32F051 also has a single 12 bit DAC.14.1 Introduction14.2The DAC module is a 12-bit, voltage output digital-to-analog converter. The DAC can beconfigured in 8- or 12-bit mode and may be used in conjunction with the DMA controller. In12-bit mode, the data could be left- or right-aligned. An input reference voltage, VDDA(shared with ADC), is available. The output can optionally be buffered for higher currentdrive.DAC main featuresThe devices integrate one 12-bit DAC channel DAC_OUT1.DAC main features are the following:· Left or right data alignment in 12-bit mode· Synchronized update capability· DMA capability· DMA underrun error detection· External triggers for conversion· Programmable internal buffer· Input voltage reference, VDDA

author: Yansi
author_rank: Super Contributor
timestamp: January 19, 2020, 08:44:05 pm
content: Quote from: SuzyC on January 19, 2020, 08:35:22 pmNobody gives rats ass about PIC16F, the old spectacular crap. Would not call it "new" by any means.//EDIT: Was replaced years ago by another PIC18F, which is mere similar turd architecture as far as I can tell.

author: coppice
author_rank: Super Contributor
timestamp: January 19, 2020, 08:49:38 pm
content: Quote from: SuzyC on January 19, 2020, 08:26:18 pmWhat DAC has a static output? If you want a static voltage level PWM is ideal, as you only need to apply a strong RC low pass filter to the PWM signal. DACs are usually there to create a dynamic signal.There are a number of good solid 12 bit DACs in MCUs, but they are usually in just one or two parts within the range, because of the limited need for them, and their cost.Most MCUs are developed for one or two specific applications, even if they look like general purpose devices to people who don't recognise the applications for the specific mix of peripherals in the part. The specific purpose for a DAC in an MCU is defined by those target applications which need the DAC, and this defines its specific accuracy, specific output drive, and so on.There are many DAC applications which only need very limited accuracy and resolution.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 19, 2020, 09:00:33 pm
content: Fascinating coppice, if one wants to create a well-filtered "static" PWM-based DAC, then response time is compromised.What are some practical use examples of "I don't need no stinking 12-bit DAC!" uses can anyone name?Yansi, thanks, I was wondering what was that kinda soiled-diaper odor that's coming from my robots!

author: Yansi
author_rank: Super Contributor
timestamp: January 19, 2020, 09:12:28 pm
content: Sorry to bother you with my opinions, I am not the one whining about having only 5bit DAC available. Stop using almost 30 frigin years old architecture, then you can get some modern features and call it new.//Note this was not meant as an insult, just stating facts. PIC16 series is I think 29 years old architecture (introduced 1991), that somehow for some strange reason still gets used by strangers, who for their eyes can't see what indeed is new, innovative and likely much cheaper. You can't expect that even the manufacturer would care to update this old stuff with shiny new stuff, would not make much sense at all.

author: coppice
author_rank: Super Contributor
timestamp: January 19, 2020, 09:16:02 pm
content: Quote from: SuzyC on January 19, 2020, 09:00:33 pmIf response time matters you are not dealing with a static signal. If you are dealing with a static signal you usually just need to ensure that you don't have a crazy long start up time while the signal settles.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 19, 2020, 09:18:09 pm
content: Yansi, don't like no 30-year old architecture??I thank you very much for your opinions.Aren't you displaying "8051" as part of your expertise?

author: Yansi
author_rank: Super Contributor
timestamp: January 19, 2020, 09:19:10 pm
content: Yes I am, but I am not whining about its old and lacking features, like you do.

author: jesuscf
author_rank: Frequent Contributor
timestamp: January 19, 2020, 09:21:29 pm
content: Quote from: SuzyC on January 19, 2020, 09:18:09 pmThe ADC in the EFM8LB1 is 14-bit. The 4 available DACs are 12-bit. The EFM8LB1 is an "8051".

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 19, 2020, 09:37:43 pm
content: I am not whining, just curious, what practical uses can a 5-bit DAC be used for?

author: Yansi
author_rank: Super Contributor
timestamp: January 19, 2020, 09:42:57 pm
content: Couple things I can think of: Calibration voltage for analog circuitry, trigger level setting for analog stuff, ... "It depends".DACs are very application specific. Sometimes you need just 5bits and sometimes 12bits are too little for the same job.Also, your mentioned PIC12F is a small 8pin job, not much applications for such small unit. But I'd check for application notes tied with it, sometimes they can give very good clues about what the part can be used for.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 19, 2020, 09:45:27 pm
content: Quote from: SuzyC on January 19, 2020, 08:26:18 pmSet voltage level for comparators (external and internal), control LDOs etc.

author: ogden
author_rank: Super Contributor
timestamp: January 19, 2020, 09:53:42 pm
content: Quote from: SuzyC on January 19, 2020, 09:37:43 pmThere are countless applications where voltage or current do not need to have better granularity than 32 levels/steps. Sometimes 4 or 8 steps is enough, but in such case you just craft DAC using GPIO + R2R.

author: Yansi
author_rank: Super Contributor
timestamp: January 19, 2020, 09:54:30 pm
content: Quote from: NorthGuy on January 19, 2020, 09:45:27 pmYup, the DAC within that PIC12F1572 can be routed to the internal comparator. (datasheet page 149)

author: nigelwright7557
author_rank: Frequent Contributor
timestamp: January 19, 2020, 10:36:57 pm
content: Quote from: Yansi on January 19, 2020, 09:12:28 pmIf people weren't still using old PIC's they would be long gone.The old none nano-metre PIC's were very robust devices.We used to shove mains into their pins (via resistor) for zero crossing detection.I must admit I have moved on a long way since the 1990's and now use mostly PIC32MX series with external A2D.But sometimes get a really simple job that just needs an 8 pin PIC like 12f509.The PIC's A2D can sometimes be a bit noisy but care must be taken over the rest of the circuit too.Even the separate A2D's I use tend to be a bit noisy mixing analogue and digital circuitry.That is even after taking great care of the signal before it gets to the A2D.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 19, 2020, 11:28:18 pm
content: Aha! Now I get it! These 5-bit DACS are rather for internal bias, comparatively speaking.

author: Yansi
author_rank: Super Contributor
timestamp: January 19, 2020, 11:35:19 pm
content: Not necessarily, but setting triggerpoint for internal comparators is certainly one of the jobs for DAC, even in the modern MCUs with much finer recolution DACs.Sometimes MCUs integrate even decent opamps, that can be either fully routed on three dedicated pins, or routed internally in any thinkable fasion, including output to internal ADC, switching integrated resistor dividers for gain setting making for a crude PGA, etc.One can then for example use the internal DAC to auto-trim the offset voltage of the integrated OPAMP.

author: MT
author_rank: Super Contributor
timestamp: January 20, 2020, 04:28:19 pm
content: Quote from: coppice on January 19, 2020, 08:10:54 pmMost MCU manufacturers dont think so as majority if not all have at least 8bit DAC on many of their chipsas its a sales argument, many applications need resolution at high speed without filtering ripple gobbleor PWM clock leaks all over the place , like 8+8bits and not necessarily absolute INL, DNL etc.

author: Jan Audio
author_rank: Frequent Contributor
timestamp: January 20, 2020, 04:55:14 pm
content: 8-bit is the minimum usable DAC.I am ignoring 5-bit DACs.Besides the PIC16 ones are not linear ( the 8-bit also not perfect linear, not like the 5-bit that double voltage each step ).

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 20, 2020, 04:56:48 pm
content: 5 bits is adequate for a lot of things. For a very odd example, check out some of the demos performed on PC-XT, NES or GameBoy. These are, roughly speaking and IIRC, 1, 2.3 and 3 bits, depending on just how you use them. The trick is high sample rate and dithering.A 5-bit DAC doesn't sound too useful, but it becomes damn powerful if you have DMA updating it from a buffer at high rate, or dithering registers perhaps. I haven't looked to see if the PIC examples offer this. Even without DMA, if you have a periodic interrupt and fast interrupt response, you can do the same in software (which is probably something PIC and AVR are quite comfortable with).5 bits is more than enough for some basic control functions. Display brightness/contrast, say. Trimming a supply voltage (but probably not setting an absolute voltage). Conversely, a rotary encoder might have about as many steps (32 or 64, depending on how it's decoded) to still deliver comfortable digital action; anything outputting in a similar way will only need as much.What else; spacial resolution, that's as many pixels as a 4-line character-based display. Not great, but definitely useful.Tim

author: Jan Audio
author_rank: Frequent Contributor
timestamp: January 20, 2020, 04:58:46 pm
content: If you already have 8-bit, you can multiplex, and use the extra pin for more multiplexing.Besides you need to buffer those DACs.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 20, 2020, 05:09:17 pm
content: Quote from: Jan Audio on January 20, 2020, 04:58:46 pmA time-tested method, by the way. I've removed R2R ladder / DAC chips like MC1408 from old equipment (70s-80s), alongside bus latch/registers, analog switch/mux (CD4051 family) and op-amps. Very likely they were using one DAC and scanning between S&H channels.Easier than ever, today, with the availability of cheap, accurate op-amps and analog switches. Don't really see S&H blocks anymore (can probably still get the old, LF3xx was it, chip?) but it's not a difficult function to implement.Tim

author: Jan Audio
author_rank: Frequent Contributor
timestamp: January 20, 2020, 05:17:58 pm
content: 4051 + opamps or FETs with 1000n pp cap.@ blueskull : i have to see all that, sounds nice btw.

author: woofy
author_rank: Frequent Contributor
timestamp: January 20, 2020, 05:35:33 pm
content: Quote from: Yansi on January 19, 2020, 09:12:28 pmOlder than that, the first PIC16 was introduced by General Instruments in 1976.

author: coppice
author_rank: Super Contributor
timestamp: January 20, 2020, 05:36:13 pm
content: Quote from: T3sl4co1l on January 20, 2020, 05:09:17 pmMany multi channel DAC chips were implemented in that way in the past, when the cost of the core DAC part of the chip was higher. Things like CD players used to have one DAC and a sampling scheme to produce a stereo output. It was only the move to sigma delta converters which ended that approach.

author: coppice
author_rank: Super Contributor
timestamp: January 20, 2020, 05:37:55 pm
content: Quote from: woofy on January 20, 2020, 05:35:33 pmYes, a fine Scottish product.

author: mikerj
author_rank: Super Contributor
timestamp: January 20, 2020, 06:51:35 pm
content: High resolution DACs take up a lot of silicon real estate, and unlike an ADC it's not something you can multiplex (at least not easily). The silicon process required for high resolution DACs is also not very compatible with that used for the logic, hence some micros with proper 16 bit ADCs and DACs (e.g. ADuCM320) have a separate stacked analog die.Quote from: coppice on January 19, 2020, 08:49:38 pmAny R-2R type DAC has a static output, i.e. it only changes when a new code is written. PWM and Delta Sigma DACs have a constantly changing output that requires low pass filtering to recover the DC value.

author: coppice
author_rank: Super Contributor
timestamp: January 20, 2020, 07:21:08 pm
content: Quote from: mikerj on January 20, 2020, 06:51:35 pmAre you trying to be obtuse? Of course the output only changes when a new code is written, but who uses a proper DAC in an application where they are not frequently writing new codes? There are cheaper ways to generate a long term static level.

author: ogden
author_rank: Super Contributor
timestamp: January 20, 2020, 07:53:02 pm
content: Quote from: coppice on January 20, 2020, 07:21:08 pmTry to do long term static level with fast settling and low noise using PWM and you will see that generalization and blanket statements are bad thing in the engineering.

author: Yansi
author_rank: Super Contributor
timestamp: January 20, 2020, 07:58:19 pm
content: Quote from: T3sl4co1l on January 20, 2020, 05:09:17 pmI think Agilent used a multiplexed DAC in their E3631A power supply, if I remember correctly. I was pretty surprised to see that in there.

author: chris_leyson
author_rank: Super Contributor
timestamp: January 20, 2020, 08:19:15 pm
content: QuoteHad to repair a musical doorbell for a customer a long time ago, 30 years or so. Opened it up and there was a 28-pin GI 16C57 sitting there. Didn't reverse engineer it, you get paid for repairs, but it must have used at least one R2R DAC.EDIT: Recently used a pair of 10-bit PWM DACs in a 2 channel PSU dynamic load tester, 0-2A in 2mA steps. Linearity is really good and settling time is adequate for the application, there's no offset adjustment though.

author: westfw
author_rank: Super Contributor
timestamp: January 20, 2020, 09:13:42 pm
content: There are a couple of chips with 5-6bit DACs, but I'm pretty sure it isn't "most."My impression was that they showed up on chips targeted to specific applications where 5-6bits (3-1.5% accurate, right?) was "good enough"; a sort of "I would have used a PWM output with an analog filter, but it would be nice not to need the external analog components, or have to keep juggling the "steps vs bandwidth."It also looks like the low-res DAC output can be used as as the Vref input for the ADCs on a chip, giving you a much wider set of possibilities for Max-resolution ADC operation than with most Vref setups...

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 20, 2020, 09:32:12 pm
content: Quote from: ogden on January 20, 2020, 07:53:02 pmFast settling == high bandwidth (i.e. AC) != long term static (i.e. DC).Whether or not the level changes often, you're saying it needs to becapableof doing so, which means the available bandwidth is high.Tim

author: cv007
author_rank: Frequent Contributor
timestamp: January 20, 2020, 09:57:33 pm
content: >There are a couple of chips with 5-6bit DACs, but I'm pretty sure it isn't "mostI think the point of view may be the pic 8bit world, which is 'mostly' 5bits, but they also have some with 8/10bits-https://www.microchip.com/ParamChartSearch/Chart.aspx?branchID=30048(check out that 16F1779, someone who makes use of most of those peripherals would probably have something interesting to look at)

author: ogden
author_rank: Super Contributor
timestamp: January 21, 2020, 05:12:39 am
content: Quote from: T3sl4co1l on January 20, 2020, 09:32:12 pmDefine DC then. 1V/sec is DC or still AC? As long as output is able to change at *any* rate, technically it is not DC anymore

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 21, 2020, 08:43:58 am
content: Precisely! If you are concerned about the rate of change, it's not DC.Which was coppice's point: DC is low bandwidth, the lowest possible bandwidth. Something that should readily be served by a low-bandwidth DAC, like filtered PWM!(And to answer the pedantry bait, not that I should: "DC" is the low frequency component of the circuit. "1V/sec" is nothing to a radio, a fair amount of AC to a seismometer, or an apocalypse to a barometer... "DC" is always contextual, or conceptual for that matter, and so cannot have such a low-level definition.)Tim

author: mikerj
author_rank: Super Contributor
timestamp: January 21, 2020, 12:22:44 pm
content: Quote from: coppice on January 20, 2020, 07:21:08 pmMany, many applications use DACs to provide static voltages or currents. I'm not being obtuse, this is simply down to invalid preconceptions.

author: ogden
author_rank: Super Contributor
timestamp: January 21, 2020, 12:31:49 pm
content: Quote from: T3sl4co1l on January 21, 2020, 08:43:58 amYes indeed. This is why I mentioned settling time which is correct property for DC source. Seems, you are here just for an argument which you will find no matter what, even in case when we both agree. For those who wonder what the ** this is about: DC sources do not have bandwidth specification, even fast DC supplies do not automagically become AC supplies on T3sl4co1l command. Try to find "bandwidth" termhere.

author: David Hess
author_rank: Super Contributor
timestamp: January 21, 2020, 04:33:23 pm
content: Quote from: blueskull on January 20, 2020, 05:07:43 pmDithering does not improve linearity and linearity is what limits DAC resolution.Quote from: mikerj on January 20, 2020, 06:51:35 pmThat points to the reason. Simple high resolution ADCs can be made using a capacitive redistribution successive approximation converter which is compatible with generic CMOS logic processes. A DAC requires an R-2R ladder, resistance string, and/or bipolar transistors (emitter scaling) (1) which requires extra processing steps.So a low resolution DAC is all that can be easily managed on a generic CMOS process.If you are desperate, a better resistive DAC can be made by driving precision resistors directly from I/O pins but PWM is usually the way to go. If you need something better then include a discrete DAC; they are not expensive.(1) Isn't there an equivalent using MOS transistors? MOS current mirrors can be scaled but maybe they do not achieve the scaling accuracy of bipolar transistors.

author: David Hess
author_rank: Super Contributor
timestamp: January 21, 2020, 04:52:01 pm
content: Quote from: blueskull on January 21, 2020, 04:42:39 pmMissing codes are not the only problem. Monotonic operation is required to prevent servo lockup. What happens when increasing the DAC code *lowers* the output? How does dithering improve that?

author: Bud
author_rank: Super Contributor
timestamp: January 21, 2020, 05:17:20 pm
content: Quote from: T3sl4co1l on January 21, 2020, 08:43:58 amPWM will cause small variable component to present, at the PWM frequency. If say you control a voltage controlled oscillator with PWM, it will cause spurs in the oscillator output below and above the oscillator frequency. If this may be a problem depends on the application.

author: coppice
author_rank: Super Contributor
timestamp: January 21, 2020, 05:19:05 pm
content: Quote from: David Hess on January 21, 2020, 04:33:23 pmNon-linearity limits accuracy. It doesn't limit the resolution you can get with dithering, unless you have really gross issues like non-monotonic codes.

author: coppice
author_rank: Super Contributor
timestamp: January 21, 2020, 05:21:40 pm
content: Quote from: Bud on January 21, 2020, 05:17:20 pmA low performance DAC, like the 5 and 8 bit ones people have been discussing here, usually has a horrible amount of digital noise on the output signal. Both a PWM signal and a cheap DAC need some heavy filtering to get a clean result.

author: David Hess
author_rank: Super Contributor
timestamp: January 21, 2020, 06:58:24 pm
content: Quote from: coppice on January 21, 2020, 05:19:05 pmThat is exactly the problem with the limited accuracy of integrated DACs. Don't you think they would extend the R-2R ladder by 3 bits to get 8 bits of resolution if it resulted in only increased integral non-linearity? The bragging return would be huge.I found something interesting in some datasheets. They *do* use charge redistribution DACs at higher resolutions with a sample-and-hold for each output. Of course a 12-bit DAC with *5 counts of DNL* is not even 10-bits but that is still pretty good. Microchip does not give a DNL specification for their integrated 8-bit R-R2 DACs or at least the ones I checked; my guess is that consistent with their other specifications, they are really 6-bits.So yes, higher resolution integrated DACs are routinely not monotonic at their stated resolution.

author: fourtytwo42
author_rank: Super Contributor
timestamp: January 21, 2020, 07:19:35 pm
content: Quote from: SuzyC on January 19, 2020, 08:00:50 pmIf you are looking for a solution to your problem that does not involve pwm try an spi dac, there are many available eghttps://www.microchip.com/wwwproducts/en/MCP4921and simple to drive, most mcu's have spi.As for the PIC16F series I still use that as a very good mixed signal part with a fast fully featured pwm for smps unlike some of the arm based parts that have poor pwm's IMOP (lacking certain features and no or little analogue integration).

author: ogden
author_rank: Super Contributor
timestamp: January 21, 2020, 08:59:53 pm
content: Quote from: coppice on January 21, 2020, 05:21:40 pmUnless DAC is delta-sigma (which is not the case here with 5-6 bit DACs), it's resolution have nothing to do with digital noise on the output signal. You are free to prove me wrong by explaining what you mean by saying so.

author: splin
author_rank: Frequent Contributor
timestamp: January 22, 2020, 12:48:36 am
content: Quote from: David Hess on January 21, 2020, 04:33:23 pmDithering is a well known (  at least by those who happen to know it!) technique for improving linearity of DACs as well as ADCs. Low levels reduce differential linearity errors by averaging over a number of nearby codes, but large scale dithering, up to 50% of full scale (or even more), can be used to reduce linearity errors over much larger ranges. Characterising its effectiveness for any specific DAC is another matter however. See this paper for example:http://www.precisionmechatronicslab.com/wp-content/uploads/2017/01/J17c-Preprint2.pdf

author: coppice
author_rank: Super Contributor
timestamp: January 22, 2020, 11:14:39 am
content: Quote from: ogden on January 21, 2020, 08:59:53 pmBy digital noise I meant the non Gaussian noise which is the result of leakage of the transitions in the digital circuitry into the analogue circuitry. To get that really low you need to commit quite a lot of silicon to isolation areas between the digital and analogue sections of the chip, which raises costs. So, in a lot of chips the isolation is pretty marginal, and leakage can change massively with temperature, the exact frequency at which the digital circuitry is being clocked, and other factors. There are some embedded sigma delta converters where the output signal (either a digitised signal from an ADC or an analogue signal from a DAC) quality can be really bad under just the right conditions. In some cases it can be a nightmare trying to track these issues down, if the converter performance looks good most of the time.

author: David Hess
author_rank: Super Contributor
timestamp: January 22, 2020, 09:36:33 pm
content: Quote from: splin on January 22, 2020, 12:48:36 amI wonder how practical that is in real life. The DAC they are starting with is much better, even relatively, then what will be found integrated onto a microcontroller.If they dithered over 100% then they could throw away the DAC and make a PWM or delta-sigma converter. There is a reason delta-sigma converters largely dropped the use of multi-bit quantizers.

author: coppice
author_rank: Super Contributor
timestamp: January 22, 2020, 09:54:17 pm
content: Quote from: David Hess on January 22, 2020, 09:36:33 pmDithering really hard is just a way to use the multi-bit converter your manager told you to, while faking a sigma-delta converter out of it to get clean results.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 23, 2020, 09:38:42 am
content: Most replies seem to me to say a MCU chip istoo noisyto fabricate a proper monotonic DAC and other schemes such as dithering and sigma-delta clever schemes are needed to attempt 8B DACs.I don't get it. Trying to design with a 5B DAC today is like designing circuits using 20% tolerance resistors and paper capacitors.If 10-12B ADC is today quite common on any MCU chip,then noise problem have already been solved?So why not at least 8B (a very much more powerful, practical HW tool) DACs be more commonly offered, even if the output required external buffering and scaling?Dithering requires more code, more CPU time, PWM requires filtering and creates settling time issues to attend to, while external DACs means bigger BOM and increased size of PCB cost.

author: coppice
author_rank: Super Contributor
timestamp: January 23, 2020, 09:47:43 am
content: Quote from: SuzyC on January 23, 2020, 09:38:42 amThere is no problem making an MCU really quiet, and putting a 16 bit DAC in it. The problem is it costs, and the market for a chip with that performance + price combination is too small for it to be viable to develop silicon for it. Find a high volume application for a device like that, and you'll find devices of that type rapidly appear.

author: techman-001
author_rank: Frequent Contributor
timestamp: January 23, 2020, 09:59:41 am
content: Quote from: SuzyC on January 23, 2020, 09:38:42 amI wouldn't worry about it. Seeking an opinion here is just asking to get caught up in endless arguments between armchair experts that won't help a prototype appear on your desk.The best way (imho) is to pick any modern MCU you like that has the tools you need to write and debug in the programming language you're happy with and just design your prototype.You can buy a cheap 'development board' to test your code etc, but as far as noise is concerned, you'll need to design your own pcb designed to minimize DAC or ADC noise. The main thing and this has been mentioned here before, is to follow good PCB noise reduction techniques, ground plane etc.Just go and DO it or you'll be here arguing until the heat death of the universe!

author: Siwastaja
author_rank: Super Contributor
timestamp: January 23, 2020, 11:20:30 am
content: Quote from: SuzyC on January 23, 2020, 09:38:42 amNo, noise is not limiting the analog performance of an MCU to 5 bits, unless the design is completely failed. Either you understood some comment wrong, or someone had no idea what they were talking about.You could say that noise starts to be a concern aftervery roughlyabout 10 bits. The higher noise margin you want, the more difficult, and expensive, it becomes, but going from 5 bits to, say, 8 bits, definitely isn't a problem defined bynoise; it's something else.QuoteThe likely key is: it comes for practically free. A 12-bit DAC on that 30-year old architecture would have increased the product price, and moved it to a different product category altogether. You can come up with a lot of practical use cases for a free 5-bit DAC. So it's not a key feature, that MCU is not meant to be used for precision analog circuits; the DAC is a useful bonus.If you need 2000 arbitrary analog voltage levels, then the 5-bit DAC is of course the wrong tool for the job. Use an external DAC. The noise characteristics will be better, too.Sometimes you are fine with a 20% tolerance resistor (a heater, for example!); sometimes you are fine with 32 voltage levels. One use case would be setting a current limit to 32 different levels. Another would be to inject a finetune into the voltage feedback network, so if you have, say, a +12V supply, you could finetune it in 0.1V steps from from 11.0 to 14.2V.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 23, 2020, 06:08:09 pm
content: Quote from: SuzyC on January 23, 2020, 09:38:42 amIf 20% resistors meet your requirements, there's no difference whether you use 5% or 0.1% resistors. If you only need 3-bit DAC for your design, there's no difference whether you use 5-bit or 12-bit DAC (other than cost and such).

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 23, 2020, 06:19:20 pm
content: So anyway, I think you got your answer. Turns out there is still little demand for embedded DACs in MCUs, so the correct introduction to your question would have been "most MCUs don't have any DAC". Then among those that do, they are usually low-res DACs for all the reasons exposed above (noise, cost, die area, etc.) And, as I said earlier, there ARE some MCUs that have embedded DACs with 12-bit or higher. Sure the offer is small (although 12-bit DACs start being relatively common in ARM Cortex-M4+ MCUs), but the demand is probably small as well. Of course, if you're mainly looking at the low-cost MCUs, then the answer is even more obvious if you take the above into account.To better understand why you're considering the matter, it may help to know what kind of applications you have in mind.

author: splin
author_rank: Frequent Contributor
timestamp: January 24, 2020, 01:03:19 am
content: Quote from: SiliconWizard on January 23, 2020, 06:19:20 pm"Turns out"? Do you have access to sales figures for a major MCU manufacturer or are you just speculating? I assumed you were an active engineer (who don't often have access to that sort of information) rather than a sales/marketing type. You may well be correct but it would be helpful to have some idea of how much credibility we can reasonably assign to such a claim. I personally can't think of anywhere near as many applications needing a DAC compared to an ADC but that isn't saying much!Or are you basing it on the percentage of MCU model variants which include a DAC? That doesn't tell you anything about the relative sales of those variants - chances are, on that basis, you could could draw the same conclusion about demand for CAN bus peripherals. Sure CAN hasn't been around that long but maybe demand for a decent DAC goes hand in hand with the need for commensurate processing speed for signal processing? DMA or fast interrupt handling is also likely required for any non-trivial DAC application, also eliminating most old 8 and 12 bit MCUs. (Actually I would have loved to have had an 8048 variant with 2 x 8 bit DACS for our 1200b/s modem design back in the early '80s but they didn't exist!)QuoteCortex M0, STM32F0x (apart from the x0) have 12 bit DACs and I'd say they are pretty mainstream. Well I say 12 bit but they are only linear to 10 bits and there are no noise specifications so they could be even less. Still a bit of dithering, oversampling and filtering could address those problems and still maintain a much higher bandwidth than a PWM DAC whilst preserving a valuable timer for some other important use.Interestingly I can't find any noise specs for any STM32 DAC nor, unlike their ADCs, any questions or discussions on the 'net about it. So perhaps you are right and nobody cares.Does anybody here have any real numbers for any MCU's real world DAC noise performance?

author: David Hess
author_rank: Super Contributor
timestamp: January 24, 2020, 08:34:37 pm
content: Quote from: coppice on January 23, 2020, 09:47:43 amActually noise is a big problem. At the 16 bit level, even discrete ADC and DACs have problems with noise. Very few if any microcontroller converters achieve even 12 bits noise free.

author: iMo
author_rank: Super Contributor
timestamp: January 24, 2020, 09:11:10 pm
content: My first 32bit board ever was the stm32L100 VL Discovery. It has got 2x12b DACs. I did some measurements with the DAC and it fit my 3.999V meter reading pretty well (even close to zero). No idea about noise.Before that I messed a lot with pic24F and dspic33. Both have got 2x10bit or 12b DACs. I did measurements too - a crappy linearity. The datasheet states the DACs are not intended for DC precision apps but "audio".Thus a decade back there were mcus with 12bit DACs..PS: the basic mcu spec infos on "4-6bit DACs" are usually related to the DACs used with internal Comparators - they set the Comparator's threshold.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 24, 2020, 09:36:09 pm
content: Quote from: imo on January 24, 2020, 09:11:10 pmdsPIC33FJ128GP802 (made in 2007) had a 16-bit delta-sigma audio stereo DAC. But that's totally different from small 5-bit ratiometric DACs in small PIC16s.

author: ogden
author_rank: Super Contributor
timestamp: January 24, 2020, 09:47:53 pm
content: Quote from: splin on January 24, 2020, 01:03:19 amI do not understand this scaremongering of nonlinearities and absense of noise specs for built-in DACs. Every low cost DAC are like that - built in or not. Just opened stm32f302 datasheet, 12-bit DAC have ±4 LSB INL. Comparing to generic I2C 12bit DAC from TI, DAC121C081 having +/- 8bit INL, it does not look that bad at all Some would say that TI have DACs with 1LSB INL. Yes. Their price is good tooSome cost more than stm32f302 which is not only DAC but much more.QuoteString and R-2R <=12bit general use DACs usually do not have SNR specified like "24"-bit audio DACs do.

author: coppice
author_rank: Super Contributor
timestamp: January 24, 2020, 10:06:17 pm
content: Quote from: David Hess on January 24, 2020, 08:34:37 pmIts all about budgets. What you said was true a few years ago, but lots of MCUs are getting 14 to 16 bits of real performance in well laid out designs, and some are doing it at quite high (for an MCU) speeds. They are, however, limited by the cost constraints which dominate thinking in most of the MCU market. When performance is more critical than cost you can find some rather expensive MCUs that sell in relatively small numbers into niche applications which achieve very quiet analogue performance. These massively increase the resources put into power and signal isolation, and ground quality, and use differential circuitry where possible.

author: iMo
author_rank: Super Contributor
timestamp: January 24, 2020, 10:07:54 pm
content: When not happy with an internal DAC (or an external DAC chip) you may still follow this Makerhttp://jayakody2000lk.blogspot.com/2020/01/24-bit-stereo-audio-dac-for-raspberry-pi.html

author: iMo
author_rank: Super Contributor
timestamp: January 24, 2020, 10:26:57 pm
content: Quote from: SuzyC on January 19, 2020, 08:26:18 pmAs I wrote above, the specific purpose of the4-6bit DACsin most today's MCUs is toa) create an input voltage, or ref voltage for the internal ADC(s),b) to create a threshold voltage for the internal Comparator(s),c) their output could be routed to a Pin - that is not its primary purpose, rather a nice to have option, imho.PS: read the datasheet

author: David Hess
author_rank: Super Contributor
timestamp: January 24, 2020, 11:34:46 pm
content: Quote from: coppice on January 24, 2020, 10:06:17 pmSince designers have so much trouble getting 16 bit performance out of discrete 16 bit converters under ideal conditions, I would require proof of that. Now if you mean 16 bit performance out of delta-sigma audio converters and DC instrumentation converters, I might believe that if the external signal conditioning is excluded, and I am dubious about the audio case.

author: aheid
author_rank: Regular Contributor
timestamp: January 25, 2020, 01:02:31 pm
content: I got a STM32F303 on a "bluepill" form factor board. How would I go about measuring the DAC performance? Got access to oscilloscope and 5.5 digit bench dmm.

author: ogden
author_rank: Super Contributor
timestamp: January 25, 2020, 07:04:12 pm
content: Quote from: aheid on January 25, 2020, 01:02:31 pmYou need firmware that can be controlled from PC (though USB CDC serial or just UART), then some test scripting software running on PC which steps through every stm32 DAC code and DMM reading. Why you want to measure DAC performance? Do not trust datasheet or what?

author: mikerj
author_rank: Super Contributor
timestamp: January 25, 2020, 09:18:28 pm
content: Quote from: ogden on January 25, 2020, 07:04:12 pmThe 12 bit DACs in the STM32F103RE did not meet datasheet performance on the few devices I measured, worst case DNL didn't quite meet the +-1LSB spec so not truly monotonic. This was limited to a handful of codes and it didn't exceed the spec by a lot.

author: aheid
author_rank: Regular Contributor
timestamp: January 25, 2020, 10:41:13 pm
content: Quote from: ogden on January 25, 2020, 07:04:12 pmThanks, just thought I'd do it as a learning experience, and to see how the real-life performance of these boards is.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 26, 2020, 06:17:32 pm
content: The blessings of owning an old analog oscilloscope.One great advantage an old analog oscilloscope has over even the most costly digital scopes is the ability to view vertical channel signals withexcellent linearity, monotonicity and resolution, there are no digital 8-bit limited steps to their vertical channels, no digitization dither noise. They are also capable of seeingslowevents in real time, there is no wait for the digital scan to complete before viewing the saved results(the use of rolling sweep on digital scope is a very poor substitute!) On an analog oscilloscope it is even possible to magnify the view (within) limits of the vertical channel without severely distorting the viewed portion of a much larger waveform that would fit into the vertical limits of the visual jug at a certain v/div. I love my old Tek!Is is very easy with an analog scope to see each DAC step for an 8-bit (or even a much higher resolution) DAC. Just take it through a fairly slow step by step ramp walk and dance levels from the floor to the reference top and back down again, and you can clearly see if the individual output DAC steps are "on the level". Non-monotonic steps stand out in a crooked, retro-way!Why is this useful. To cite just a few uses, for some of my medical/scientific studies, creating even a 8-bit precise, stable reference point allows magnification of observations around/at a certain set/known reference point/certain bias level. Audio synthesis, speech becomes intelligible, musically just bearable at even the low level of 8-bits.Sure, anyone can externalize their DAC needs it they don't mind dedicating MCU pins and MCU code/mcu time for use for an interface, but IMHO it would be a so much more versatile MCU that can be this handy and cost-saving and space saving.It is nice to have all the tools for a job in one basket, even if the basket size is just 8-bits. With 5-bits, the basket is just a poke.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 26, 2020, 06:55:23 pm
content: Quote from: SuzyC on January 26, 2020, 06:17:32 pmWhat MCUs are you talking about? PIC16? There are some with 8-bit DACs - PIC16F16xx and PIC16F17xx. Some of these - PIC16F176x and PIC16F177x have 10-bit DACs. These all are ratiometric DACs.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 26, 2020, 07:02:13 pm
content: Thanks NorthGuy, I know that, but why tease us with other mcu offerings with only 5-bits, if a DAC is to be offered at all?

author: ogden
author_rank: Super Contributor
timestamp: January 26, 2020, 07:59:08 pm
content: Quote from: SuzyC on January 26, 2020, 07:02:13 pmIt was already explained here in this same thread. Many applications are fine with 5bits or even less. FYI generic sigma-delta audio DAC isone bit DAC, many Class-D audio amplifiers as well.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 27, 2020, 01:42:27 am
content: Quote from: SuzyC on January 26, 2020, 07:02:13 pmMicrochip have huge variety of PICs. They sell almost 2000 different PIC parts. It would be impossible to put everything they have into a single model. You pick the PIC you need for your project - every time a new one, because every project is unique. This way you get exactly what you want.

author: ogden
author_rank: Super Contributor
timestamp: January 27, 2020, 09:17:37 am
content: Quote from: NorthGuy on January 27, 2020, 01:42:27 amRight. In case PICs do not provide what you are looking for, there are other manufacturers and other MCUs. For example mouser.com today have 14878 various kinds ofmicrocontrollers in stockout of total 43801 youcan pick from. Many of them have ADC with resolution ranging from 5 bits to 24 bits. Sure you will find many with better than 5bit DACs as well.  Stop pointless whine, better pick your part which you find good and build something.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 27, 2020, 05:15:56 pm
content: Quote from: splin on January 24, 2020, 01:03:19 amI'm just basing this on a personal observation of the MCU market over the years, having probably looked at hundreds of different MCUs and hundreds of projects using them. That's no sales figures, but should give me a reasonable impression of the actual market.Should be obvious though that more MCU models would embed DACs if the demand was that high. You don't need an MBA to figure this out. Don't hesitate to give us detailed sales figures proving the whole thing false though. Meanwhile, it's again just observing what is available, what is frequently used, and why. The why has been already detailed in many posts here.As several of us have said though, the demand seems to be rising a bit, and an increasing number of MCUs now embed at least a DAC. This is relatively recent.And again, we still don't know for sure what the OP is whining about. Sure there's still limited offer in terms of MCUs with DACs, and even less offer with high-res DACs, but there IS some offer. The reason not to consider this offer if needed is the question here. I highly suspect it's just a cost matter, meaning that, like many people these days, the OP is just waiting for Santa to bring high-precision devices for a couple cents. Also typical whine of people thinking that the price of just anything should be a few cents, and higher than this is just being ripped off. A reality check would be in order there.

author: David Hess
author_rank: Super Contributor
timestamp: January 27, 2020, 06:06:06 pm
content: Quote from: SiliconWizard on January 27, 2020, 05:15:56 pmThey do embed DACs in the form of PWM channels which are ideal for the most economical CMOS digital processes. The only extra these processes include is floating gate memory.They can manage capacitive redistribution converters up to about 10 bits so 8 to 12 bit successive approximation converters are common but I suspect DACs built this way are less economical because the needed large sample-and-hold capacitor takes up a lot of space no matter what process is used. (1) (3) The total chip area directly affects yield and cost so feature size independent structures like big capacitors cost relatively more on denser processes.What I do not understand is why delta-sigma converters are not more common. (2) My guess is that either they take too much space such that they would multiply the cost or the economical CMOS digital process is too noisy when an integrated microcontroller is included. Maybe 4 pins is too much to dedicate to something the user may or may not use.So for anybody who really needs precision converters and specially DACs, it is more economical to use separate chips built on a more suitable process.(1) The precision of the linear output buffer is a problem also. There are ways to make a precision comparator without a linear differential pair for a charge redistribution successive approximation converter (DRAMs do it also) on a digital process but how do you buffer the linear output of a DAC when your CMOS buffer has poor precision and high noise?(2) Precision discrete delta-sigma DACs are also not common except for audio. Why is that? (3)(3) A review of the available precision delta-sigma DACs, and there are only a couple, shows why they are probably not integrated; they require some really big capacitors for output filtering. If they were made external, then the converter just requires too many pins. Their specifications are not all that great either. So they save little or nothing over a simple PWM output.

author: coppice
author_rank: Super Contributor
timestamp: January 27, 2020, 07:48:48 pm
content: Quote from: splin on January 24, 2020, 01:03:19 amI do have knowledge from involvement in the systems design of MCUs. Systems designers get a lot of casual "wouldn't it be nice if there was a cheap low performance DAC, perhaps to DC bias the op-amps on the MCU die into range" type input from customer visits. However, when you get to hard questions like "would this DAC actually make you buy a shed load of parts at a reasonable price?" you are left with a few hard cases where specific DAC performance is needed for a specific application. In those cases, if the volume justifies the NRE, you will find there is a device (or a small cluster of related devices which use the same die) that contains a suitable DAC. Its gain, linearity, speed, etc. will have been tailored for a specific high volume customer need. That's why you'll find a small sprinkling of 10 and 12 bit DACs in some MCU ranges. If you look at the complete peripheral mix on this chips, and you have some suitable applications knowledge, you might be able to identify the application the chip was designed for.

author: ogden
author_rank: Super Contributor
timestamp: January 27, 2020, 09:24:26 pm
content: Quote from: David Hess on January 27, 2020, 06:06:06 pmPWM is good enough for low frequencies downto DC. Fast update requires string DAC anyway, so nothing much is left for (high resolution) sigma-delta DAC. Analog Devices had 16-bit delta-sigma modulator DAC in ADuC8xx series (likeADUC832). Modern AD MCU's do not have such peripheral (AFAIK). BTW for low update speed or just DC applications one can simply precompute PDM or DSD bitstream (pulse density modulated / direct stream digital) and send it out through SPI peripheral effectively emulating sigma-delta DAC using software + SPI.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 28, 2020, 01:34:06 am
content: Quote from: ogden on January 27, 2020, 09:24:26 pmYep.Another thing that could be a consideration is the power draw and the clocking scheme.A "static" DAC can be beneficial in situations where you'd need a constant voltage out of it even when the MCU is in deep sleep with all clocks stopped. Obviously, any dynamic kind of DAC (from PWM to PDM to a full-fledged sigma-delta) requires constant clocking, which in some cases can be a problem/inconvenient. So different types of DACs are not necessarily all a fit for all applications.

author: splin
author_rank: Frequent Contributor
timestamp: January 28, 2020, 03:36:47 am
content: Quote from: coppice on January 27, 2020, 07:48:48 pmCould it have been you that dropped the tantalizing suggestion that that (a large customer asking for a unique part in very large volume) is exactly why the LPC4370, a 204MHz triple core MCU with its wholely unique 80MSPS 12bit ADC exists and is available on the open market? I'd love to know what it was developed for. Probably something dull like a radar speed gun.It's also the case that occasionally you come across some parts with a bizarre collection of functions that can leave you scracthing your head for some time trying to figure out exactly what it was designed for. Must be a nightmare for the writers of the datasheet and marketing blurb to try to express some coherent purpose for the device and its functional blocks without spelling out its original purpose. No I can't remember the particular part I was think about!

author: westfw
author_rank: Super Contributor
timestamp: January 28, 2020, 08:43:53 am
content: QuoteWell, if some big customer essentially pays the NRE for some weird peripheral. SOMEONE is going to think that maybe it's a good idea to plunk that peripheral onto other "general purpose" chips as well.At some point you get the feeling that there might be an allocation of chip area: "Well, if you're going to add that much program memory, it's going to leave some empty space on the chip where we can stick some more peripherals..."

author: coppice
author_rank: Super Contributor
timestamp: January 28, 2020, 03:41:42 pm
content: Quote from: westfw on January 28, 2020, 08:43:53 amIn the 90s there were a lot of MCUs where a customer wanted them so badly they paid the NRE, and the part never reached the open market. There were also quite a lot where a customer paid a chunk of the NRE and the part went to the open market some time (say, 6 months or a year) after the part went to the lead customer. I don't hear about that happening so much now. Its more common for the silicon vendor to seek out a market opportunity, work with some customers in that business, find exactly what would suit all of them (people making essentially the same product tend to have some variation in the bells and whistles they add to their version of the product), and then develop a part to suit them all. That means the silicon vendor has to commit the NRE themselves, but avoids the problem of having almost, but not quite, what the open market wants. Its easy to lose big orders to a competitor because you lack one odd pin that people need, and it would take another 6 cent logic chip as an I/O expander to imitate that pin.

author: mark03
author_rank: Frequent Contributor
timestamp: January 28, 2020, 04:28:55 pm
content: A 2nd-order delta-sigma modulator is such a trivially small bit of circuitry, and makes PWM DACs so much easier to use (less filtering required for given resolution), that it is baffling to me why they are not standard in MCU timer/PWM peripherals. Sure you can use the processor to do the calculation and shove the bitstream out SPI, but just a handful of gates would relieve that burden.I have become skeptical of arguments of the sort "if X was actually demanded by customers, then X would be offered by vendors". A more typical scenario IME is that we start out with a state where nobody is offering feature X. This is then cited as evidence by all of the vendors (and not a few engineers!) that there must not be a market for feature X, otherwise surely *someone* would be offering it. Self-fulfilling prophecy.tl;dr: Never ascribe to market forces that which can be adequately explained by laziness and risk-aversion.

author: Howardlong
author_rank: Super Contributor
timestamp: January 28, 2020, 04:40:51 pm
content: Quote from: NorthGuy on January 24, 2020, 09:36:09 pmThe datasheet only gives it an SNR or 61dB, or effective enob of 9.8 bits. There have been a number of complaints over on the Microchip forum about its performance over time. Might pass for telephony applications, but not much else!

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 28, 2020, 05:01:15 pm
content: Quote from: Howardlong on January 28, 2020, 04:40:51 pmIndeed. Designing a 16-bit (or higher) sigma-delta DAC with decent characteristics is not at all as trivial as many seem to think. Beyond the internal noise in the MCU, there is also just the DAC itself. Without proper digital filtering, you're never going to get much better. This is the part that actually takes area (and know-how) in good high-res sigma-delta DACs, the rest being relatively trivial. You can get by using simpler digital filtering if you're going for very high oversampling ratios (meaning, VERY: for instance, a typical, mid-range 24-bit DAC with ~20 bits enob at x256 oversampling will still require some involved digital filtering to get those 20 bits). Ultra-high oversampling ratios to mitigate simple digital filtering can be practical if you target DC/low-bandwidth DACs, not so much for higher bandwidths (and that's still wasted power draw...)As mentioned earlier, the MCUs/DSPs with good integrated high-res DACs are often SoCs with a separate die for the DACs.Getting back to DC accuracy, sigma-delta DACs are inherently not that good for DC accuracy. Definitely not what they're best at.

author: rcbuck
author_rank: Frequent Contributor
timestamp: January 28, 2020, 10:10:49 pm
content: QuoteI used the PIC16F1718 part a couple of years ago to send telephony paging from one building to a remote building a few miles away. The PIC16F1718 has a 10 bit ADC and an 8 bit DAC. I used the ADC to convert the telephone paging audio at the main building and fed it through the UART to an USIOT USR-K2 module. The K2 module sent the data over the internet to the remote building.At the remote building the K2 module sent the data to PIC16F1718 to the UART which fed the DAC. The DAC output fed the paging amplifier input. I can't find the schematics right now but I think I remember I had to do some RC filtering out of the DAC to eliminate noise. The units have been in service for over 2 years with no glitches.I do remember that I created a 1K circular buffer at each end to store the audio before it was processed. I was going to re-create the project using a PIC32 to eliminate the K2 module but never got around to doing it.

author: ogden
author_rank: Super Contributor
timestamp: January 29, 2020, 08:29:56 am
content: Quote from: SiliconWizard on January 28, 2020, 05:01:15 pmWhat?Why you say so? Sigma-delta DAC is as DC-accurate as PWM DAC, properly designed PWM/PDM DAC is linear enough to be used for DC voltage standard such as Keithley 263 Calibrator.

author: ogden
author_rank: Super Contributor
timestamp: January 29, 2020, 08:55:22 am
content: Quote from: blueskull on January 29, 2020, 08:35:22 amStraightforward/naiive SD ADC implementations have idle tones indeed, but we are talking about DAC here. As an exercise think what actually is DAC of SACD player that plays SACD audio stream

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 29, 2020, 09:47:01 am
content: You can trade an idle tone, or the spurs of multiple tones, for wideband noise, given a suitable coding (a random permutation of pulse patterns?), but you can't change the fact that the output is dithering back and forth and therefore must change by an average of one bit every N for a commanded step change of 1/N.The average case can be quite good, for example 50% is 1 bit every 2, which can run at Fclk/2, but the worst case will always have codes that don't fit conveniently into a given period, and thus a low frequency component.On a related subject, you can get considerably more average-case resolution from a PWMDAC by changing the PERIOD register at the same time. This is easily calculated, say given the limitation that the PERIOD register should sit in the range PERIOD_MAX/2 to PERIOD_MAX. (It doesn't need to, it could go down to PERIOD = 2 if you don't mind, but this does increase the relative error due to switching edges and settling, and draws more current too.) One method is to treat the input number (say a 16 bit value) as fractional (i.e., in taking range 0 to 65535/65536), and calculate theconvergentsof that fraction. Stop iterating when the ratio is exact, or when the denominator exceeds PERIOD_MAX. If the denominator is less than PERIOD_MAX/2, shift it left (double it) until this is true.I once calculated this, let me see... I think what I had was:For fractions from 39000 to 43000 (/65536), PERIOD_MAX = 8000:Max error: 0.32 LSBMin error: 0, of course (there are 241 exact codes out of 4000 total, spaced in multiples of floor(65536/8000) or 8 apart)RMS error: 0.0028 LSB (17.4 ENOB*)Min iterations: 4 (iterations of the convergents algorithm)Max iterations: 18It may be, the restricted range was selected because ratios further from 0.5 have progressively worse performance (obviously enough -- you can't get a ratio of 1/65536 at all from a 13-bit counter!); or maybe out of laziness because plotting sixty five thousand goddamn points in Excel is a dumb idea.*Effective number of bits, i.e., assuming the given setpoint is desired exactly. I've accounted for the narrow range spanned by these data (about 4 bits shy of a full range; the RMS resolution is closer to 21 bits absolute, but that would be unfair). Note this figure goes to infinity as PERIOD_MAX approaches 65536, because a 16-bit counter can perfectly reproduce every 16-bit fraction. The overall resolution is then limited by the fraction's quantization noise.I suppose I should actually calculate it as the RMS between convergent error and input quantization error. But that wouldn't be very interesting because the quantization dominates in this case. Which actually implies a smaller PERIOD_MAX could be selected, if greater worst-case error is tolerable.If I'm not mistaken, one iteration of the algorithm requires: 1 div, 2 mul, 6 add. I forget offhand if the division can be removed; otherwise, this is quite reasonable on most MCUs for a real-time system.Tim

author: ogden
author_rank: Super Contributor
timestamp: January 29, 2020, 10:25:11 am
content: Noise specs of decent >=24-bit audio DACs are better or equal to 120dB SNR. For example AD1955 datasheet specify Zero Input (DC) noise as -121dB. When we consider that 120dB is 20-bit dynamic range, such DAC for up-to 18-bit DC applications seems like fine choice.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: January 29, 2020, 01:24:12 pm
content: Speaking of which, the 8 bits DAC of my favourite µC (the esp32) can be driven via DMA at up to 13.5 megasamples/s:Cheers, @bitluni!

author: coppice
author_rank: Super Contributor
timestamp: January 29, 2020, 01:53:14 pm
content: Quote from: ogden on January 29, 2020, 08:29:56 amHave you tried looking at the DC specs for actual sigma-delta ADCs and DACs? The linearity is usually superb, but there is usually a fairly big DC offset that wanders around quite a bit with temperature. This issue can be tamed, and there are instrumentation sigma-delta converters which do achieve good DC results, but it costs and isn't usually done.

author: schmitt trigger
author_rank: Super Contributor
timestamp: January 29, 2020, 02:51:10 pm
content: Quote from: coppice on January 27, 2020, 07:48:48 pmI think that this is the most sensible answer so far.If a microcontroller company, any company, determines that they can produce a particular feature reliably, at a price point which will have mass-market appeal and their NRE recouped in a reasonable time, then said feature sooner or later will get incorporated into the microcontrollers.Simple as that. The market's "invisible hand".

author: ogden
author_rank: Super Contributor
timestamp: January 29, 2020, 04:12:00 pm
content: Quote from: coppice on January 29, 2020, 01:53:14 pmI did even better than that. - Wroteprevious post.QuoteWidely known SD ADC (&DAC) problem is presense of DC idle tones, the closer to midrange, the lower freq of the tones, but what is DC offset wandering? Citation needed. Pointers to datasheet figures showing that will be helpful as well.

author: coppice
author_rank: Super Contributor
timestamp: January 29, 2020, 05:02:09 pm
content: Quote from: ogden on January 29, 2020, 04:12:00 pmYou shouldn't see idle tones from a modern sigma delta ADC, but if you zero the input do you get zero for the digital result? In most devices the offset you get is quite significant, and moves around quite a lot as the temperature changes. The datasheets usually specify the size of the offset properly, but they don't usually tell you its likely to wander quite a bit with temperature, and you can't just calibrate it away. The offset you are seeing is not from the digital processing. Its from the front end. If its a switched cap front end its usually better than if its a continuous time front end. I think most of the converters you'll find on MCUs have switched cap front ends. Sigma delta DACs are subject to the same issues are ADCs.

author: ogden
author_rank: Super Contributor
timestamp: January 30, 2020, 10:14:00 am
content: Quote from: coppice on January 29, 2020, 05:02:09 pmThey are still there, just suppressed below noise floor with dithering. Actually good question what comes first - noise floor spec or level of idle tone spurs.QuotePerhaps most of audio ADCs drifts, for example mentioned AD1955 have 25ppm/oC gain drift. On the other hand offset error drift of LTC2400 is 0.01 ppm of VREF/°C and 0.02 ppm full scale error drift. That means not every SD ADC as you say "wanders around quite a bit with temperature". For a moment you got me worried...

author: coppice
author_rank: Super Contributor
timestamp: January 30, 2020, 10:26:15 am
content: Quote from: ogden on January 30, 2020, 10:14:00 amGain drift and DC shift are completely separate things. The gain drift of a sigma-delta converter is a combination of two things - the temperature stability of the reference, and the temperature stability of the gain of the front end modulator. In most cases the reference will dominate. In some cases you can use an external reference, and improve that figure, but not all sigma-delta converters support the use of an external reference.

author: ogden
author_rank: Super Contributor
timestamp: January 30, 2020, 11:32:48 am
content: Quote from: coppice on January 30, 2020, 10:26:15 amGain drift for ADC which have "floating" zero at 1/2 Vref means that zero drifts as well. Anyway please be so kind and open datasheet of LTC2400, show where it's specs confirm your words "wanders around quite a bit with temperature". For a fun let's check TM7705, 1$/1piece 16-bit SD ADC. Zero drift: 0.5 μV/℃ typ. Note that LSB of 16-bit ADC with 2.5V reference is 38uV. Where is "wanders around" - I can't find. Citation needed.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 30, 2020, 03:30:01 pm
content: Seems also odd to me that everyone posting here is clearly only speculating about the why's and why nots of having at least ~8-bit DACS.Why is it that anyone working at Microchip or any other MCU mfg fails to post any feedback to this board?It would be nice, once in a while, to get the facts from someone who really knows.Kinda like a Trump Impeachment trial.

author: splin
author_rank: Frequent Contributor
timestamp: January 30, 2020, 03:50:40 pm
content: Quote from: ogden on January 30, 2020, 11:32:48 amThe LTC2400 auto calibrates zero and gain every conversion.TM7705 has a chopping input to elimate zero drift. I believe it is an AD7792 clone or at least very similar which also autozeros every conversion.It's easy with an ADC, requiring only an analogue mux to periodically connect the input to ground to measure offset. Much harder to do with a DAC as you'd have to output a zero code and measure the offset with an ADC - whilst maintaining the signal output using a sample and hold. If you had an ADC that outperforms the DAC then you could measure the DAC error directly but that would likely be an expensive solution.I'd suggest that neither solution would be feasible for an MCU DAC peripheral. Minimising zero drift would have to be in the analogue domain.Comparing ADC and DAC

author: Jan Audio
author_rank: Frequent Contributor
timestamp: January 30, 2020, 04:04:10 pm
content: Suzy try at : microchip.com/forumsI think it is a good marketing strategy, i bought chips because it had a DAC ( i did not see it was useless 5-bits )

author: coppice
author_rank: Super Contributor
timestamp: January 30, 2020, 04:09:20 pm
content: Quote from: splin on January 30, 2020, 03:50:40 pmIts actually quite hard to do this if you want high accuracy. Take a multi-input ADC on a well laid out board with a good ground. Connect all the ADC inputs together, and scan around sampling them all. In most cases they don't quite agree, because of small DC offsets through the mux, which are a little different on each mux channel. It takes really careful design, and additional die area, to completely drive those offsets from the design.

author: coppice
author_rank: Super Contributor
timestamp: January 30, 2020, 04:11:59 pm
content: Quote from: SuzyC on January 30, 2020, 03:30:01 pmYou definitely do get input from people in the know. However, most people don't wish to advertise their current or former employer's names. Every vendor has haters, sometimes for good reasons, and sometimes for bad. These people have a nasty tendency to lay into anyone they can associate with a vendor they hate.

author: ogden
author_rank: Super Contributor
timestamp: January 30, 2020, 06:57:16 pm
content: Quote from: splin on January 30, 2020, 03:50:40 pmRight. That's my point that SD ADC's (that I know) aimed at low freq/DC applications do not "wander around quite a bit with temperature". Existence of zero calibration in those ADC's actually strengthens my argument.QuoteFair point. There are not that many "non-audio" SD DAC's to start with. One I know, DAC1220 have 1ppm/oC zero offset drift specs. Still do not qualify as "wander quite a bit".

author: JPortici
author_rank: Super Contributor
timestamp: January 30, 2020, 11:22:00 pm
content: Before calling them useless, dacs are not only to be used for high res signal generators. Altough 5 bits can be adequate for sine waves if properly filteredFrom what i gathered the 5bit dac is there because it was initially used as threshold for the internal comparators and for that role it is adequate.Add a buffer, route to a pin and you can put DAC output on marketing materialIn more advanced parts like the dsPIC33C there are multiple 12bit DACs but only one DACOUT pin. AGAIN, the DAC serves as a setpoint for the internal comparators and other analog blocks (in this case for motor control or Digital SMPS) and not for signal generators.

author: Howardlong
author_rank: Super Contributor
timestamp: January 31, 2020, 10:15:40 am
content: I'll also add that most DACs on PICs are simple resistor networks and lack any buffering, so to use them externally you typically need to buffer the outputs. Equally, many of those chips with DACs also have on chip opamps that can be configured internally as buffers for the DACs internally (this doesn't apply to the dsPIC33C which has its own DAC buffer for its DACOUT pin, and the opamps can only be configured externally once enabled).

author: mikerj
author_rank: Super Contributor
timestamp: January 31, 2020, 10:26:28 am
content: Quote from: SuzyC on January 30, 2020, 03:30:01 pmWhy don't you demonstrate why all these people are wrong, and why including 8 bit DACs really wouldn't impose any cost penalty for manufacturers. So far you have continued to insist they should be provided, and rejected all explanations without providing anything to support your own position.Someone with a modicum of critical thinking skills would deduce that if 8 bit DACs were effectively free, and would give manufacturers a competitive advantage by including them, then it would be happening. Do you think this is some kind of conspiracy by "big microcontroller"?

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 31, 2020, 04:18:15 pm
content: Quote from: mikerj on January 31, 2020, 10:26:28 amYup.And, we still don't have any answer as to the applications where the OP would need 8 bit DACs (or higher), and that couldn't be fulfilled with the existing offer (as I said, probably just for cost reasons, and the OP still doesn't want to listen to the reasons why DACs are costly) or alternatively implemented with just PWM or SDM.Additionally, we also don't know whether the 8-bit would just be for the numbers or for a real accuracy need. Point is, a crap (read: simple and inexpensive) 8-bit DAC will have no more than 5-6 enob anyway. Would the OP still want an MCU that avertises an 8-bit DAC with that kind of characteristics, so they can feed the peripheral programmatically a full 8-bit word?As you also mentioned, proper output buffering is also an issue and has a cost. Unless the MCU also embeds opamps usable for this (with low enough offset and RRO - which is not that cheap either) (of course you'll be expecting the whole 0V-Vref range!), you'd often need an additional buffer IC anyway - so you can as well use an external DAC for the same part count.As I said earlier, it ultimately looks like a battle for low-cost, just assuming that semiconductor vendors are crooks. Well, not just crooks, but also clueless apparently, since some seem to think it's not just a market/cost reason, but just that they don't want to "innovate".Why don't you design your own MCUs all with good embedded DACs, targetting the sub-dollar price tag (because above that, you can definitely find some MCUs with decent DACs), and see how that goes?

author: David Hess
author_rank: Super Contributor
timestamp: February 01, 2020, 03:32:03 am
content: Quote from: SuzyC on January 30, 2020, 03:30:01 pmIt is more than speculation. We *know* that the common digital CMOS processes (1) being used are not suitable for better DACs at any price. Even their built in references are horrible. In my earlier posts, I described some of the problems.(1) Common packaging technologies are also not suitable for analog precision. Analog ICs use a encapsulation inside the package which prevents stress from being applied to the semiconductor die.