Operating AD5780 EVAL Board Via MicroController

OK, so thanks in advance because I am new here. I am reading the AD57XX drivers here  https://wiki.analog.com/resources/tools-software/uc-drivers/renesas/ad5780 and am struggling to understand how to get the device working and understanding it properly. I am using code here https://github.com/maxgerhardt/arduino-ad57xx-driver/blob/master/src/main.cpp in order to test the DAC. I have several questions about the drivers and operation in general. I will itemize them if that is ok

  1. Where in the drivers am I performing Slave Select and where am I determining Clock Speed? I have looked through the C in the drivers library, and it seems that each command, whether reading or writing selects the Slave/Master each time? I see no reference to which pins on my microcontroller it is reference though so I do not know if any of this is right.
  2. Why do I need to be reading in the Control Register or anything from the DAC at all? Why does this matter? All I want is to output a voltage
  3. How do I perform the right conversion to a voltage that I want? The command " AD57XX_SetDacValue() " takes a long, but I do not understand how that relates to a float value of voltage. Say I want 2.35 Volts, or a Sine Function from -2 to 2 Volts, how do I do this conversion?
  4. I don't know how to debug the system in general. When I run the example code, which is supposed to output a triangle wave function, I get a sin function. Is this just background noise that the DAC outputs. I don't know how to tweak parameters or understand it. If the photo is low resolution, from peak to anti peak, the wave function is only about 300 mV.

