Simple code to program the AD590

Hello all,

I am trying to program the AD5930. I am trying to start simple before i begin to go complex. ( yes I am using the arduino due and a bit new to the arduino). I am trying to produce 256Hz for now.

Datasheet for AD5930: http://www.analog.com/media/en/technical-documentation/data-sheets/AD5930.pdf

Could someone show me where i went wrong?

#include <SPI.h>

#define SDATA 2  // pin 2 will be connected to pin 14 on AD5930
#define SCLK  3  // pin 3 will be connected to pin 15 on AD5930
#define FSYNC 4  // pin 4 will be connected to pin 16 on AD5930

SPISettings AD5930_SPI(40000000, MSBFIRST, SPI_MODE3);

void setup() {
  // put your setup code here, to run once:
  pinMode(FSYNC, OUTPUT);
  
  SPI.begin(FSYNC);

  SPI.beginTransaction(AD5930_SPI);
  digitalWrite(FSYNC, LOW);
  
  SPI.transfer(FSYNC,0x0E93, SPI_CONTINUE); // control register
  SPI.transfer(FSYNC,0xC080, SPI_CONTINUE); // Fstart LSB
  SPI.transfer(FSYNC,0xD000, SPI_CONTINUE); // Fstart MSB  [256Hz]
  SPI.transfer(FSYNC,0x2000, SPI_CONTINUE); // F Sweep LSB . [Set delta f = 0]
  SPI.transfer(FSYNC,0x3000, SPI_CONTINUE); // F Sweep , positive delta f. Set to delta f = 0
  SPI.transfer(FSYNC,0x1002, SPI_CONTINUE); // Number of increments. Set to two increments
  SPI.transfer(FSYNC,0x5FFF); // t interval. Set to the highest time

  digitalWrite(FSYNC, HIGH);
  SPI.endTransaction();
}

void loop() {
  // put your main code here, to run repeatedly:

}

Thanks.

testing_the_AD5930.ino (1.06 KB)