AnsweredAssumed Answered

AD9958 questions re: phase settings and general register writes.

Question asked by crezyoz on Aug 24, 2012
Latest reply on Aug 27, 2012 by crezyoz

Hello

 

I am controlling the AD9958 form a kinetis K70 MPU. I hvae a few questions about the register control.

 

What I am doing at the moment is resetting the 9958, then writing registers and setting initial phase & ftw settings:

 

void ddsFuncSetup(uint32 ftw,uint16 phase, uint8 chan)

{

    ddsSelChan(chan | CSR_SERMODE_3WIRE);     //

    //VC0 GAIN  = HIGH PLL DIV = 20   SYNC CLK DISABLED;

    DDS_send24(0xD30020u,DDS_FR1);  

//Full scale Current mode, autoclear phase accumulator

    DDS_send24(0x00000304u,DDS_CFR);    

    DDS_send32(ftw,DDS_CFTW);    //0x04 0x19 0x99 0x99 0x9A

    DDS_send16(phase,DDS_CPOW);

    ddsIOUpdate();

    ddsSelChan(CSR_CH_BOTH | CSR_SERMODE_3WIRE);     //Leave DDS in BOTH CANNELS mode

 

}

 

I need CH1 to be 90 degrees phase offset from CH0. So, the routine above is called once for each channel.

Initially I had something like this in the  routine above, attempting to set both channels up similarly and only set the phase for CH1:

..

   ddsSelChan(CSR_CH_BOTH | CSR_SERMODE_3WIRE);    

... code as above

 

// set only CH1 to 90 deg.

     ddsSelChan(CSR_CH1_ONLY | CSR_SERMODE_3WIRE);     //CH1

     DDS_send16(0x1000,DDS_CPOW);

    ddsIOUpdate();

    ddsSelChan(CSR_CH_BOTH | CSR_SERMODE_3WIRE);     //Leave DDS in BOTH CANNELS mode

.....

Ideally I would like to set the phase only once change only FTW during program execution.

I had hoped to be able to send only the FTW, during the rest of the program execution. Changing only the freq of both channels and maintaining the 90 phase offset.

 

In my code the phase doesn't change until the next write to the 9958. Everything else updates but it takes one more write of a register to get the phase to change on the outputs.

 

Even if I add another register write directly after the phase setting, it will work

void ddsSetFreq_Phase(uint32 ftw,uint16 phase,uint8 chan)

{

    ddsSelChan(chan | CSR_SERMODE_3WIRE);

    DDS_send32(ftw,DDS_CFTW);    //0x04 0x19 0x99 0x99 0x9A

    DDS_send16(phase,DDS_CPOW);

    DDS_send24(0x000013FFu,DDS_ACR); // JUST A TEST. FOR NOW.. HAS TO BE HERE TO GET THE PHASE CHANGE

    ddsIOUpdate();

}

 

 


 

I am not fully conversant in the DDS techniques so I was wondering if there was some Phase Accumulator clearing setting that I should be paying particular attention to.

 

And.. when writing registers, does the 9958 only update registers you have written to when you do an IOUpdate? In the event I only want to change the FTW and expect everything else to stay the same?

 

Apologies If I am not completely clear in my questions. Still slogging through this.

Outcomes