Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions hil_models/adrv9371/ad9371.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
data_in_device = axi-ad9371-tx-hpc
data_out_device = axi-ad9371-rx-hpc
ctrl_device = ad9371-phy
channel = RX_LO_FREQ,IN,out_altvoltage0_RX_LO_frequency,
channel = RX1_RF_BANDWIDTH,IN,in_voltage0_rf_bandwidth,
channel = RX1_GAIN_MODE,IN,in_voltage0_gain_control_mode,
channel = RX1_GAIN,IN,in_voltage0_hardwaregain,
channel = RX1_RSSI,OUT,in_voltage0_rssi,
channel = RX2_RF_BANDWIDTH,IN,in_voltage1_rf_bandwidth,
channel = RX2_GAIN_MODE,IN,in_voltage1_gain_control_mode,
channel = RX2_GAIN,IN,in_voltage1_hardwaregain,
channel = RX2_RSSI,OUT,in_voltage1_rssi,
channel = TX_LO_FREQ,IN,out_altvoltage1_TX_LO_frequency,
channel = TX_RF_BANDWIDTH,IN,out_voltage0_rf_bandwidth,
channel = TX_GAIN,IN,out_voltage0_hardwaregain,
56 changes: 56 additions & 0 deletions hil_models/adrv9371/ad9371_matlab.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
clear;
clc;

s = iio_sys_obj_matlab; % Constructor
s.ip_address = '10.66.99.200';
s.dev_name = 'ad9371';
s.in_ch_no = 1;
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 = 245760000;
Fc = 1e6;
Bw = 75000000;
t = 1/Fs:1/Fs:s.in_ch_size/Fs;
for i=1:s.in_ch_no
input{i} = sin(2*pi*Fc*t+(i-1)*pi/2)*2^15;
end

input{s.getInChannel('RX_LO_FREQ')} = 2.45e9;
input{s.getInChannel('RX1_RF_BANDWIDTH')} = Bw;
input{s.getInChannel('RX1_GAIN_MODE')} = 'automatic';
input{s.getInChannel('RX1_GAIN')} = 0;
input{s.getInChannel('RX2_GAIN_MODE')} = 'automatic';
input{s.getInChannel('RX2_RF_BANDWIDTH')} = Bw;
input{s.getInChannel('RX2_GAIN')} = 0;
input{s.getInChannel('TX_LO_FREQ')} = 2.45e9;
input{s.getInChannel('TX_RF_BANDWIDTH')} = Bw;
input{s.getInChannel('TX_GAIN')} = -20;

output = cell(1, s.out_ch_no + length(s.iio_dev_cfg.mon_ch));

for i = 1:20
output = stepImpl(s, input);
rssi1 = output{s.out_ch_no+1};
rssi2 = output{s.out_ch_no+2};
end

s.releaseImpl();

figure % new figure
ax1 = subplot(2,1,1); % top subplot
ax2 = subplot(2,1,2); % bottom subplot

plot(ax1,output{1});
title(ax1,'I');
xlabel('Sample');
ylabel('Amplitude');

plot(ax2,output{2});
title(ax2,'Q');
xlabel('Sample');
ylabel('Amplitude');