Hi! I am trying to build a sine waveform generator using ad9832. I already read the topics here with another people having problems with ad9832 but i didn't find the answer so i decided to post this question as a new one.

The problem is, that i am getting nothing on the output of ad9832, but in my opinion the communication with dds is correct (i have programming examples from AD). I attached my schematic to this post. Everything is similar to the datasheet of the ad9832, except the capacitor beetwen refin and agnd (i used 100nF instead of 10nF, does it make any difference ?). Very important thing is, that when i am measuring dc voltage beetwen refout and agnd i am getting something about 200mV. Here is the code for uC which steers ad9832:

void Podziel_Slowo(void)

{

czesc_slowa[0] = (uint8_t)(slowo&255); // less important 8 bits

czesc_slowa[1] = (uint8_t)((slowo>>8)&255);

czesc_slowa[2] = (uint8_t)((slowo>>16)&255);

czesc_slowa[3] = (uint8_t)((slowo>>24)&255); // most important 8 bits

}// this function divides 32-bit frequency word into the 8-bits parts

void InitSoftSPI_DDS(void)

{

//outputs MOSI, SCK, CS

DDRD |= (1<<DMOSI)|(1<<DSCK)|(1<<DCS);

PORTD |= (1<<DMOSI)|(1<<DSCK)|(1<<DCS); // everything on "1" at the beggining

}//this one inits the uC pins for soft spi communication

//here are the definitions:

#define DMOSI PD3

#define DSCK PD4

#define DCS PD5

#define DSCK_0 PORTD &= ~(1<<DSCK)

#define DSCK_1 PORTD |= (1<<DSCK)

#define DMOSI_0 PORTD &= ~(1<<DMOSI)

#define DMOSI_1 PORTD |= (1<<DMOSI)

//this function is an spi communication (sends 8-bit data)

void SendSoftSPI_DDS(uint8_t bajt)

{

uint8_t cnt = 128; //0b10000000

while(cnt)

{

_delay_ms(4);

if(bajt&cnt) DMOSI_1;

else DMOSI_0;

_delay_ms(3); //3000

DSCK_0;

_delay_ms(3);  //3000

DSCK_1;

cnt>>=1; //cnt = cnt>>1

}

}

//and finally this is the function which program dds:

void Wyslij_Freq_pozazakresem(void)

{

Podziel_Slowo();

PORTD &= ~(1<<DCS);    //set 0 on CS (communication active)

SendSoftSPI_DDS(0b11111000);//turn dds into programming mode

SendSoftSPI_DDS(0b00000000);//data = dont care

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);  //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00110000); / FREQ0 8L LSB

SendSoftSPI_DDS(czesc_slowa[0]); //data

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00100001); //iFREQ0 8H LSB

SendSoftSPI_DDS(czesc_slowa[1]);

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);  //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00110010); //FREQ0 8L MSB

SendSoftSPI_DDS(czesc_slowa[2]);

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00100011);    //FREQ1 8L LSB

SendSoftSPI_DDS(czesc_slowa[3]);

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

//-------------------- freq1 ----------------------------

SendSoftSPI_DDS(0b00110100);

SendSoftSPI_DDS(czesc_slowa[0]); //freq1 8l lsb

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00100101);

SendSoftSPI_DDS(czesc_slowa[1]); //freq1 8h lsb

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00110110);

SendSoftSPI_DDS(czesc_slowa[2]); //freq1 8l msb

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00100111);

SendSoftSPI_DDS(czesc_slowa[3]); //freq1 8h msb

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

//----------------phase registers = we will wrtie zeros----------------------------------

SendSoftSPI_DDS(0b00011000); //ph0 8 lsb

SendSoftSPI_DDS(0b00000000); //

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00001001); //ph0 8 msb

SendSoftSPI_DDS(0b00000000); //

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00011010); //ph1 8 lsb

SendSoftSPI_DDS(0b00000000); //

_delay_ms(2);

PORTD |= (1<<DCS); //)

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00001011); //ph1 8 msb

SendSoftSPI_DDS(0b00000000); /

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00011100); //ph2 8 lsb

SendSoftSPI_DDS(0b00000000); //

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00001101); //ph2 8 msb

SendSoftSPI_DDS(0b00000000); //

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00011110); //ph3 8 lsb

SendSoftSPI_DDS(0b00000000); //

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b00001111); //ph3 8 msb

SendSoftSPI_DDS(0b00000000); //

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

//----------------selsrc i sync-----------

SendSoftSPI_DDS(0b10000000);

SendSoftSPI_DDS(0b00000000);

_delay_ms(2);

PORTD |= (1<<DCS); //

_delay_ms(2);    //2000

PORTD &= ~(1<<DCS);

SendSoftSPI_DDS(0b11000000);

SendSoftSPI_DDS(0b00000000); // wake up ang generate : )

_delay_ms(2);

PORTD |= (1<<DCS); //

}//

I would like to add that the fselect pin is tied to gnd (i am using pins to select freq registers)

Today at school i checked the spi communication on the osciloscope and it looked correct (sorry i didn't shot any photo's).

Is it possible that ad9832 is broken or something ?

schemat1_black.pdf
Parents
• Hello everyone!

I solved my problem. PSEL0 and PSEL1 pins were tied together to gnd. Maybe that's why i was able to get nothing or random freqs on the output. When i had disconnected them from gnd and had left them floating, everything started to work... great! : ) Now my  project (signal generator using DDS technique) is completely done and 100% working! Hope i will get a good mark from a teacher ; )