# Arduino Due DAC0 don't work

**URL:** <https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000>\
**Category:** Due\
**Created:** [September 26, 2014, 5:47pm UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000 "2014-09-26T17:47:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nauj](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@Nauj](https://forum.arduino.cc/u/Nauj)\
**Post date:** [September 26, 2014, 5:47pm UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/1 "2014-09-26T17:47:40Z")

</div>

Hello everyone,

I’m using Arduino DUE (Sam3X8E) for data acquisition trough ADC converter, I need set two voltages values in DAC0 and DAC1 outputs.  
When I try this code yesterday:

```plaintext
void setup() 
{
  Serial.begin(115200);
  analogWriteResolution(12);
}

void loop() 
{
  analogWrite(DAC0, 3150);  // DAC0=2.25V
  delay(3000);
  
  analogWrite(DAC1, 3150);  // DAC1=2.25V
  delay(3000);
      
  analogWrite(DAC0, 0);  // DAC0=0.55V
  delay(3000);

  analogWrite(DAC1, 0);  // DAC1=0.55V
  delay(3000);
}

```

it worked fine (I measure analog output DAC0 and DAC1 with voltmeter, these were well), but now suddenly DAC0 always put values around 0 to the output (-0.007V ~ 0.026V) 😲 however DAC1 works fine.

I'm using arduino-1.5.6-r2 and I read this interesting post about similar error: [DAC support - Arduino Due - Arduino Forum](http://forum.arduino.cc/index.php?PHPSESSID=j2htrv93e7lcsu62ok8hdfu4f5&topic=129765.0) therefore I test top code wit arduino-1.5.7 version with same result, DAC0 doesn’t work fine.

I don’t know how apply this path [https://code.google.com/p/arduino/issues/detail?id=1092](https://code.google.com/p/arduino/issues/detail?id=1092) to my analogWrite() function in the wiring library maybe it was applied already at arduino-1.5.7 version.

Someone have or have had a similar problem?

Any idea or suggestion that might be happening and how to fix it?

Thanks and sorry for mistakes in my English.

 ![DAC_Arduino_Due.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/b/4/2/b42156655dcacb3de2f38749de87b0da481b89d7.jpeg)

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [September 28, 2014, 3:06am UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/2 "2014-09-28T03:06:05Z")

</div>

This sounds like another instance of this problem:  
[http://forum.arduino.cc/index.php?topic=227338.0](http://forum.arduino.cc/index.php?topic=227338.0)

Remember the Due pins cannot drive nearly as much current as the Uno/Mega pins,  
some are limited to 3mA absolute maximum(\*). Perhaps you overloaded the DAC0  
pin somehow?

(\*) The datasheet lists the limits in detail if you can find the right section.

---

<div class="post-metadata">

**Author:** ![Nauj](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@Nauj](https://forum.arduino.cc/u/Nauj)\
**Post date:** [September 29, 2014, 10:29pm UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/3 "2014-09-29T22:29:07Z")

</div>

Hello MarkT!,

Thanks for your reply.

I haven't put values over 4095 to analogwrite() function ever so that I can't overload DAC0.

How can I put more than 3 mA in the output?, I don´t know do that.

How can I test DAC0 for know if it's hardware error or logical error?? (if the DAC0 register was corrupted...)

Thanks again, any help or comment about this will be appreciated, I don't know I can do now.

---

<div class="post-metadata">

**Author:** ![anatolyk69\_gmail.c](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@anatolyk69\_gmail.c](https://forum.arduino.cc/u/anatolyk69_gmail.c)\
**Post date:** [September 30, 2014, 1:15am UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/4 "2014-09-30T01:15:23Z")

</div>

You may check the content of registers, see if anything out of order, and compare channels 1 & 2.

```cpp
      unsigned long reg;
      reg = REG_DACC_MR;
      Serial.print("\n\tREG_DACC_MR = ");
      Serial.println(reg, HEX);   
   
      reg = REG_DACC_CHSR;
      Serial.print("\n\tREG_DACC_CHSR = ");
      Serial.println(reg, HEX);      

      reg = REG_DACC_ACR;
      Serial.print("\n\tREG_DACC_ACR = ");
      Serial.println(reg, HEX);

```

There are some more, less important, look in the sketch.

[DAC\_SW\_reset\_test\_1a.ino](https://forum.arduino.cc/uploads/short-url/tmoBU1k6Ah7fE9o5xMR1HHuqW4q.ino) (8.83 KB)

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [September 30, 2014, 1:41pm UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/5 "2014-09-30T13:41:29Z")

</div>

If you read the thread you'll see that DAC0 in particular is shared with other functions  
on the chip, notable WKUP12, one of the wake-up pins, it is conjectured this is something  
to do with the apparent fragility of the DAC0 pin (compared to any of the others).

Anti-static precautions are necessary with all CMOS devices, the Due will be much less  
robust than the Uno since the process used has thinner gate oxide and handles smaller  
currents and all the transistors are far smaller than in ATmega chips. Its not emphasized  
enough on these forums that these devices are delicate to static even with the built-in  
protection diodes.

My anti-static precautions are wear cotton only, live in a damp climate... Seriously  
avoid nylon carpets and clothing!

Note that the WKUP pins may not have all the protection diodes of other pins as they have  
to be able to go HIGH while some internal circuitry is powered down - hence likely to be more fragile. Well, that's the theory.

In general handling electronics you want to place your body at the same potential as the  
board before touching any input/output lines. So pick up a board carefully, touching the  
grounded USB connectors first if you have any suspicion you might have some static charge.

Having a conducive grounded work surface is great because you ground yourself  
to it as soon as you rest your arms. Conducive does not mean conductive, it needs to  
leak away static charge without shorting out circuitry. Wood is a fine material for  
this use.

---

<div class="post-metadata">

**Author:** ![dlloyd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dlloyd/32/751911_2.png) [@dlloyd](https://forum.arduino.cc/u/dlloyd)\
**Post date:** [September 30, 2014, 3:25pm UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/6 "2014-09-30T15:25:26Z")

</div>

I'm not sure if the SAM3X even has protection diodes. I think there's only on die termination of 39 ohm to reduce ringing and EMI. Note the 3.6V DC maximum input voltage ... a tight limit to follow during experimentation and testing, however I don't think there's any code you could use that would damage DAC0.

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [October 1, 2014, 12:00am UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/7 "2014-10-01T00:00:22Z")

</div>

Normally all CMOS pins have protection unless they are 5V tolerant or  
open-drain or line-receivers.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 5:39pm UTC](https://forum.arduino.cc/t/arduino-due-dac0-dont-work/260000/8 "2021-05-06T17:39:06Z")

</div>

Closed on May 6, 2021, 5:39pm UTC


