Horrific DAC noise on DUE board

Is it just my (genuine) Due board, or is the DAC output on all Dues so noisy as to be effectively useless?

Write yourself a two-line program, with these statements in setup()

analogWriteResolution(12);
analogWrite(DAC0,100);

Then look at the DAC output with a CRO on AC coupling. There is nothing particular about setting the DAC output to "100", the output is complete rubbish no matter what you set it to. The DC level is fine, but the noise is just ridiculous.

How ridiculous?

The Due DAC is restricted to producing DC levels of between 0.55 V and 2.76V (which is a right pain and another story) so the total swing is 2.21V. Therefore 1 LSB is 2.21/4095 = 0.54mV. Fantastic.

Unfortunately, the noise is around 20 mV P-P, which represents 37 LSB!!!!

As you see, this is not just random noise, but discrete steps of apparently random amplitude occuring every 100 us. Unlike issues that the Due has with its analog inputs, the problem is unaffected by adding or removing other bits of unrelated code.

What is going on here?? There is no way I will believe that the SAM3X chip can (or at least should) be this bad. Is it a problem with all Due boards, or just mine?

I'll try in 10-bit mode and see if that makes any difference ....

The Due is powered from a battery, so no issues from noise on the USB.

qwerty99:
I'll try in 10-bit mode and see if that makes any difference ....

Just the same, and the problem occurs on both DAC channels.

Damn. Might as well throw it away, for all the good it is to me .... I can't even filter the noise out, because the filter frequency would need to be so low that I'd have no DAC bandwidth left.

If my particular board is faulty, then I'll return it, but if they are all like that, then I'm sorely disappointed.

Take a look at the 3.3v & 5v pins on the Due with your scope, even though you are using a battery there is probably a voltage regulator on the power rails. If it has the same type of noise you may get somewhere by filtering the output of the regulator.

A quick look at the Eagle files shows the DAC chip pins going directly to Due pins so there is nothing on that side to add noise.

noblepepper:
Take a look at the 3.3v & 5v pins on the Due with your scope, even though you are using a battery there is probably a voltage regulator on the power rails. If it has the same type of noise you may get somewhere by filtering the output of the regulator.

A quick look at the Eagle files shows the DAC chip pins going directly to Due pins so there is nothing on that side to add noise.

Yes, the first thing I did was to check the supplies. The 5V in particular has a small amount of fixed-frequency noise that looks like switched mode power supply noise, but is much higher in frequency than the noise on the DAC output, which is at a low 10 kHz, 100 us reprate. I also waved the active tip of the CRO probe around the circuit board, looking for any radiated signal or any signal on any exposed pin that looked similar in frequency or character, and found nothing. I also placed the board in a shielded metal enclosure, which had no effect. I also waved the active probe tip, with a small length of wire attached, around my workshop, and found nothing, except of course a bit of mains pickup.

The nature of the DAC noise is very interesting, and I suspect is telling us something of its origin. I don't believe the noise is 'picked up' on the output pin of the processor. I also doubt that the noise is 'picked up' in the normal sense of the word at all. The 'noise' is quite clearly discrete steps in level, occuring every 100 uS, not picked up noise of any type that I have ever seen. It is as if the 4 LSBs of the DAC were changing in some quasi-random manner, such that the DAC was simply responding accordingly, and producing the random steps in level. I'm quite sure I could make any (normally noise free) DAC produce a similar waveform by sending random codes the the 4 LSBs.

That said, I haven't the faintest idea of why the DAC should be behaving in that way. If anyone has any other ideas then I'm interested, and I would also love to know if other people's Due DACs have this noise.

Looks like internal logic switching noise.

Have you looked at the VDDANA pin in particular?

Greg

I also have a problem with the DAC0 (the DAC1 of the DUE is working perfectly.).

That´s my code:

void setup() {
  // put your setup code here, to run once:
analogWriteResolution(12);
}

void loop() {
  // put your main code here, to run repeatedly: 
  analogWrite(DAC0,4095);
  analogWrite(DAC1,4095);
}

And on the DAC1 I get 2.774 V and on the DAC0 a value oscillating between 50 and 190 mV.

What´s going on with my Arduino DUE.

It was working few hours ago and now not anymore.

Thanks for your help,
Fab.