Thanks in advance for all the help.

  • 0
    •  Analog Employees 
    on Mar 25, 2019 11:06 AM over 1 year ago


    Someone's currently looking into this query and will respond to you as soon as possible.



  • Thanks Ivan, here I asked the question on StackExchange, so I answered 1 and 2. For 3, I suppose the drivers require me to convert from a float to the binary representation that the DAC requires, but I'm still confused by the best way to do this.

    I am also going to look around my department for a logical analyzer, but debugging advice would still be incredible. I'm surprised there's no guide to do something similar online yet

  • 0
    •  Analog Employees 
    on Mar 26, 2019 2:37 AM over 1 year ago in reply to andrewkhardy

    Hi andrewkhardy,

    3. If you are referring to how would you compute for the required binary code for a specific voltage, you can use the equation found on the data sheet and solve for "D".

    If you need to output let say a ±2V sine wave you have to have a compute for all the binary values then write it sequentially to the DAC. We would also recommend to use  a lower voltage like ±5V for VREFP and VREFN for you to maximize the resolution.

    4. If you are not running the example code, is the output fixed or does the sine wave still exist? If yes, it might have nothing to do with the code and may be due to a noisy power supply (VDD,VSS).

    Where are you measuring exactly? is it on the VOUT or VOUT_BUF? is LK11 connected?

    Best regards,


  • Rainier,

    Thanks for answering. I am aware of the formula in the datasheet.  I'm checking to make sure the command _SetDacValue takes raw binary (or unicode?). I will have to write a conversion module then.  I am testing both the AD5780 drivers and the Ad57XX ones with AD5780 specified, but one or the other might be better.

    void AD5780_SetDacValue(unsigned long value)

    I think the sine wave does come from a noisy power supply.

    I will edit this answer in the morning, but it might be the LK11 pin that I'm an idiot and forgot. I need to disconnect it if I am connected to VOUT instead of VOUT_BUF correct? I already have moved LK1 to Position B since I am powering this externally. Are there any others I should check?

  • 0
    •  Analog Employees 
    on Mar 26, 2019 3:43 AM over 1 year ago in reply to andrewkhardy


    SetDacValue should take raw binary, hex or decimal values.

    LK11 should be inserted whether you are measuring at VOUT or VOUT_BUF. It is not recommended to leave the input of the amplifier to be floating. If you have followed the default link options (Table 1 on UG-256) then it should all be fine (except for LK1 since you are using external digital supply).

  • 0
    •  Analog Employees 
    on Mar 26, 2019 3:43 AM over 1 year ago in reply to andrewkhardy


    SetDacValue should take raw binary, hex or decimal values.

    LK11 should be inserted whether you are measuring at VOUT or VOUT_BUF. It is not recommended to leave the input of the amplifier to be floating. If you have followed the default link options (Table 1 on UG-256) then it should all be fine (except for LK1 since you are using external digital supply).

  • OK, I am confused by LK11. In Table 5 it says

    "When this link is removed, the DAC output is disconnected from the noninverting input of the output buffer amplifier and the
    DAC output voltage is accessible at the VOUT connector. "

    is this not what I want? I removed it though and still had no signal though, so I am unsure. I will continue to check my wiring

  • 0
    •  Analog Employees 
    on Mar 27, 2019 1:30 AM over 1 year ago in reply to andrewkhardy

    Apologies for the confusion, what I meant is, if you have inserted LK11, you can access the voltage at both the VOUT (no buffer) and VOUT_BUF (buffered) connectors. If LK11 is removed, the buffer is disconnected so you can only access the output through the VOUT connector.

  • OK, let me upload pictures and explain what I have checked and let me know what I may be missing

    Here is my microcontroller. I have 6 pins attached. They are as follows

    Pin 6 - Blue- Ground

    Pin 7-Black- Ground

    Pin 10- Green -Slave Select

    Pin 11 - Red - MOSI

    Pin 12- Orange- MISO

    Pin 13-White- SCK

    Now, on the DAC, it is difficult to read the pin labels in the photo, but they are as follows






    SCLK- White

    This is correct right?

    I now have a 5 pin power supply. I am only using 4 pins. I have +5V and the COMM plugged into VCC and DGND respectively.

    I then have +12V attached to VDD, the same COMM attached to AGND and -12V attached to VSS. Is this correct?

    Finally,  ,  I have moved LK1 to Position B, and removed LK11. I have soldered a SDA pin to VOUT and attached it via a BNC cable, which I can measure on an oscilliscope across a 50Ohm resistor, pictured here.

    Then, this is the code I run

    #include <Arduino.h>
    #include <AD5780.h>
    void setup() {
      Serial.println("FIRMWARE STARTUP");
      /* same setup as in the RL78G13 driver example's Main.c */
        Serial.println("AD5780 OK");
        Serial.println("AD5780 Err");
      /* Resets the device to its power-on state. */
      /* Enables the DAC output. */
      /* The DAC register is set to use offset binary coding. */
       // Sets the value to which the DAC output is set when CLEAR is enabled.
      /* Performs a soft CLEAR operation. */
        /* Reads and displays the internal registers. */
         /* Read DAC. */
        long result = AD5780_GetRegisterValue(AD5780_REG_DAC,3);
        result = (result & 0xFFFFC) >> 2;
        Serial.print("DAC REG: ");
        Serial.println(result, HEX);
        /* Read Control. */
        result = AD5780_GetRegisterValue(AD5780_REG_CTRL,3);
        result = (result & 0x3E);  // Only Bits 5 through 1 are holding information.
        Serial.print("CTRL REG: ");
        Serial.println(result, HEX);
        /* Read ClearCode. */
        result = AD5780_GetRegisterValue(AD5780_REG_CLR_CODE,3);
        result = (result & 0xFFFFC) >> 2;
        Serial.print("CLEAR CODE: ");
        Serial.println(result, HEX);
    long dacVal  = 0;
    long step    = 0;
    long maxCode = 0x3FFFF;    // 18 bits
    long minCode = 0;
    void loop() {
      /* generate a triangle signal. 
      if(dacVal >= maxCode - step)
        step = -350;
      else if(dacVal <= minCode - step)
        step = 350;
      dacVal = 0x3FFFF;
      //50 microseconds is a very short amount of time
      //if pinMode() and digitalWrite() is used in the pin management layer,
      //these will take so long that 50uS is small in comparison..
    . Where might the error be? The code runs, and I have checked my wiring is correct.

  • 0
    •  Analog Employees 
    on Mar 28, 2019 1:47 AM over 1 year ago in reply to andrewkhardy

    Can you take a scope shot of the digital lines? SDIN, SCLK, SYNC, SDO.

    Also can you insert  link LK7 to pull it low, this would ensure that the data written is transferred from the input shift register to the DAC register ? I don't see that you are controlling the LDAC pin using your controller.

  • OK, yes you are right. I added a cable at Pin 5 to connect to LDAC. I am reading the Standalone Operation section (pg 19 of the AD5780 datasheet, not the evaluation board) more closely now.  I have also attached LK7, but it still does not provide me with a voltage output.

    static const int pinMapping[] = {
    		5, //GPIO1 (LDAC pin) is D7
    		8, //GPIO2 (CLR pin) is D8
    		9, //GPIO3 (RESET pin) is D9
    		10  //slave select (SYNC pin) 

    these are the setting in pinMgtLayer that I have changed now. If I was to have a changing voltage output, would I also need a CLR pin? In lieu of that I could also use the CTRL register instead? Would I then need to write to the CTRL register everytime I update the voltage, like?


    I am also attaching scope readings for the pins as follows: SDIN




    and finally my new LDAC pin

     Finally, is it necessary to have both DGND pins attached to my microcontroller? Would only 1 ground them?