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.

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

    Hi,

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

    Cheers,

    Ivan

  • 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

  • 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

    DGND-Blue

    DGND-Black

    SYNC-Green

    SDIN-Red

    SDO-Orange

    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.begin(9600);
      Serial.println("FIRMWARE STARTUP");
    
      /* same setup as in the RL78G13 driver example's Main.c */
      if(AD5780_Init())
      {
        Serial.println("AD5780 OK");
      }
      else
      {
        Serial.println("AD5780 Err");
      }
    
      /* Resets the device to its power-on state. */
      AD5780_SoftInstruction(AD5780_SOFT_CTRL_RESET);
    
      /* Enables the DAC output. */
      AD5780_EnableOutput(1);
    
      /* The DAC register is set to use offset binary coding. */
      AD5780_Setup(AD5780_CTRL_BIN2SC);
    
       // Sets the value to which the DAC output is set when CLEAR is enabled.
        AD5780_SetRegisterValue(AD5780_REG_CLR_CODE, 
                                AD5780_CLR_CODE_DATA(0x20000), 
                                3);  
    
      /* Performs a soft CLEAR operation. */
      AD5780_SoftInstruction(AD5780_SOFT_CTRL_CLR);
    
        /* 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;
      }4294967295
      */
      dacVal = 0x3FFFF;
      AD5780_SetDacValue(dacVal);
      //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..
      delayMicroseconds(50);
     
    }
    . 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?

      AD5780_SoftInstruction(AD5780_SOFT_CTRL_CLR);

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

    SCLK

    SYNC

    SDO

    and finally my new LDAC pin

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

Reply
  • 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?

      AD5780_SoftInstruction(AD5780_SOFT_CTRL_CLR);

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

    SCLK

    SYNC

    SDO

    and finally my new LDAC pin

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

Children