Programming the AD5930 - getting the SPI to work

Hello all,

I am trying to program the AD5930 and trying to start simple before i begin to go complex. I am using the arduino due as the controller and a bit new to the arduino. I am trying to produce a constant sinusoid of frequency, 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 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:

}

I will be using the SPI headers next to the SAM cortex for sending the data to the ad5930.

The wiring diagram is attached, incase the error is there.

AD5930 configuration.pdf (166 KB)

The diagram doesn't show how it's connected to the arduino nor does it show pin designations.

Hello,

The AD5930 requires 3 wire serial connection to be programmed. I used the headers right next to the SAM cortex to program the AD5930. In total, 2 female to male pins were used (SDATA and SCLK) and 1 male to male (FSYNC) was used. Once the SPI library is called, these pins are automatically configured for SPI communication.

Refer to https://www.arduino.cc/en/Reference/SPI and scroll down to Connections to see what i mean.

The connections are as follows:

Arduino DUE ---> AD5930 pin MOSI ---> pin 14 (SDATA) SCLK ---> pin 15 (SCLK) SS ---> pin 16 (FSYNC)

In addition to that, the AD5930 does not communicate 'back' to the Arduino DUE, therefore no MISO needed.