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[playCursor] ) ; digitalWrite (loadDacPin , LOW) ; SPI.endTransaction () ;