Sending a command to a DAC via SPI?

I’m trying to communicate with an AD5678 DAC evaluation board through SPI. From what I understood from the datasheet is that the chip receives a 32 bit word command. I’m starting off by attempting to write the following binary command when the slave select is low and send it by bringing it high again. After doing so however, I’m not getting anything from the DAC nor am I getting an error message.

32-bit command:


I set the SPI settings based on the following excerpt from the datasheet:
“The write sequence begins by bringing the SYNC line low. Data from the DIN line is clocked into the 32-bit shift register on the falling edge of SCLK. The serial clock frequency can be as high as 50 MHz”

I’m trying to troubleshoot it but there are a few things that I am not sure of:
Is my method of bit shifting correct and does it yield the intended binary word?
Is there any sort of signal I need to send the DAC before sending it the command I want?

Please have a look at my code below. Reading it you might think that it is missing the LDAC pin but from what I understand the command I’m sending is the is the software LDAC function. Also, I’m aware that 4 of the 8 DAC outputs accept a 12 bit data word corresponding to the output value as opposed to 16 but at the moment I am only testing the outputs which work with 16 data bit words.

#include <SPI.h>

void setup() {

  pinMode(12, OUTPUT);
  digitalWrite(12, LOW);

  SPI.beginTransaction(SPISettings(50000000, MSBFIRST, SPI_MODE2));


void loop() {

 //Enter 16-bit value to be sent
  uint16_t value = uint16_t (6000);

//Bitmasking to send the the correct 32bit signal:  
  uint8_t command =  uint8_t((0b00000011)); //command bits (to be sent)
  uint8_t channel =  uint8_t ((0b00001111 << 4)); //shift the address bits, in this case, all dacs
  uint8_t chnlval = (uint8_t (channel)) | (uint16_t (value >>4) ); //mask the address bits with shifted databits (to be sent)
  uint8_t val2 =  uint16_t ((value << 4)); //shift remaining bits to the start of the new byte (to be sent)
  uint8_t val3 = uint16_t ((value << 12)); //shift remaining bits to the start of the new byte (to be sent)

    digitalWrite(12, LOW);



     delay (10);

  digitalWrite(12, HIGH);


The pdf file of this link on SPI communication may help you to get the trick of sending 32-bit (4-byte) into a slave.