SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By LizardOnTheRoad
#196035
Hi everyone,

I have a really strange problem with my MKRZERO Arduino. One of the most important things I need to do for my project is to have a perfect control on the DAC. It's not really easy to find a lot of datasheets on this model, I only use the information below:

https://store.arduino.cc/usa/arduino-mkrzero

The Circuit Operating Voltage is 3.3V, and the DAC is supposed to be 10 bits. So normally, I should be able to create steps of 3.3/1023 Volt. In order to test that, I used the code below. (This is not the complete code, I only wrote the important steps, I know that this code cannot work by itself)
Code: Select all
pinMode(A0,OUTPUT);                         //W_Voltage
analogWriteResolution(10);

for (float i=0; i <= 1023; i++){
    delay(500);
    analogWrite(A0,i);
    delay(500);
    Serial.println(i);
    }
If I connect a voltmeter between the ground and my A0/DAC Output, I can see by observing the Serial.println(i) on the computer that my DAC evolves in cycles of 2^8 - 1 = 255 steps. Which means that I read a 0V at step 0, step 256, step 512, etc... But it's not my main problem. The weirdest thing is, my DAC stops at 2.2V, which is related to the 175 step in my cycle of 255 steps. Whatever I do, my DAC cannot reach 3.3V. It is the same if I try this command.
Code: Select all
analogWrite(A0,1023);
I will only read 2.2V, just like in my last test. Did this happen to anyone else? I would be really glad if you could tell me what you think, because this a huge problem for, I mainly bought that Arduino for that, and if that does not work i'm kinda blocked.

Thank you so much for your help!

Sincerely yours,

Maxime Mano.
By LizardOnTheRoad
#196038
Hi Dan,

I know all of that, I already read this section. I am aware that my DAC is on a 8 bit mode, that's why I used the instruction analogWriteResolution(10) in my code. But that's excatly what I said, it changed nothing, and I'm still not able to go over 2.2V.
By Valen
#196063
LizardOnTheRoad wrote:Hi everyone,

I have a really strange problem with my MKRZERO Arduino. One of the most important things I need to do for my project is to have a perfect control on the DAC. It's not really easy to find a lot of datasheets on this model, I only use the information below:

https://store.arduino.cc/usa/arduino-mkrzero
...
The Tech Specs of that link say the chip is an SAMD21 Cortex-M0+ 32bit low power ARM MCU. If you search Google for a datasheet you 'll find it at Atmel (Microchip thesedays):

http://ww1.microchip.com/downloads/en/D ... 01882A.pdf

Now, it may be daunting to start reading all those 972 pages of it. But you don't have to read it in it's entirety. Page 768 starts with the DAC and where it gets its reference voltage from. And page 948 starts talking about the limits of the voltage ranges that the DAC supply needs and provides.

In the schematic found on the same arduino store link it shows that the external voltage reference VrefA is broken out to pin 1 of the top headers. So the question is, is something hooked up to that? On the MKRZERO board itself should only be 2 capacitors of 4.7uF and 100nF hooked up to it.