AnsweredAssumed Answered

Arduino Uno with AD9958

Question asked by Care07 on Apr 26, 2016
Latest reply on Jul 5, 2017 by vandenplas

I am having difficulty getting an output using the Arduino Uno to control the AD9958. The Eval board is in Manual Mode. I've attached SCLK on U2 to Pin 13 on the Arudino,  SDIO_0 on U13 to Pin 11 on the Arduino, IO_UPDATE on U2 to a digital output pin on the Arduino, RESET on U2 to a digital output pin on the Arduino, and CSB on U2 to Pin 10 on the Arduino.

 

I have analyzed my output using an oscilloscope and I am sending the correct bytes to the board. The board just doesn't seem to respond?

 

I could really really really use some help!

 

Here is my code:

#include <SPI.h>

const int CSPin =10;

const int IOUpdatePin = 7; //The pin used to trigger IO UPdate events.

const int ResetPin = 4; //The pin used to send reset commands.

 

 

void setup (void)

  {

  pinMode (IOUpdatePin, OUTPUT); //Set the IO Update Pin to Output.

  pinMode (ResetPin, OUTPUT);//Set the Reset Pin to Output.

  pinMode (CSPin, OUTPUT); //Set the chip select pin to Output.

   

  digitalWrite(CSPin, HIGH);  // ensure SS stays high

  SPI.begin ();

SPI.setClockDivider(SPI_CLOCK_DIV2);

  SPI.setBitOrder (MSBFIRST);

  SPI.setDataMode (SPI_MODE0);

 

 

  digitalWrite (ResetPin, HIGH); //The reset is active on logic high, so we set the pin to high for an update.

  digitalWrite (ResetPin, LOW); //Then setting it to low ends it. The delay between rise and fall is many clock cycles (of the DDS),

 

 

  digitalWrite(CSPin, LOW);// ensure SS is low. 

 

  SPI.transfer (0x00);//write to CSR (Channel Select Register)

  SPI.transfer (0x80);

 

  digitalWrite (IOUpdatePin, HIGH); //The IO Update is active on logic high, so we set the pin to high for an update.

  digitalWrite (IOUpdatePin, LOW); //Then setting it to low ends it. The delay between rise and fall is many clock cycles (of the DDS),

  //so no delay between the high and low commands is needed.

 

  digitalWrite(CSPin, HIGH);  // disable slave select

 

  digitalWrite(CSPin, LOW); //ensure SS stays low

 

    SPI.transfer (0x01);//write to FR1 (Function Register 1)

    SPI.transfer (0xD0);

    SPI.transfer (0x00);

    SPI.transfer (0x00);

    digitalWrite (IOUpdatePin, HIGH);

    digitalWrite (IOUpdatePin, LOW);

   

digitalWrite(CSPin, HIGH);  // disable slave select

 

digitalWrite(CSPin, LOW); //ensure SS stays low

  

    SPI.transfer (0x02); //write to FR2 (Function Register 2)

    SPI.transfer (0xA0);

    SPI.transfer (0x00);

    digitalWrite (IOUpdatePin, HIGH);

    digitalWrite (IOUpdatePin, LOW);

   

digitalWrite(CSPin, HIGH);  // disable slave select

 

digitalWrite(CSPin, LOW); //ensure SS stays low

  

    SPI.transfer (0x03);//write to CFR (Channel Function Register)

    SPI.transfer (0x00);

    SPI.transfer (0x03);

    SPI.transfer (0x04);

 

 

  digitalWrite (IOUpdatePin, HIGH);

  digitalWrite (IOUpdatePin, LOW);

 

  digitalWrite(CSPin, HIGH);  // disable slave select

 

  digitalWrite(CSPin, LOW);     //ensure SS stays low

  

 

  SPI.transfer (0x04); //write to CFTW0 (channel frequency tuning word 0) 80MHz

  SPI.transfer (0x28);

  SPI.transfer (0xF5);

  SPI.transfer (0xC2);

  SPI.transfer (0x8F);

 

  digitalWrite (IOUpdatePin, HIGH);

  digitalWrite (IOUpdatePin, LOW);

 

  digitalWrite(CSPin, HIGH);// disable slave select

 

  } // end of setup

 

void loop (void)

  {

  //do nothing

  } // end of loop

 

I believe this should output a single tone frequency of 80MHz.

 

Thank-you,

Care

Outcomes