AnsweredAssumed Answered

AD9859: can't write to registers correctly

Question asked by ThomasGal on May 5, 2015
Latest reply on May 5, 2015 by KennyG

Hello,

 

 

I have another problem...

(previous thread: https://ez.analog.com/thread/52214).

 

I now manage to program an output frequency correctly. When I try to write several output frequencies in FTW0 with 5 seconds interval. I'm getting a problem. Here's my code:

 

In main

int main () {
     // init PWM
     ...
     // init DDS with reset = 1 for 0.1 second
     // Write to CFR2 to multiply my PWM clock by 14 -> SYNC_CLK = 82Mhz
     ...
     myDevice.FTW0_write(0x50000000);
     wait(5);
     myDevice.FTW0_write(0x4C30C30C);
     wait(5);
}





 

 

In AD9859.c

void write_reg(int address, uint32_t value, int num_bytes) {
   _mosi.output();
   write_value(address & 0x7f);
   while (num_bytes > 0) {
      write_value(value >> ((num_bytes-1)*8) & 0xFF);
      num_bytes--;
   }
_io_update = 1;
wait_us(50);
_io_update = 0;
}





I'm never getting the first output. After 5seconds, I'm getting the 2nd output with 2 sidelobes (left picture). After 5 more seconds, these sidelobes disappear. I think my io_updates are wrong but I don't see why. Can you enlighten me pls? I didn't post the rest of the codes, I check with an oscilloscope and the write_value works well. The homemade SPI works at 500khz.

 

Thank you,

 

Thomas

 

SCR0004.PNGSCR0005.PNG

Outcomes