@@ -83,7 +83,7 @@ function testAD9081Rx(testCase)
83
83
function testAD9081RxWithTxDDS(testCase )
84
84
% Test DDS output
85
85
tx = adi .AD9081 .Tx(' uri' ,testCase .uri );
86
- [cdc , fdc , dc ] = tx .GetDataPathConfiguration();
86
+ [cdc , fdc , dc , srTx ] = tx .GetDataPathConfiguration();
87
87
testCase .log(sprintf(' cdc: %d , fdc: %d , dc: %d ' ,cdc , fdc , dc ))
88
88
tx = adi .AD9081 .Tx(...
89
89
' uri' ,testCase .uri ,...
@@ -92,15 +92,9 @@ function testAD9081RxWithTxDDS(testCase)
92
92
' num_fine_attr_channels' , fdc , ...
93
93
' num_dds_channels' , fdc * 2 );
94
94
tx.DataSource = ' DDS' ;
95
- toneFreq = 45e6 ;
96
- % tx.DDSFrequencies = repmat(toneFreq,2,2);
97
- % tx.DDSScales = repmat(0.9,2,2);
98
- tx .DDSSingleTone(toneFreq , 0.1 , 1 );
99
- % tx.NCOEnables(:) = 1;
100
- tx();
101
- pause(1 );
95
+
102
96
rx = adi .AD9081 .Rx(' uri' ,testCase .uri );
103
- [cdc , fdc , dc ] = rx .GetDataPathConfiguration();
97
+ [cdc , fdc , dc , srRx ] = rx .GetDataPathConfiguration();
104
98
testCase .log(sprintf(' cdc: %d , fdc: %d , dc: %d ' ,cdc , fdc , dc ))
105
99
rx = adi .AD9081 .Rx(...
106
100
' uri' ,testCase .uri ,...
@@ -109,15 +103,25 @@ function testAD9081RxWithTxDDS(testCase)
109
103
' num_fine_attr_channels' , fdc );
110
104
rx.EnabledChannels = 1 ;
111
105
valid = false ;
106
+
107
+ toneFreq = rand(1 ) * srRx / 2 ;
108
+ % tx.DDSFrequencies = repmat(toneFreq,2,2);
109
+ % tx.DDSScales = repmat(0.9,2,2);
110
+ tx .DDSSingleTone(toneFreq , 0.1 , 1 );
111
+ % tx.NCOEnables(:) = 1;
112
+ tx();
113
+ pause(1 );
114
+
112
115
for k= 1 : 10
113
116
[out , valid ] = rx();
114
117
end
115
- sr = rx .SamplingRate ;
118
+ % sr = rx.SamplingRate;
116
119
rx .release();
120
+ tx .release();
117
121
118
122
% plot(real(out));
119
123
% testCase.estFrequency(out,rx.SamplingRate);
120
- freqEst = meanfreq(double(real(out )),sr );
124
+ freqEst = meanfreq(double(real(out )),srRx );
121
125
122
126
testCase .verifyTrue(valid );
123
127
testCase .verifyGreaterThan(sum(abs(double(out ))),0 );
@@ -128,27 +132,17 @@ function testAD9081RxWithTxDDS(testCase)
128
132
function testAD9081RxWithTxDDSTwoChan(testCase )
129
133
% Test DDS output
130
134
tx = adi .AD9081 .Tx(' uri' ,testCase .uri );
131
- [cdc , fdc , dc , sr ] = tx .GetDataPathConfiguration();
135
+ [cdc , fdc , dc , srTx ] = tx .GetDataPathConfiguration();
132
136
tx = adi .AD9081 .Tx(...
133
137
' uri' ,testCase .uri ,...
134
138
' num_data_channels' , dc , ...
135
139
' num_coarse_attr_channels' , cdc , ...
136
140
' num_fine_attr_channels' , fdc , ...
137
141
' num_dds_channels' , fdc * 2 );
138
142
tx.DataSource = ' DDS' ;
139
- toneFreq1 = sr / 4 ;
140
- toneFreq2 = sr / 5 ;
141
- % tx.DDSFrequencies = [toneFreq1,toneFreq1,toneFreq2,toneFreq2;...
142
- % 0,0,0,0];
143
- % tx.DDSScales = [1,1,1,1;0,0,0,0].*0.029;
144
- tx.DDSPhases = [90000 ,0 ,90000 ,0 ; 0 ,0 ,0 ,0 ];
145
- tx.DDSFrequencies = repmat(horzcat([toneFreq1 ,toneFreq1 ], ...
146
- [toneFreq2 ,toneFreq2 ]),2 ,1 );
147
- tx.DDSScales = repmat([1 ,1 ;0,0 ].*0.029 ,1 ,2 );
148
- tx();
149
- pause(1 );
143
+
150
144
rx = adi .AD9081 .Rx(' uri' ,testCase .uri );
151
- [cdc , fdc , dc ] = rx .GetDataPathConfiguration();
145
+ [cdc , fdc , dc , srRx ] = rx .GetDataPathConfiguration();
152
146
testCase .log(sprintf(' cdc: %d , fdc: %d , dc: %d ' ,cdc , fdc , dc ))
153
147
rx = adi .AD9081 .Rx(...
154
148
' uri' ,testCase .uri ,...
@@ -157,16 +151,31 @@ function testAD9081RxWithTxDDSTwoChan(testCase)
157
151
' num_fine_attr_channels' , fdc );
158
152
rx.EnabledChannels = [1 2 ];
159
153
valid = false ;
154
+
155
+ toneFreqs = rand(2 ) * srRx / 2 ;
156
+ toneFreq1 = toneFreqs(1 );
157
+ toneFreq2 = toneFreqs(2 );
158
+ % tx.DDSFrequencies = [toneFreq1,toneFreq1,toneFreq2,toneFreq2;...
159
+ % 0,0,0,0];
160
+ % tx.DDSScales = [1,1,1,1;0,0,0,0].*0.029;
161
+ tx.DDSPhases = [90000 ,0 ,90000 ,0 ; 0 ,0 ,0 ,0 ];
162
+ tx.DDSFrequencies = repmat(horzcat([toneFreq1 ,toneFreq1 ], ...
163
+ [toneFreq2 ,toneFreq2 ]),2 ,1 );
164
+ tx.DDSScales = repmat([1 ,1 ;0,0 ].*0.029 ,1 ,2 );
165
+ tx();
166
+ pause(1 );
167
+
160
168
for k= 1 : 10
161
169
[out , valid ] = rx();
162
170
end
163
- sr = rx .SamplingRate ;
171
+ % sr = rx.SamplingRate;
164
172
rx .release();
173
+ tx .release();
165
174
166
175
% plot(real(out));
167
176
% testCase.estFrequency(out,sr);
168
- freqEst1 = testCase .estFrequencyMax(out(: ,1 ),sr ,true ,' TwoChanDDS_Chan1' );
169
- freqEst2 = testCase .estFrequencyMax(out(: ,2 ),sr ,true ,' TwoChanDDS_Chan2' );
177
+ freqEst1 = testCase .estFrequencyMax(out(: ,1 ),srRx ,true ,' TwoChanDDS_Chan1' );
178
+ freqEst2 = testCase .estFrequencyMax(out(: ,2 ),srRx ,true ,' TwoChanDDS_Chan2' );
170
179
% freqEst1 = meanfreq(double(real(out(:,1))),rx.SamplingRate);
171
180
% freqEst2 = meanfreq(double(real(out(:,2))),rx.SamplingRate);
172
181
@@ -181,14 +190,24 @@ function testAD9081RxWithTxDDSTwoChan(testCase)
181
190
function testAD9081RxWithTxData(testCase )
182
191
183
192
tx = adi .AD9081 .Tx(' uri' ,testCase .uri );
184
- [cdc , fdc , dc , sr ] = tx .GetDataPathConfiguration();
193
+ [cdc , fdc , dc , srTx ] = tx .GetDataPathConfiguration();
194
+
195
+ rx = adi .AD9081 .Rx(' uri' ,testCase .uri );
196
+ [cdc , fdc , dc , srRx ] = rx .GetDataPathConfiguration();
197
+ testCase .log(sprintf(' cdc: %d , fdc: %d , dc: %d ' ,cdc , fdc , dc ))
198
+ rx = adi .AD9081 .Rx(...
199
+ ' uri' ,testCase .uri ,...
200
+ ' num_data_channels' , dc , ...
201
+ ' num_coarse_attr_channels' , cdc , ...
202
+ ' num_fine_attr_channels' , fdc );
203
+ rx.EnabledChannels = 1 ;
185
204
186
205
% Test Tx DMA data output
187
- amplitude = 2 ^ 15 ; frequency = sr / 6 ;
206
+ amplitude = 2 ^ 15 ; frequency = rand( 1 ) * srRx / 2 ;
188
207
swv1 = dsp .SineWave(amplitude , frequency );
189
208
swv1.ComplexOutput = false ;
190
209
swv1.SamplesPerFrame = 2 ^ 20 ;
191
- swv1.SampleRate = sr ;
210
+ swv1.SampleRate = srTx ;
192
211
y = swv1();
193
212
194
213
tx = adi .AD9081 .Tx(...
@@ -200,24 +219,16 @@ function testAD9081RxWithTxData(testCase)
200
219
tx.DataSource = ' DMA' ;
201
220
tx.EnableCyclicBuffers = true ;
202
221
tx(y );
203
- rx = adi .AD9081 .Rx(' uri' ,testCase .uri );
204
- [cdc , fdc , dc ] = rx .GetDataPathConfiguration();
205
- testCase .log(sprintf(' cdc: %d , fdc: %d , dc: %d ' ,cdc , fdc , dc ))
206
- rx = adi .AD9081 .Rx(...
207
- ' uri' ,testCase .uri ,...
208
- ' num_data_channels' , dc , ...
209
- ' num_coarse_attr_channels' , cdc , ...
210
- ' num_fine_attr_channels' , fdc );
211
222
212
- rx.EnabledChannels = 1 ;
213
223
for k= 1 : 10
214
224
[out , valid ] = rx();
215
225
end
216
- sr = rx .SamplingRate ;
226
+ % sr = rx.SamplingRate;
217
227
rx .release();
228
+ tx .release();
218
229
219
230
% plot(real(out));
220
- freqEst = meanfreq (double(real(out )),sr );
231
+ freqEst = testCase .estFrequencyMax (double(real(out )),srRx );
221
232
222
233
testCase .verifyTrue(valid );
223
234
testCase .verifyGreaterThan(sum(abs(double(out ))),0 );
@@ -228,21 +239,33 @@ function testAD9081RxWithTxData(testCase)
228
239
function testAD9081RxWithTxDataTwoChan(testCase )
229
240
230
241
tx = adi .AD9081 .Tx(' uri' ,testCase .uri );
231
- [cdc , fdc , dc , sr ] = tx .GetDataPathConfiguration();
242
+ [cdc , fdc , dc , srTx ] = tx .GetDataPathConfiguration();
243
+
244
+ rx = adi .AD9081 .Rx(' uri' ,testCase .uri );
245
+ [cdc , fdc , dc , srRx ] = rx .GetDataPathConfiguration();
246
+ testCase .log(sprintf(' cdc: %d , fdc: %d , dc: %d ' ,cdc , fdc , dc ))
247
+ rx = adi .AD9081 .Rx(...
248
+ ' uri' ,testCase .uri ,...
249
+ ' num_data_channels' , dc , ...
250
+ ' num_coarse_attr_channels' , cdc , ...
251
+ ' num_fine_attr_channels' , fdc );
252
+ rx.EnabledChannels = [1 ,2 ];
253
+
232
254
233
255
% Test Tx DMA data output
234
- amplitude = 2 ^ 15 ; toneFreq1 = sr / 5 ;
256
+ toneFreqs = rand(2 ) * srRx / 2 ;
257
+ amplitude = 2 ^ 15 ; toneFreq1 = toneFreqs(1 );
235
258
swv1 = dsp .SineWave(amplitude , toneFreq1 );
236
259
swv1.ComplexOutput = false ;
237
260
swv1.SamplesPerFrame = 2 ^ 20 ;
238
- swv1.SampleRate = sr ;
261
+ swv1.SampleRate = srTx ;
239
262
y1 = swv1();
240
263
241
- amplitude = 2 ^ 15 ; toneFreq2 = sr / 8 ;
264
+ amplitude = 2 ^ 15 ; toneFreq2 = toneFreqs( 2 ) ;
242
265
swv1 = dsp .SineWave(amplitude , toneFreq2 );
243
266
swv1.ComplexOutput = false ;
244
267
swv1.SamplesPerFrame = 2 ^ 20 ;
245
- swv1.SampleRate = sr ;
268
+ swv1.SampleRate = srTx ;
246
269
y2 = swv1();
247
270
248
271
tx = adi .AD9081 .Tx(...
@@ -255,25 +278,18 @@ function testAD9081RxWithTxDataTwoChan(testCase)
255
278
tx.EnableCyclicBuffers = true ;
256
279
tx.EnabledChannels = [1 ,2 ];
257
280
tx([y1 ,y2 ]);
258
- rx = adi .AD9081 .Rx(' uri' ,testCase .uri );
259
- [cdc , fdc , dc ] = rx .GetDataPathConfiguration();
260
- testCase .log(sprintf(' cdc: %d , fdc: %d , dc: %d ' ,cdc , fdc , dc ))
261
- rx = adi .AD9081 .Rx(...
262
- ' uri' ,testCase .uri ,...
263
- ' num_data_channels' , dc , ...
264
- ' num_coarse_attr_channels' , cdc , ...
265
- ' num_fine_attr_channels' , fdc );
266
- rx.EnabledChannels = [1 ,2 ];
281
+
267
282
for k= 1 : 10
268
283
[out , valid ] = rx();
269
284
end
270
- sr = rx .SamplingRate ;
285
+ % sr = rx.SamplingRate;
271
286
rx .release();
287
+ tx .release();
272
288
273
289
% plot(real(out));
274
290
% testCase.estFrequency(out,rx.SamplingRate);
275
- freqEst1 = testCase .estFrequencyMax(out(: ,1 ),sr ,true ,' TwoChanData_Chan1' );
276
- freqEst2 = testCase .estFrequencyMax(out(: ,2 ),sr ,true ,' TwoChanData_Chan2' );
291
+ freqEst1 = testCase .estFrequencyMax(out(: ,1 ),srRx ,true ,' TwoChanData_Chan1' );
292
+ freqEst2 = testCase .estFrequencyMax(out(: ,2 ),srRx ,true ,' TwoChanData_Chan2' );
277
293
% freqEst = meanfreq(double(real(out)),rx.SamplingRate);
278
294
279
295
testCase .verifyTrue(valid );
0 commit comments