smay4finger,
thank for the patch I'm testing it in the next hours, in case may you open a pull request on github so i can merge it?
C
smay4finger,
thank for the patch I'm testing it in the next hours, in case may you open a pull request on github so i can merge it?
C
Hi,
I tested your patch and I think it works!
I attach a sketch that generates a sine wave on both the DAC outputs phase shifted of pi. To prove I add the screen capture of the oscilloscope.
+1 Karma is deserved
DAC_Sine_Due.ino (2.63 KB)
DS0003.BMP (16.6 KB)
I made a bug report here: Google Code Archive - Long-term storage for Google Code Project Hosting.
Please use the patch attached to the ticket. There is also a bugfix regarding corruption of the data register, when writing too fast.
Done, thank you.
C
"I tried the DACC on the Arduino Due, but it doesn't work as expected. I used the function analogWrite() for setting a new DAC value. The following code will work as expected:"
byte value;
void loop() {
analogWrite(DAC0, value++);
}
Hello, when i test the DAC on the DUE i measured an Outputvoltage from 0,55V (value 0) to 2,77V (value 255). I thought the DAC has a range from 0V to 3,3V?! Do anybody knows more or can help me?
greets
parasound
"Hello, when i test the DAC on the DUE i measured an Outputvoltage from 0,55V (value 0) to 2,77V (value 255). I thought the DAC has a range from 0V to 3,3V?! Do anybody knows more or can help me?"
Hi all!
I would be interested in this too. Could not figure out yet why DAC range ist approx. 0,54V - 2.74V (both channels).
andy_G
Hi parasound and andy_g,
I could find no information about the DAC range in the SAM3X datasheet.
But on page 1059 of SAM3S datasheet, it is said that the voltage range of the DAC is from (1/6) x VADVREF to (5/6) x VADVREF.
So I suspect, the same applies to SAM3U, and range is 1/6 x 3.3V = 0.55V to 5/6 x 3.3V = 2.75V, which is verified by your measures.
wibauxl
Ok.
Thank you wibauxl.
wibauxl:
Hi parasound and andy_g,I could find no information about the DAC range in the SAM3X datasheet.
But on page 1059 of SAM3S datasheet, it is said that the voltage range of the DAC is from (1/6) x VADVREF to (5/6) x VADVREF.
So I suspect, the same applies to SAM3U, and range is 1/6 x 3.3V = 0.55V to 5/6 x 3.3V = 2.75V, which is verified by your measures.wibauxl
That seems pretty limiting. You mean one can't measure output signals between below .55 volt? There must be more to the subject then that?
Lefty
We're talking about the DAC here. The ADC works at voltages below 0.55v.
As far as the DAC is concerned it's a pity to have such limits but I guess for audio applications there are way to circumvent the issue.
m
Well I don't yet own a Due and not up to the task just yet of taking on the huge datasheet for this uP, but they must talk about this range restriction if indeed it's a hardware based restriction. I just find it very hard to except at this time that there is a legitimate reason for this. I guess it could be compensated for with external op-amp with a -.55v offset, but still there just must be more to this subject then 'that's just the way it is'? It's really not a problem for audio type applications as one could just capacitance couple the signal, but for precision DC DAC applications, not being able to reach ground potential is a pretty big deal, no?
Lefty
...what would also make sense resolution-wise: LSB seems to be 0.5mV (measured) which is in line with wibauxl's theory ((2.75-0.55)/4096=0.537mV). This DAC behaviour -and te lack of it's documentation- is a little odd to my opinion, but at least there's an explanation that makes sense.
MANY THANKS FOR ALL YOUR INPUTS!!
andy_g
andy_g
The Due is still in beta, there is still work to be done on the documentation.
m
wibauxl:
I could find no information about the DAC range in the SAM3X datasheet.
But on page 1059 of SAM3S datasheet, it is said that the voltage range of the DAC is from (1/6) x VADVREF to (5/6) x VADVREF.
So I suspect, the same applies to SAM3U, and range is 1/6 x 3.3V = 0.55V to 5/6 x 3.3V = 2.75V, which is verified by your measures.
I've just checked with Atmel support and they confirm that SAM3S and SAM3X features the same DAC IP, what you have measured is correct.
Yes, for audio applications, if voltage range of the DAC is from (1/6) x VADVREF to (5/6) x VADVREF then you use a differential op-amp with the second input connected to (1/2) x VADVREF - though it would require a symmetric power supply. Or just use a DC blocking capacitor.
It is a surprising limitation for other uses, though.
Hello,
i'am experiencing the same problem as smay4finger described in original post, using this code:
void setup() {
analogWriteResolution(12);
analogWrite(DAC0, 4095);
analogWrite(DAC1, 4095);
}
void loop(){}
however, this code set correct output values:
void setup() {
analogWriteResolution(12);
analogWrite(DAC0, 4095);
analogWrite(DAC1, 4095);
delay(2);
analogWrite(DAC0, 2047);
analogWrite(DAC1, 1023);
}
i suspect problem in this line in wiring_analog.c:
while ((dacc_get_interrupt_status(DACC_INTERFACE) & DACC_ISR_TXRDY) == 0);
but you guys know better.
Regards,Vladimir
@vdorr
Hi,
Are you using the amended code (Reply #2)?
Jim
@vdorr
OK, I'm using 1.5.1r2.
The following works as expected here, giving independent control of the two DACs:
while (true)
{
analogWrite(DAC0, 240);
delayMicroseconds(200);
for (int i = 0; i < 8; i++)
{
analogWrite(DAC1, 240);
delayMicroseconds(20);
analogWrite(DAC1, 120);
delayMicroseconds(80);
}
analogWrite(DAC0, 0);
analogWrite(DAC1, 0);
delay(9);
}
Several people in this forum seem to have had trouble and have possibly blown their DAC output(s) by following an Audio example with a loudspeaker (which I haven't tried).
For anyone following with an 'early production' Due like me, please note that the constant 'DAC0' (66) corresponds to pin 'DAC2' on the board header, and 'DAC1' (67) corresponds to pin 'DAC1'.
Attached are screenshots from a Rigol scope. N.B. I'm using x10 probes.
HTH
Jim
aaa.bmp (146 KB)
bbb.bmp (146 KB)
i guess you are writing DAC in loop() but my (non-working) example was writing DAC in setup(), your code also has delay before writing second DAC channel, just like my second (working) example. In my opionion, there is bug in analogWrite(), related to initialization of DAC.
V.