AnsweredAssumed Answered

AD9910 saw tooth using DRG_NDWELL mode

Question asked by _coder on Mar 30, 2018
Latest reply on Apr 14, 2018 by _coder

Hello everybody,
I am working on ad9910 and i manged to generate a single tone using my arduino board. now i want to make a saw tooth signal using DRG N-Dwell mode. I made that code but it desnt work and i dont know why?!. I have attached the most simple code to generate that signal, kindly you can check it to figure out the problem. In my code
- the system clock is 1 GHZ
- the lower freq is 20 MHZ and the upper is 60 MHZ
- the step freq is 2 MHZ
- the step rate is 20 nsec


--------------------------------------------------------------

// arduino PINS
#define DRCTL 3
#define MASTREST 5
#define upd 6
#define CS 10

#include <SPI.h>

unsigned char cfr1[]={0x00,0x00,0x00,0x00};
unsigned char cfr2[]={0x00,0x0c,0x08,0x20};
unsigned char cfr3[]={0x00,0x00,0x00,0x20};


unsigned char drg_limit[]= {0x07,0xae,0x14,0x7b,0x05,0x1e,0xb8,0x52};
unsigned char drg_step[] = {0X00,0X83,0X12,0X6f,0X00,0X83,0X12,0X6f};
unsigned char drg_rate[] = {0x09,0xc4,0x09,0xc4};


void gpio_init()
{

pinMode(DRCTL,OUTPUT);
pinMode(MASTREST,OUTPUT);
pinMode(upd,OUTPUT);
pinMode(CS,OUTPUT);

SPI.begin();
}

void tx_byte(unsigned char tx_dat)
{
SPI.transfer(tx_dat);
}

void ad9910_init(void)
{

unsigned char k,m;
digitalWrite(DRCTL,LOW);

digitalWrite(MASTREST,HIGH);
digitalWrite(MASTREST,LOW);

digitalWrite(CS,LOW);
tx_byte(0x00);
for(m=0;m<4;m++)
tx_byte(cfr1[m]);
digitalWrite(CS,HIGH);
for(k=0;k<10;k++);

digitalWrite(CS,LOW);
tx_byte(0x01);
for(m=0;m<4;m++)
tx_byte(cfr2[m]);
digitalWrite(CS,HIGH);
for(k=0;k<10;k++);

digitalWrite(CS,LOW);
tx_byte(0x03);
for(m=0;m<4;m++)
tx_byte(cfr3[m]);
digitalWrite(CS,HIGH);
for(k=0;k<10;k++);

digitalWrite(upd,HIGH);
for(k=0;k<10;k++)
digitalWrite(upd,LOW);

digitalWrite(CS,LOW);
tx_byte(0x0B); //drg limits
for(m=0;m<8;m++)
tx_byte(drg_limit[m]);
digitalWrite(CS,HIGH);
for(k=0;k<10;k++);

digitalWrite(CS,LOW);
tx_byte(0x0C); //drg step
for(m=0;m<8;m++)
tx_byte(drg_step[m]);
digitalWrite(CS,HIGH);
for(k=0;k<10;k++);

digitalWrite(upd,HIGH);
for(k=0;k<10;k++)
digitalWrite(upd,LOW);

digitalWrite(CS,LOW);
tx_byte(0x0D); //drg RATE
for(m=0;m<4;m++)
tx_byte(drg_rate[m]);
digitalWrite(CS,HIGH);
for(k=0;k<10;k++);


digitalWrite(upd,HIGH);
for(k=0;k<10;k++)
digitalWrite(upd,LOW);


}


void setup()
{
gpio_init();
ad9910_init();
digitalWrite(DRCTL,HIGH);
digitalWrite(DRCTL,LOW);
}
void loop()
{
// i have test mycode with this segment pulse firing. also i have
// tested without
delayMicroseconds(1);
digitalWrite(DRCTL,HIGH);
delayMicroseconds(1);
digitalWrite(DRCTL,LOW);
}

thanks 

Outcomes