AnsweredAssumed Answered

AD9834 Output Problems

Question asked by eclipse on Sep 12, 2011
Latest reply on Dec 16, 2011 by LiamR

Hi Everyone,

 

I am using the AD9834CRUZ DDS chip with a 75MHz MCLK (all on an arduino shield). The chip is being programmed by an Arduino Duemilanove. I want to use it to ultimately produce a signal in the 27MHz band but currently am having trouble even getting just a 1kHz output.

 

What happens during testing is that when the AD9834CRUZ is powered up I instantly get a signal at the output of 2.65MHz even though I have not programmed the registers and also regardless of what frequency I even set the registers to. I decided to build another board and the same result occurs with a constant ouput of 2.65kHz regardless of frequency register.

 

I suspected the MCLK initially until I managed to achieve 37.5MHz output at one point but that was due to a noisy SDATA and SCLK line which has since been fixed.

 

Below are schematics and coding for a basic test of the AD9834CRUZ for an output of 1kHz.

 

Kindest Regards,

 

TL

 

/*
  Code for programming one frequency of the AD9834.
 
*/

// Global Variables
  int ChannelTransmit = 0;
  int Done = 0;

  int FreqReg0[]= {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,1,1,1,1,1,0,0}; //1 kHz
  int ContReg[] = {0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0};
  int ResetReg[] ={0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int PhaseReg0[] = {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
  int FSELECT = 8; // FSELECT pin of the AD9834CRUZ.
  int RESET = 9; // RESET pin of the AD9834CRUZ.
  int SDATA = 10; // SDATA pin of the AD9834CRUZ.
  int SCLK = 11; // SCLK pin of the AD9834CRUZ.
  int FSYNC = 12; // FSYNC pin of the AD9834CRUZ.

void setup()
{
  for(int pin = 1; pin < 9; pin++)
  {
    pinMode(pin,INPUT); // Sets the AD9834CRUZ pins.
  }

  for(int pin = 8; pin < 13; pin++)
  {
    pinMode(pin,OUTPUT); // Sets the AD9834CRUZ pins.
  }

  digitalWrite(FSYNC, HIGH);
  digitalWrite(RESET, HIGH);
  digitalWrite(FSELECT, LOW);
  digitalWrite(SCLK,HIGH);
}

void loop()
{
  ChannelTransmit = digitalRead(3);
  if(ChannelTransmit == LOW) 
  {
    Done = 0;
  }
   
  if(ChannelTransmit == HIGH && Done == 0)
  {
    Done = 1;
   
    digitalWrite(SCLK,HIGH);
    digitalWrite(FSYNC,LOW);
   
    for (int i = 0; i <= 15; i++)
    {
      digitalWrite(SCLK,HIGH);
      digitalWrite(SDATA,ContReg[i]);
      delay(10);
      digitalWrite(SCLK,LOW);
      delay(10);
    }
   
    FSYNCsetup();

    for (int i = 16; i <= 31; i++)
    {
      digitalWrite(SCLK,HIGH);
      digitalWrite(SDATA,FreqReg0[i]);
      delay(10);
      digitalWrite(SCLK,LOW);
      delay(10);
    }
   
    FSYNCsetup();
   
    for (int i = 0; i <= 15; i++)
    {
      digitalWrite(SCLK,HIGH);
      digitalWrite(SDATA,FreqReg0[i]);
      delay(10);
      digitalWrite(SCLK,LOW);
      delay(10);
    }
   
    FSYNCsetup();
   
    for (int i = 0; i <= 15; i++)
    {
      digitalWrite(SCLK,HIGH);
      digitalWrite(SDATA,PhaseReg0[i]);
      delay(10);
      digitalWrite(SCLK,LOW);
      delay(10);
    }
   
    FSYNCsetup();
   
    for (int i = 0; i <= 15; i++)
    {
      digitalWrite(SCLK,HIGH);
      digitalWrite(SDATA,ResetReg[i]);
      delay(10);
      digitalWrite(SCLK,LOW);
      delay(10);
    }
   
    digitalWrite(SCLK,HIGH);
    digitalWrite(FSYNC,HIGH);
    delay(10);
    digitalWrite(SCLK,LOW);
    delay(10);
    digitalWrite(SCLK,HIGH);
    digitalWrite(RESET,LOW);
  }
}

void FSYNCsetup()
{
  digitalWrite(SCLK,HIGH);
  digitalWrite(FSYNC,HIGH);
  delay(10);
  digitalWrite(SCLK,LOW);
  delay(10);
   
  digitalWrite(SCLK,HIGH);
  digitalWrite(FSYNC,LOW);
  delay(10);
  digitalWrite(SCLK,LOW);
  delay(10);
}

Attachments

Outcomes