AnsweredAssumed Answered

AD9834 not working with MCLK above 33KHz?!

Question asked by Chimp on Mar 18, 2016
Latest reply on Mar 27, 2016 by LouijieC

Hello everyone

 

I'm trying to build a sine wave generator that goes from 20Hz to 30KHz with an arduino uno and the AD9834 DDS.

First I had problems with the SPI communication but got that fixed, thanks to the nice people on this forum, by changing the SPI mode from 0 to 2.

 

My current problem is that the DDS stops outputting a frequency when the MCLK frequency rises above 33KHz. I read on the internet that the minimum MCLK frequency should be 1MHz, but it just outputs a DC level that changes with different higher frequencies.

 

I've got a breadbord setup for testing (see picture below) and I'm using the build-in function generator of my Rigol scope to make the MCLK signal (bandwidth generator = 25MHz). I followed the data sheet and the schematic of the evaluation board to make the circuit.

 

A few questions that I have:

  • Is it possible to get this DDS working in a breadboard setup? (only to generate up to 30KHz)
  • Would it work if I build a clock generator with a crystal instead of using a function generator?

 

Any help or advice on this would be much appreciated.

Thank you!

 

Setup

WP_20160318_002.jpg

Scope: MCLK = 30KHz, register0LSB = 0x50C7, register0MSB = 0x4000

DS1Z_QuickPrint2.png

Scope: MCLK = 30 KHz, register0LSB = 0x5037, register0MSB = 0x4337

DS1Z_QuickPrint1.png

Scope: MCLK = 1 MHz, register0LSB = 0x5037, register0MSB = 0x4337

DS1Z_QuickPrint3.png

Arduino Code

#include <SPI.h>


const int slaveSelect = 8;


void setup()
{
  SPI.begin();
  SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE2));
  pinMode(slaveSelect, OUTPUT);
  digitalWrite(slaveSelect, HIGH);


  delayMicroseconds(10);
  AD9834_init();
}
void loop()
{
}
void AD9834_init(void)
{
  digitalWrite(slaveSelect, LOW);
  SPI.transfer16(0x2100); // control word, set output to mid value voltage      RESET = 1
  digitalWrite(slaveSelect, HIGH);


  digitalWrite(slaveSelect, LOW);
  SPI.transfer16(0x5037); // Frequency Register 0 LSB
  digitalWrite(slaveSelect, HIGH);


  digitalWrite(slaveSelect, LOW);
  SPI.transfer16(0x4337); // Frequency Register 0 MSB
  digitalWrite(slaveSelect, HIGH);


  digitalWrite(slaveSelect, LOW);
  SPI.transfer16(0xC000); // phase offset of freq0 = 0
  digitalWrite(slaveSelect, HIGH);


  digitalWrite(slaveSelect, LOW);
  SPI.transfer16(0x2000); // control word, set output = sine  wave      RESET = 0
  digitalWrite(slaveSelect, HIGH);
}

Outcomes