0
\$\begingroup\$

As part of my MIDI to CV project I am using an MPC4822 (datasheet) two channel 12 bit DAC. After much toil I have everything working as planned but for the fact that even when initialised with values which should give an output of 0v, the minimum I'm seeing at either Vout is 0.56v That's half an octave I'm missing. Why is this happening?

    void loop() {
    mode = digitalRead (modePin);      // GET MODE
    if (mode != prevMode) {
    setVoltage (DAC1, 0, 1, 0);       // INITIALISE BOTH DAC CHANNELS FOLLOWING MODE SWITCH
    setVoltage (DAC1, 1, 1, 0);
    }
    prevMode = mode;
    mode ? mode1() : mode2();

    }
    ................

    void setVoltage(int dacpin, bool channel, bool gain, unsigned int mV)
    {
    unsigned int command = channel ? 0x9000 : 0x1000;

    command |= gain ? 0x0000 : 0x2000;
    command |= (mV & 0x0FFF);

    SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
    digitalWrite(dacpin,LOW);
    SPI.transfer(command>>8);
    SPI.transfer(command&0xFF);
    digitalWrite(dacpin,HIGH);
    SPI.endTransaction();
    }

ARDUINO > MCP4822

\$\endgroup\$
  • 2
    \$\begingroup\$ is there an opamp in the signal path? Show us your schematic. \$\endgroup\$ – Brian Drummond Dec 19 '17 at 23:32
  • \$\begingroup\$ No op amp, just an Arduino, Optocoupler for the midi input and the DAC and a DMM \$\endgroup\$ – Sir Cute Dec 19 '17 at 23:36
  • \$\begingroup\$ Are other values output correctly? And what happens in shutdown mode? \$\endgroup\$ – CL. Dec 20 '17 at 8:28
  • \$\begingroup\$ @CL Not using shutdown but I'll take a look . Max output is 4.569v which is about 0.5v higher than the data sheet says for internal Vref at 2x gain. \$\endgroup\$ – Sir Cute Dec 22 '17 at 1:49
  • 1
    \$\begingroup\$ This sounds like a 0.5 V offset. Is there any pullup? There might be a ground problem. Show your circuit. \$\endgroup\$ – CL. Dec 22 '17 at 6:57
0
\$\begingroup\$

You are not using decoupling capacitors. That is usually causing such imprecision. Put at least 100nF decoupling capacitor to MPC4822.

\$\endgroup\$
0
\$\begingroup\$

since your vref is set internally, I would try to trim it out by varying the voltage or I would try just using a diode in series that would forward bias on the ground pin. Using a dac with a single supply has never gave precise results either. The time I used that chip I used a +/- 5 v supply project and I had a voltage divider between the +/- supply that went to my Vss pin. I do believe the Vss pin was around -0.6V so.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.