DUE: bit errors on DACC

Hi there,

I have a problem with the stability of the DAC on an arduino DUE. I am using a very simple sketch, which just writes the value 1024 to the DAC once a second. I would expect to get a constant voltage out, but I can see that there are quite some jumps, which last approximately 100 us. It does not seem to be periodic or anything like it. The difference seems to be more than one bit.

The sketch is as follows:

#define DAC_BITS 12
#define OUTPUT_PORT DAC1

void setup() {
  // put your setup code here, to run once:
  analogWriteResolution(DAC_BITS);
  analogWrite(OUTPUT_PORT, 0);

}

void loop() {
  // put your main code here, to run repeatedly:
  analogWrite(DAC1, 2048);
  delay(1000);
  analogWrite(DAC1, 2048);
  
  delay(1000);


}

Does anyone know what this is? And where the 100 us pulses are coming from? And is there any way to solve it? Would it help for instance to use an external aref voltage?

That indicates to me a problem with your scope probe. Reason may be a bad/inappropriate GND connection.

But, if I use the same program for an arduino GIGA, I don't see it:

Top: Arduino DUE
Bottom: Arduino Giga R1 wifi

So that would not make that likely, would it? Otherwise it's the same setup.