AnsweredAssumed Answered

Programming of AD9958 over SPI with Arduino Due

Question asked by jonasz on Dec 10, 2013
Latest reply on Dec 16, 2013 by jonasz

Hey,

 

since my problem could not be resolved easily (http://ez.analog.com/message/126160#126160) and I read about other people having similar problems I decided to give a thorough description of my setup to clear this mess, if any details are missing let me know and I'll add them.

I am using the AD9958 Evaluation Board which can be found here (http://www.analog.com/en/digital-to-analog-converters/direct-digital-synthesis-dds/ad9958/products/EVAL-AD9958/eb.html).

 

Powerconnections:

The main power TB1 has the following connections

VCC_USB       3.3V

DVDD_I/O       3.3V

GND               GND

DVDD             1.8V

Additionally J10 (CLK_VDD) is on 1.8V

 

Clock:

Sinusoidal Signal with 0.2Vpp is connected to J9.

Clock_mode_select jumper is set to REF_CLK

 

Signal-connection:

Signal of J7 is monitored on an oscilloscope.

 

While connected to a Windows XP PC over USB (Windows 7 does not work for the software) and using analogs software, everything works fine with the following jumper settings:

All jumpers are set without W4,W5,W6

W7 is set to PC comtrol.

 

While connected to the Arduino DUE (ARD):

(USB- cabel to computer gets removed)

Data-Connection:

Pin 10 (ARD) is set to slave select and connected to the CSB pin (U2) on the Evalboard

Pin SCK (ARD) is connected to SCLK (U2) on the Evalboard (also look here http://arduino.alhin.de/images/Boards/DUE/Arduino_DUE_SPI_2.png)

Pin MOSI (ARD) is connected to SIDO_0 (U13) on the Evalboard

Pin 4 (ARD) is connected to IO_Update (U2)

 

 

 

Jumper settings:

Additionally to the setting before W1,W2,W3 and W10 are removed. W7 is set to manual.

 

Software:

The software used on the Arduino Due can be found below. Its aim is to write one register which already should produce an output.

 

Problem description:

No Signal can be observed on J7.

Arduino Outputs are monitored on an oscilloscope and look reasonable.

Also a read script was written, but no reply of the AD9958 was measured.

What seems odd is, that the update channel of the AD9958 is always HIGH, whats wrong there?

 

 


What follows is the script that tries to write to the 0x04 register (Frequency tuning word 0). This should produce an observable output on J7 after I/O Update (also part of the script).

 

// inslude the SPI library:

#include <SPI.h>

 

 

// set pin 10 as the slave select pin

const int slaveSelectPin = 10;

// set pin 14 as the I/O Update pin

const int updatepin=14;

 

void setup() {

    // initialize update Pin:

  digitalWrite(updatepin, LOW); 

 

    // initialize SPI:

  SPI.begin(slaveSelectPin);

     //setup up Slave Select Channel

  SPI.setDataMode(slaveSelectPin,SPI_MODE3) ;

  SPI.setBitOrder(slaveSelectPin,MSBFIRST);

  SPI.setClockDivider(slaveSelectPin,80) ; //Divider is set to 80 to get 1MHz transfer clock

 

 

 

}

 

void loop() {

 

  //continuously write to the AD9958

  DDSwrite();

 

  delay(50); 

}

 

void DDSwrite() {

 

 

 

//setting up bits to be transferd

  byte instruction=B00000100;

  byte value1=B00000010;

  byte value2=B10001111;

  byte value3=B01011100;

  byte value4=B00101000;

 

//transfering to the AD9958

  SPI.transfer(slaveSelectPin,instruction,SPI_CONTINUE);

  SPI.transfer(slaveSelectPin,value1,SPI_CONTINUE);

  SPI.transfer(slaveSelectPin,value2,SPI_CONTINUE);

  SPI.transfer(slaveSelectPin,value3,SPI_CONTINUE);

  SPI.transfer(slaveSelectPin,value4,SPI_LAST);

 

//trigger update to active registers

  delay(1);

  //I/O Update

digitalWrite(updatepin, HIGH); 

delay(1);

  digitalWrite(updatepin, LOW); 

 

 

}

Outcomes