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
40 changes: 40 additions & 0 deletions hil_models/ad936x/ad9361.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
% Test Tx DMA data output
amplitude = 2^15; frequency = 0.12e6;
swv1 = dsp.SineWave(amplitude, frequency);
swv1.ComplexOutput = true;
swv1.SamplesPerFrame = 1e4*10;
swv1.SampleRate = 3e6;
y = swv1();

uri = 'ip:192.168.2.1';
fc = 1e9;

%% Tx set up
tx = adi.AD9361.Tx('uri',uri);
tx.CenterFrequency = fc;
tx.DataSource = 'DMA';
tx.EnableCyclicBuffers = true;
tx.AttenuationChannel0 = -30;
tx(y);

%% Rx set up
rx = adi.AD9361.Rx('uri',uri);
rx.CenterFrequency = fc;

%% 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;
42 changes: 42 additions & 0 deletions hil_models/ad9371/ad9371.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
% Test Tx DMA data output
amplitude = 2^15; frequency = 20e6;
swv1 = dsp.SineWave(amplitude, frequency);
swv1.ComplexOutput = true;
swv1.SamplesPerFrame = 2^20;
swv1.SampleRate = 100e6;
y = swv1();

uri = 'ip:192.168.2.1';
fc = 1e9;

%% Tx set up
tx = adi.AD9371.Tx('uri',uri);
tx.CenterFrequency = fc;
tx.EnableCustomProfile = true;
tx.CustomProfileFileName = 'profile_TxBW100_ORxBW100_RxBW100.txt';
tx.DataSource = 'DMA';
tx.EnableCyclicBuffers = true;
tx.AttenuationChannel0 = -10;
tx(y);

%% Rx set up
rx = adi.AD9371.Rx('uri',uri);
rx.CenterFrequency = fc;

%% Run
for k=1:20
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;
221 changes: 221 additions & 0 deletions hil_models/ad9371/profile_TxBW100_ORxBW100_RxBW100.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
<profile AD9371 version=0 name=Rx 100, IQrate 122.880>
<clocks>
<deviceClock_kHz=122880>
<clkPllVcoFreq_kHz=9830400>
<clkPllVcoDiv=2>
<clkPllHsDiv=4>
</clocks>

<rx>
<adcDiv=1>
<rxFirDecimation=2>
<rxDec5Decimation=5>
<enHighRejDec5=1>
<rhb1Decimation=1>
<iqRate_kHz=122880>
<rfBandwidth_Hz=100000000>
<rxBbf3dBCorner_kHz=100000>

<filter FIR gain=-6 num=48>
-5
-26
32
51
-67
-116
140
212
-252
-367
429
595
-688
-931
1072
1427
-1650
-2188
2612
3496
-4802
-7591
9656
32317
32317
9656
-7591
-4802
3496
2612
-2188
-1650
1427
1072
-931
-688
595
429
-367
-252
212
140
-116
-67
51
32
-26
-5
</filter>

<adc-profile num=16>
534
386
201
98
1280
491
1591
279
1306
104
792
28
48
39
23
187
</adc-profile>
</rx>

<obs>
<adcDiv=1>
<rxFirDecimation=2>
<rxDec5Decimation=5>
<enHighRejDec5=1>
<rhb1Decimation=1>
<iqRate_kHz=122880>
<rfBandwidth_Hz=100000000>
<rxBbf3dBCorner_kHz=50000>

<filter FIR gain=0 num=48>
0
-21
18
39
-36
-87
81
157
-149
-269
260
432
-423
-672
668
1025
-1036
-1570
1650
2547
-2971
-5686
4361
18361
18361
4361
-5686
-2971
2547
1650
-1570
-1036
1025
668
-672
-423
432
260
-269
-149
157
81
-87
-36
39
18
-21
0
</filter>

<adc-profile num=16>
534
386
201
98
1280
491
1591
279
1306
104
792
28
48
39
23
187
</adc-profile>

<lpbk-adc-profile num=16>
599
357
201
98
1280
112
1505
53
1331
21
820
40
48
40
23
191
</lpbk-adc-profile>
</obs>

<tx>
<dacDiv=2.5>
<txFirInterpolation=1>
<thb1Interpolation=2>
<thb2Interpolation=2>
<txInputHbInterpolation=1>
<iqRate_kHz=122880>
<primarySigBandwidth_Hz=40000000>
<rfBandwidth_Hz=100000000>
<txDac3dBCorner_kHz=100000>
<txBbf3dBCorner_kHz=50000>

<filter FIR gain=6 num=16>
7
-244
182
-149
-81
909
-2806
20438
-2806
909
-81
-149
182
-244
7
0
</filter>
</tx>
</profile>
Loading