Beginner problems using DAC7714

I am fairly new to Arduino. I have used some basic DACs like MCP4822 and 4922 but I need some help getting a DAC7714 up and running.
I have 7714 outputting different voltages but they have lots of errors. I have already verified my code on a Blackpill STM32 and a MCP4922 DAC so I conclude that the errors are from the SPI data stream
I am using SPI MODE3 which I believe to be correct
First of all I don’t know what SPI speed is needed. The MCP4822 datasheet specs 20mhz but there is no data/suggestion for the DAC7714.
Data says CS and CLK are interchangeable and OR’d together. I am only using one chip so I presume I should either hold CS LOW or tie it to GND. This way I can also avoid the condition of shifting bits if CS rises before CLK has risen.
The timing diagram I am really struggling with. It also specifies a minimum time for LOADDACS to be held LOW after the clocks final rise (45ns). Is this what determines the clock speed. 45ns for half a clock cycle would mean 90ns for a whole cycle and lead to a clock speed of maximum 11.11MHZ

SPI.beginTransaction(SPISettings( 40000000, MSBFIRST , SPI_MODE3)) ;
digitalWrite (loadDacPin , HIGH) ;
SPI.transfer16(dac_one | buff[0][playCursor] ) ;
digitalWrite (loadDacPin , LOW) ;
SPI.endTransaction () ;

Add the minimal clock times (would be 80ns but as most microcontrollers have symmetric low/high times, you get 100ns which is 10MHz). Keep in mind this is the maximum value you should stay below that in an actual setup, so I recommend 4 MHz or 8MHz if you need the speed and have very short SPI traces.

Although you could theoretically do that I recommend against it. Use it as you would do with any SPI device.

As CS doesn’t start a new communication you should connect the RESET signal to put the chip in a known state at startup of your code.

You might use an inverter to provide the LOADDACS signal from the CS to save one pin on the controller.

No, you can leave LOADDACS low for a long time it just have to be low for at least 45ns. Given the maximum SPI clock frequency of 10MHz (see above), this shouldn’t be a problem if you switch that signal at the same time as CS.

Thanks for your help and explanation

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.