My DUE DAC noise is about half yours which is still unacceptable. Has anyone figured out why that when you analogWrite 0 you do not get 0 volts and when you digitalWrite 4095 you do not get 3.3 volts? Every other 12-bit DAC I have ever used was linear between 0 and its reference voltage. Very strange.

Think this is a driver issue, suppling samples synchronously with the DAC triggered off a timer unit worked for me - I'll
recheck the quality of the output signal.

Can you post the whole sketch please.

It looks like this is simply hardware issue. by default the board has the analog reference connected to the 3.3V rail via
a jumper - this has to be desoldered before the AREF pin will drive it directly. The Due page explains this briefly.

You would then put a proper clean 3.3V onto AREF and hope its a lot better.

There is easily enough noise on the 3.3V rail to account for the steps I think. Anyway the steps are simply when the
DAC cycle completes and puts its output on to the S/H capacitor. The DAC will not be tolerant of a changing
reference voltage during conversion and seems to give the equivalent of sparkle codes because of this.

The same issue will affect ADC too.

Has anyone figured out why that when you analogWrite 0 you do not get 0 volts and when you digitalWrite 4095 you do not get 3.3 volts?

The DAC does not put out a full-scale signal, I think it's 1/6th to 5/6ths or something similar. It's buried in the data sheet IIRC, but I can't find it now.


Rob

Graynomad:

Has anyone figured out why that when you analogWrite 0 you do not get 0 volts and when you digitalWrite 4095 you do not get 3.3 volts?

The DAC does not put out a full-scale signal, I think it's 1/6th to 5/6ths or something similar. It's buried in the data sheet IIRC, but I can't find it now.


Rob

Yes its 1/6th -- 5/6ths, and its not very obvious in the documentation. I think this has
something to do with the conversion method used being a hybrid and needing head room
around the output signal.

I am thinking of adapting my Due to have a functioning AREF (and adding a decent
sized decoupling capacitor on it too), then seeing the difference.

Some observations:

Powering the Due from a laptop USB port is a no-no - mine puts out noise steps
and pulses with perhaps 50mV peak to peak at all sorts of frequencies from audio up.

The DC-DC converter on the Due board is a complete fail - it has hopeless regulation
only attentuating this noise down to about 25mV and retaining all but the highest
frequencies.

IMO not using a linear regulators for the power rails of the SAM chip is a mistake -
one for analog supply, one for digital is what is needed.

Powering the Due from a phone-charger produced a vastly superior baseline 5V and
3V3 rail, random noise down to say 3mV, but switching noise at a fixed frequency of
about 20mV pk-to-pk (and obviously not correlated with the system clock).

This reduced the DAC output noise by about a factor of two, in particular removed
most of the random jitter between samples except for occasional spikes of around 10mV
amplitude - single sample sparkle codes, basically.

This is with a heavily filtered AREF (470uF, 330 ohm RC filter).

So yes, the DAC is being crap, but its not generating noise bigger than the largest noise
on AREF or 3V3 supply. I suspect with a proper analog layout and supply its fine,
note that the current layout has the DC-DC converter chip about 1cm from the DAC0
and DAC1 pins.

Laptop USB supply, 5V top trace, 3V3 bottom trace, both 10mV/div

Charger USB supply, 5V top trace, 3V3 bottom trace, 10mV/div.

(there was no low freq noise to expanded to a faster timebase to show conversion
noise spikes more clearly)

For completeness, the kind of DAC output with the "clean" USB supply:

And with dirty laptop USB:

And an anomoly which hasn't repeated, probably a spike on the mains (was
with the USB charger)

Hi MarkT, it has been long since this post finished but maybe you can help me with one problem.

I have seen your DCA output with "the "clean" USB supply"

MarkT:
For completeness, the kind of DAC output with the "clean" USB supply:

Do you know why do you have those positive and negative spikes around the middle of the photograph?

You also have them in the "dirty laptop USB", but in this case they are two positive spikes.

MarkT:
And with dirty laptop USB:

I am using Arduino Due for first time and I am having the same problem with the DAC output. Did you notice this effect? Is it possible to supress them?

Thanks in advance!

David

There are several ways to power supply your board (in addition to the native USB and programming port, which are not super stable supplies since they come from the PC), and some may be "noisier" than others:

However, if you can't remove spikes with an RC circuit from DACx outputs, you can try using an external DAC via SPI : Goggle DUE DAC SPI to find the right tutorial from schianorobotics.