AD9850 Generate Random Fixed Frequencies Controlled By MEGA328P-AU

Thread Starter

Tigera

Joined Apr 20, 2016
9
Hey

I've made a circuit with AD9850 Controlled by ATMega328P-AU with serial interface.

Here is the Schematic Link.



Schematic



I've Tested Prog with AD9850 Module (HC-SR08_Module) and code is working.

Circuit use a 3.7v Single Cell Li-Po Battery and MT3608 to Boost 3.7v to 5v.

The Reference Oscillator for ad9850 is 2 MHz .

I've Reduce the code to just set the frequency of ad9850 But it generates few fixed random frequencies .

for instance:

Desire Freq ----> Output Freq

1 KHz ----> 900 KHz
2 KHz ----> 3.9 KHz

3 KHz ----> 15Hz

4 KHz ----> below 2Hz

5 KHz ----> 899 KHz



and so on.....



every time i change frequency , the output frequency is a random value between above.

I would appreciate any help.
 

Ian0

Joined Aug 7, 2020
750
If you are controlling it via serial data, then Data goes in LSB first, which is unusual. SPI output is MSB first.
 

Thread Starter

Tigera

Joined Apr 20, 2016
9
i use arduino IDE to prog the mega328P and then use "Eexport Compile Binary" in arduino to make hex file.
then use progisp to upload hex file to Mega328P.

i've test the code with Arduino Uno and AD9850 module and every thing is ok.

Code:
#include <AD9850.h>

const int W_CLK_PIN = 7;
const int FQ_UD_PIN = 6;
const int DATA_PIN = 8;
const int RESET_PIN = 9;

double freq = 1000;
double trimFreq = 2000000;

int phase = 0;

void setup(){
  DDS.begin(W_CLK_PIN, FQ_UD_PIN, DATA_PIN, RESET_PIN);
  DDS.calibrate(trimFreq);
}

void loop(){
  DDS.setfreq(freq, phase);
  delay(10000);
  DDS.down();
  delay(3000);
  DDS.up();
  delay(2000);
  DDS.setfreq(freq + 500, phase);
  delay(5000);
  DDS.down();
  while(1);
}

Code is really simple and works well for many people out there also for me on moude.

i've checked Schematic many times and seems OK but i don't know why it's not working
 

DickCappels

Joined Aug 21, 2008
6,649
I sorted a similar problem on my hand-wired board by placing a resistor in series with the clock input of the AD9850; apparently there was ringing on the clock line.
 
Top