AnsweredAssumed Answered

AD-FMCDAQ2-EBZ Wrong DAC Sampling Rate in MATLAB

Question asked by nkornbau on Apr 22, 2016
Latest reply on Apr 29, 2016 by nkornbau

I'm currently working with an AD-FMCDAQ2-EBZ installed on a ZC706 running Linux from an SD card. This is my first time working with FPGAs so I'm trying to crawl before I run or walk. My next goal is to be able to generate a CW tone from MATLAB using the the IIO System object.


I think I have the ZC706 and FMCDAQ2 setup correctly. I'm able to use IIO Oscilloscope to generate tones that look reasonable. For example, if I request a 100 MHz tone and check the output on a spectrum analyzer there is a nice spike at 100 MHz and an image at 900 MHz (as expected for a 1 GHz DAC sampling rate).


When I request a 100 MHz tone from MATLAB using the IIO System object and check the output on a spectrum analyzer there are spikes at 50 MHz, 450 MHz, and 550 MHz. As I understand it, these results suggest the the DAC is sampling at 500MHz instead of 1 GHz. I have tried to set DAC_SAMPLING_FREQ in the MATLAB script but it doesn't seem to be changing anything (so I'm probably not doing it correctly). I'll paste part of my script below.


As a side note, when I connect the DAC output to the ADC input of the FMCDAQ2, read the data into MATLAB, and do an FFT the resulting data matches the spectrum analyzer plots. So, it appears that the ADC side of things is working correctly.


Here is the initialization portion of the MATLAB script:


s = iio_sys_obj_matlab;

s.ip_address = 'xx.xx.xx.xx';

s.dev_name = 'daq2';

s.in_ch_no = 2;

s.out_ch_no = 2;

s.in_ch_size = 8192;

s.out_ch_size = 8192;


s = s.setupImpl();


input = cell(1, s.in_ch_no + length(s.iio_dev_cfg.cfg_ch));

Fs = 1e9; %sampling frequency

input{s.in_ch_no+1} = Fs; %ADC Sampling freq

input{s.in_ch_no+2} = Fs; %DAC sampling freq


Is the DAC sampling frequency not being set correctly during initialization? If not, what is correct way to set it? If the sampling frequency isn't the problem, what is another possible cause of the output frequency being half of the requested frequency with images centered around 500 MHz.


Any guidance would be greatly appreciated!