Author Topic: Why do most MCU's (even newest) have only 5-6bits D to A ?  (Read 13116 times)

0 Members and 1 Guest are viewing this topic.

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3238
  • Country: gb
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #75 on: January 25, 2020, 09:18:28 pm »
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.
You 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?

The 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.
 
The following users thanked this post: SuzyC

Offline aheid

  • Regular Contributor
  • *
  • Posts: 245
  • Country: no
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #76 on: January 25, 2020, 10:41:13 pm »
You 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?

Thanks, just thought I'd do it as a learning experience, and to see how the real-life performance of these boards is.
 
The following users thanked this post: SuzyC, ogden

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #77 on: January 26, 2020, 06:17:32 pm »
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 with excellent 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 seeing slow events 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.
« Last Edit: January 26, 2020, 06:57:20 pm by SuzyC »
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #78 on: January 26, 2020, 06:55:23 pm »
Sure, anyone can externalize their DAC needs it they don't mind dedicating MCU pins and time for the 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.

What 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.
 
The following users thanked this post: SuzyC

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #79 on: January 26, 2020, 07:02:13 pm »
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?
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #80 on: January 26, 2020, 07:59:08 pm »
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?
It was already explained here in this same thread. Many applications are fine with 5bits or even less. FYI generic sigma-delta audio DAC is one bit DAC, many Class-D audio amplifiers as well.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #81 on: January 27, 2020, 01:42:27 am »
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?

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

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #82 on: January 27, 2020, 09:17:37 am »
Microchip have huge variety of PICs. They sell almost 2000 different PIC parts.
Right. 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 of microcontrollers in stock out of total 43801 you can 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. [edit] Stop pointless whine, better pick your part which you find good and build something.
« Last Edit: January 27, 2020, 09:45:35 am by ogden »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #83 on: January 27, 2020, 05:15:56 pm »
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".

"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

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

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #84 on: January 27, 2020, 06:06:06 pm »
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.

They 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.
« Last Edit: January 27, 2020, 06:16:31 pm by David Hess »
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8637
  • Country: gb
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #85 on: January 27, 2020, 07:48:48 pm »
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".

"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!
I 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.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #86 on: January 27, 2020, 09:24:26 pm »
(2) Precision discrete delta-sigma DACs are also not common except for audio.  Why is that? (3)
PWM 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 (like ADUC832). 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.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #87 on: January 28, 2020, 01:34:06 am »
(2) Precision discrete delta-sigma DACs are also not common except for audio.  Why is that? (3)
PWM 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 (like ADUC832). 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.

Yep.

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.

 

Offline splin

  • Frequent Contributor
  • **
  • Posts: 999
  • Country: gb
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #88 on: January 28, 2020, 03:36:47 am »
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.

Could 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!   
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #89 on: January 28, 2020, 08:43:53 am »
Quote
occasionally you come across some parts with a bizarre collection of functions
Well, 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..."
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8637
  • Country: gb
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #90 on: January 28, 2020, 03:41:42 pm »
Quote
occasionally you come across some parts with a bizarre collection of functions
Well, 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..."
In 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.
 

Offline mark03

  • Frequent Contributor
  • **
  • Posts: 711
  • Country: us
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #91 on: January 28, 2020, 04:28:55 pm »
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.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #92 on: January 28, 2020, 04:40:51 pm »
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..  ::)

dsPIC33FJ128GP802 (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.

The 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!
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #93 on: January 28, 2020, 05:01:15 pm »
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..  ::)

dsPIC33FJ128GP802 (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.

The 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!

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

Offline rcbuck

  • Frequent Contributor
  • **
  • Posts: 346
  • Country: us
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #94 on: January 28, 2020, 10:10:49 pm »
Quote
Might pass for telephony applications, but not much else!

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

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #95 on: January 29, 2020, 08:29:56 am »
Getting back to DC accuracy, sigma-delta DACs are inherently not that good for DC accuracy. Definitely not what they're best at.
What?  :-// 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.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #96 on: January 29, 2020, 08:55:22 am »
SDM is known to generate static tone at lower modulation orders (first and second), and oscillation at higher modulation orders (second and higher).
SDM can be greatly improved, but a poorly designed SDM will have such artifacts as I mentioned above.
Straightforward/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 ;)
 
The following users thanked this post: SuzyC

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21658
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #97 on: January 29, 2020, 09:47:01 am »
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 the convergents of 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 LSB
Min 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: 18

It 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
« Last Edit: January 29, 2020, 09:49:16 am by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: SuzyC, blueskull, ogden

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #98 on: January 29, 2020, 10:25:11 am »
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.
 
The following users thanked this post: SuzyC

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Why do most MCU's (even newest) have only 5-6bits D to A ?
« Reply #99 on: January 29, 2020, 01:24:12 pm »
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!
The further a society drifts from truth, the more it will hate those who speak it.
 
The following users thanked this post: SuzyC


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf