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, which seems to just be noise.
• In my experience analog devices eval board software is crap, I've had a few that I couldn't even get working with their software. I eventually layed out my own board with microprocessor. – Voltage Spike Mar 22 '19 at 16:51
• @laptop2d Do you have any suggestions / alternatives of how to get the DAC running? I can't find proper githubs of this running and I'm a little pannicked – Andrew Hardy Mar 22 '19 at 16:54
• Note for readers interested in this topic: The same question has been asked at the Analog Devices "EngineerZone" here. Therefore answers / new information / etc. may appear there. – SamGibson Mar 22 '19 at 17:14
• I use the AD5780, but with a STM32 on my own board. What I would do is write my own code for the eval board if you can find a way to program it. – Voltage Spike Mar 22 '19 at 17:16
• @laptop2d Do you have documented code you use for the STM32? I understand there will be differences, but any reference for me is useful? I'm not competent enough to really write my own drivers – Andrew Hardy Mar 22 '19 at 17:42

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.

The slave select is controlled within the `SPI_Write()` function. It uses the `PinMgt_PinWrite()` function to do the slave select control, which in turn selects a pin from the `pinMapping[]` lookup table.

The clock speed is set in `AD5780_Init()`.

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

You don't. The code is just for demonstration purposes. It shows you how you could query those registers. If you don't need to, then don't.

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?

That value is the raw value to set the DAC to. You refer to the DAC datasheet to know what that value equates to. In this case the range is from $$\V_{REFN}\$$ to $$\V_{REFP}\$$. Divide that range by 218 and you have the voltage per bit.

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, which seems to just be noise.

You need some debugging tools. Things like a logic analyser to be able to acually see what the IO pins of your MCU are doing. An oscilloscope can be used to see if a signal is present, but to see all the SPI signals together you really want a logic analyser.

• Thank you for responding. I understand the equation for the raw value. I understand if I send 0x3FFFF (18 1's, I would get the maximum value). What I dont understand is that the command AD57XX_SetRegisterValue and AD57XX_SetDacValue both use "unsigned longs" but then the code just stores binary inside these longs instead? When I adapt that code to just send AD57XX_SetDacValue(0x3FFFF) I don't get 10 Volts coming out – Andrew Hardy Mar 22 '19 at 23:32
• I have read the datasheet over and over again, I don't mean to appear lazy, but it doesn't seem to be helping me – Andrew Hardy Mar 22 '19 at 23:34
• `but then the code just stores binary inside these longs instead?` -- What is that supposed to mean? – Majenko Mar 22 '19 at 23:57
• Also in the pinMapping[] doesn't have MOSI, MISO, or SCK, how is this supposed to work? – Andrew Hardy Mar 22 '19 at 23:57
• MOSI, MISO and SCK are the SPI hardware pins. You have no control over them. The SPI hardware controls them. – Majenko Mar 22 '19 at 23:57