DAC output speed

Hi everyone!

I'm completely new of both the forum and the Arduino world. I looked around and I could not find a satisfactory answer to my question. I hope I didn't miss anything important.

I literally started working on a concrete project today. The objective is using an Arduino DUE board to lock an optical cavity. However, for the moment I'm just doing some tests to check whether I like this board or not considering the scope and practicing a little with it.

Currently, I'm supplying a signal to one of the analog pin, passing it to the DAC, and reading its output on the oscilloscope. As an input signal, I'm using a sine wave, 3 Vpp with 1.5 V offset DC so to have it completely positive. As for the frequency, I tried from 100 Hz to 10 kHz. On the high-frequency side, I notice that the output from the DAC is kind of steppy, with each step being ⁓ 10 μs wide. I guess this is because either the reading or writing commands, or both, work on that time scale. Is there any way to improve it?

Here is the code I'm using (very simple, just read and write)

void setup() {
  pinMode(A0, INPUT);
  pinMode(DAC1, OUTPUT);
  analogWriteResolution(12);
  analogReadResolution(12);
}

int i;

void loop() {
  // Reproduces the signal read from A0:
  i = analogRead(A0);
  analogWrite(DAC1, i);
}

Thanks for any answer!

Seems likely, using defaults and Arduino device libraries that are not optimized for speed.

The SAM3X8E Arm Cortex M3 on the Due is a very powerful processor, and to optimize that speed will require delving deep into the data sheet and device libraries, which is not the faint of heart.

1 Like

Do you think 12 bit resolution is enough?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.