Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit eceaf3c

Browse files
authored
Update hil_models examples to new system objects (#52)
Move older examples to legacy folder and add new examples for simple device usage. Signed-off-by: Travis Collins <[email protected]>
1 parent 690e781 commit eceaf3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+796
-0
lines changed

hil_models/ad936x/ad9361.m

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
% Test Tx DMA data output
2+
amplitude = 2^15; frequency = 0.12e6;
3+
swv1 = dsp.SineWave(amplitude, frequency);
4+
swv1.ComplexOutput = true;
5+
swv1.SamplesPerFrame = 1e4*10;
6+
swv1.SampleRate = 3e6;
7+
y = swv1();
8+
9+
uri = 'ip:192.168.2.1';
10+
fc = 1e9;
11+
12+
%% Tx set up
13+
tx = adi.AD9361.Tx('uri',uri);
14+
tx.CenterFrequency = fc;
15+
tx.DataSource = 'DMA';
16+
tx.EnableCyclicBuffers = true;
17+
tx.AttenuationChannel0 = -30;
18+
tx(y);
19+
20+
%% Rx set up
21+
rx = adi.AD9361.Rx('uri',uri);
22+
rx.CenterFrequency = fc;
23+
24+
%% Run
25+
for k=1:10
26+
valid = false;
27+
while ~valid
28+
[out, valid] = rx();
29+
end
30+
end
31+
rx.release();
32+
tx.release();
33+
34+
%% Plot
35+
nSamp = length(out);
36+
fs = tx.SamplingRate;
37+
FFTRxData = fftshift(10*log10(abs(fft(out))));
38+
df = fs/nSamp; freqRangeRx = (-fs/2:df:fs/2-df).'/1000;
39+
plot(freqRangeRx, FFTRxData);
40+
xlabel('Frequency (kHz)');ylabel('Amplitude (dB)');grid on;

hil_models/ad9371/ad9371.m

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
% Test Tx DMA data output
2+
amplitude = 2^15; frequency = 20e6;
3+
swv1 = dsp.SineWave(amplitude, frequency);
4+
swv1.ComplexOutput = true;
5+
swv1.SamplesPerFrame = 2^20;
6+
swv1.SampleRate = 100e6;
7+
y = swv1();
8+
9+
uri = 'ip:192.168.2.1';
10+
fc = 1e9;
11+
12+
%% Tx set up
13+
tx = adi.AD9371.Tx('uri',uri);
14+
tx.CenterFrequency = fc;
15+
tx.EnableCustomProfile = true;
16+
tx.CustomProfileFileName = 'profile_TxBW100_ORxBW100_RxBW100.txt';
17+
tx.DataSource = 'DMA';
18+
tx.EnableCyclicBuffers = true;
19+
tx.AttenuationChannel0 = -10;
20+
tx(y);
21+
22+
%% Rx set up
23+
rx = adi.AD9371.Rx('uri',uri);
24+
rx.CenterFrequency = fc;
25+
26+
%% Run
27+
for k=1:20
28+
valid = false;
29+
while ~valid
30+
[out, valid] = rx();
31+
end
32+
end
33+
rx.release();
34+
tx.release();
35+
36+
%% Plot
37+
nSamp = length(out);
38+
fs = tx.SamplingRate;
39+
FFTRxData = fftshift(10*log10(abs(fft(out))));
40+
df = fs/nSamp; freqRangeRx = (-fs/2:df:fs/2-df).'/1000;
41+
plot(freqRangeRx, FFTRxData);
42+
xlabel('Frequency (kHz)');ylabel('Amplitude (dB)');grid on;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
<profile AD9371 version=0 name=Rx 100, IQrate 122.880>
2+
<clocks>
3+
<deviceClock_kHz=122880>
4+
<clkPllVcoFreq_kHz=9830400>
5+
<clkPllVcoDiv=2>
6+
<clkPllHsDiv=4>
7+
</clocks>
8+
9+
<rx>
10+
<adcDiv=1>
11+
<rxFirDecimation=2>
12+
<rxDec5Decimation=5>
13+
<enHighRejDec5=1>
14+
<rhb1Decimation=1>
15+
<iqRate_kHz=122880>
16+
<rfBandwidth_Hz=100000000>
17+
<rxBbf3dBCorner_kHz=100000>
18+
19+
<filter FIR gain=-6 num=48>
20+
-5
21+
-26
22+
32
23+
51
24+
-67
25+
-116
26+
140
27+
212
28+
-252
29+
-367
30+
429
31+
595
32+
-688
33+
-931
34+
1072
35+
1427
36+
-1650
37+
-2188
38+
2612
39+
3496
40+
-4802
41+
-7591
42+
9656
43+
32317
44+
32317
45+
9656
46+
-7591
47+
-4802
48+
3496
49+
2612
50+
-2188
51+
-1650
52+
1427
53+
1072
54+
-931
55+
-688
56+
595
57+
429
58+
-367
59+
-252
60+
212
61+
140
62+
-116
63+
-67
64+
51
65+
32
66+
-26
67+
-5
68+
</filter>
69+
70+
<adc-profile num=16>
71+
534
72+
386
73+
201
74+
98
75+
1280
76+
491
77+
1591
78+
279
79+
1306
80+
104
81+
792
82+
28
83+
48
84+
39
85+
23
86+
187
87+
</adc-profile>
88+
</rx>
89+
90+
<obs>
91+
<adcDiv=1>
92+
<rxFirDecimation=2>
93+
<rxDec5Decimation=5>
94+
<enHighRejDec5=1>
95+
<rhb1Decimation=1>
96+
<iqRate_kHz=122880>
97+
<rfBandwidth_Hz=100000000>
98+
<rxBbf3dBCorner_kHz=50000>
99+
100+
<filter FIR gain=0 num=48>
101+
0
102+
-21
103+
18
104+
39
105+
-36
106+
-87
107+
81
108+
157
109+
-149
110+
-269
111+
260
112+
432
113+
-423
114+
-672
115+
668
116+
1025
117+
-1036
118+
-1570
119+
1650
120+
2547
121+
-2971
122+
-5686
123+
4361
124+
18361
125+
18361
126+
4361
127+
-5686
128+
-2971
129+
2547
130+
1650
131+
-1570
132+
-1036
133+
1025
134+
668
135+
-672
136+
-423
137+
432
138+
260
139+
-269
140+
-149
141+
157
142+
81
143+
-87
144+
-36
145+
39
146+
18
147+
-21
148+
0
149+
</filter>
150+
151+
<adc-profile num=16>
152+
534
153+
386
154+
201
155+
98
156+
1280
157+
491
158+
1591
159+
279
160+
1306
161+
104
162+
792
163+
28
164+
48
165+
39
166+
23
167+
187
168+
</adc-profile>
169+
170+
<lpbk-adc-profile num=16>
171+
599
172+
357
173+
201
174+
98
175+
1280
176+
112
177+
1505
178+
53
179+
1331
180+
21
181+
820
182+
40
183+
48
184+
40
185+
23
186+
191
187+
</lpbk-adc-profile>
188+
</obs>
189+
190+
<tx>
191+
<dacDiv=2.5>
192+
<txFirInterpolation=1>
193+
<thb1Interpolation=2>
194+
<thb2Interpolation=2>
195+
<txInputHbInterpolation=1>
196+
<iqRate_kHz=122880>
197+
<primarySigBandwidth_Hz=40000000>
198+
<rfBandwidth_Hz=100000000>
199+
<txDac3dBCorner_kHz=100000>
200+
<txBbf3dBCorner_kHz=50000>
201+
202+
<filter FIR gain=6 num=16>
203+
7
204+
-244
205+
182
206+
-149
207+
-81
208+
909
209+
-2806
210+
20438
211+
-2806
212+
909
213+
-81
214+
-149
215+
182
216+
-244
217+
7
218+
0
219+
</filter>
220+
</tx>
221+
</profile>

0 commit comments

Comments
 (0)