From a8e82c2d0f817550f0445b30f1554dd4f4703022 Mon Sep 17 00:00:00 2001 From: "Travis F. Collins" Date: Wed, 1 Jun 2022 15:13:10 -0600 Subject: [PATCH] Add very basic QMxFE example Signed-off-by: Travis F. Collins --- hsx_examples/qmxfe/QuadMxFE_Basic.m | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 hsx_examples/qmxfe/QuadMxFE_Basic.m diff --git a/hsx_examples/qmxfe/QuadMxFE_Basic.m b/hsx_examples/qmxfe/QuadMxFE_Basic.m new file mode 100644 index 00000000..03d166fc --- /dev/null +++ b/hsx_examples/qmxfe/QuadMxFE_Basic.m @@ -0,0 +1,41 @@ +% Basic example of looping back Quad-MxFE (AD9081) using FPGA DDSs +uri = 'ip:192.168.2.1'; + +%% Tx set up +tx = adi.QuadMxFE.Tx('uri',uri); +tx.DataSource = 'DDS'; +toneFreq = 45e6; +tx.DDSFrequencies = repmat(toneFreq,2,64); +tx(); + +%% Rx set up +rx = adi.QuadMxFE.Rx('uri',uri); +rx.SamplesPerFrame = 1024; + +%% Set NCOs to be the same between TX/RX +mainNCOFrequency = 1e6*ones(1,4); +channelNCOFrequency = 2e6*ones(1,4); +for chip = {'A','B','C','D'} + rx.(['MainNCOFrequenciesChip',chip{:}]) = mainNCOFrequency; + rx.(['ChannelNCOFrequenciesChip',chip{:}]) = channelNCOFrequency; + tx.(['MainNCOFrequenciesChip',chip{:}]) = mainNCOFrequency; + tx.(['ChannelNCOFrequenciesChip',chip{:}]) = channelNCOFrequency; +end + +%% Run +for k=1:10 + valid = false; + while ~valid + [out, valid] = rx(); + end +end +rx.release(); +tx.release(); + +%% Plot +nSamp = length(out); +fs = tx.SamplingRate; +FFTRxData = fftshift(10*log10(abs(fft(out)))); +df = fs/nSamp; freqRangeRx = (-fs/2:df:fs/2-df).'/1000; +plot(freqRangeRx, FFTRxData); +xlabel('Frequency (kHz)');ylabel('Amplitude (dB)');grid on;