aboutsummaryrefslogtreecommitdiffstats
path: root/host/docs/rd_testing.dox
blob: 816e338f591fa08436ef0f658e0407c26d24a002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
/*! \page page_rdtesting R&D Testing Procedures

All defined R&D test procedures are listed here. These tests are meant as a tool
for Ettus R&D to enable faster and more reliable development. Note these tests
are no replacement for manufacturing or production tests, and should not be
treated as such. Instead, they are meant to catch common failure modes during
development. As a result, test definitions are fairly light-weight.

\section rdtesting_gpsdo GPSDO Tests

| Test Code        | Device    | Peripherals       | Manual Test Procedure        | Automatic Test Procedure  |
|------------------|-----------|-------------------|------------------------------|---------------------------|
| GPS-X310-TCXO-v1 | USRP X310 | Jackson Labs TCXO | \ref rdtesting_gpsdo_manual  | \ref rdtesting_gpsdo_auto |
| GPS-X310-OCXO-v1 | USRP X310 | Jackson Labs OCXO | \ref rdtesting_gpsdo_manual  | \ref rdtesting_gpsdo_auto |
| GPS-X300-TCXO-v1 | USRP X300 | Jackson Labs TCXO | \ref rdtesting_gpsdo_manual  | \ref rdtesting_gpsdo_auto |
| GPS-X300-OCXO-v1 | USRP X300 | Jackson Labs OCXO | \ref rdtesting_gpsdo_manual  | \ref rdtesting_gpsdo_auto |
| GPS-B200-TCXO-v1 | USRP B200 | Jackson Labs TCXO | \ref rdtesting_gpsdo_manual  | \ref rdtesting_gpsdo_auto |
| GPS-B210-TCXO-v1 | USRP B210 | Jackson Labs TCXO | \ref rdtesting_gpsdo_manual  | \ref rdtesting_gpsdo_auto |


\subsection rdtesting_gpsdo_recommendations Recommendations

For cursory testing, not all tests within a device family are required (e.g.,
only testing the OCXO on any X-Series, and testing the TCXO on any B-Series is
sufficient).

The following tests are recommended for a minimum test (N stands for the latest
version of this test):
- One of GPS-X310-OCXO-vN or GPS-X300-OCXO-vN
- One of GPS-B210-TCXO-vN or GPS-B200-TCXO-vN

\subsection rdtesting_gpsdo_requirements Requirements

All of these tests require a device that is GPSDO capable (e.g., X3x0, B2x0,
N2x0). For those devices that have a separate GPS component (such as the Jackson
Labs GPSDOs), this component is also required (called the "peripheral" in the
following).

\subsection rdtesting_gpsdo_manual GPSDO: Manual Test Procedure

1. Without connecting the peripheral to the device, run `uhd_usrp_probe` on the
   device and verify that the lack of GPSDO is correctly reported under "sensors".
   No warning or error must be printed.
2. This and the following tests are run with the peripheral connected: Run
   `uhd_usrp_probe` and verify that the GPSDO is correctly reported under "sensors".
   Power down the device before connecting the peripheral. The GPSDO must be
   reported found, and no error or warning must be printed.
3. OCXO only: Without connecting the GPS antenna input, run
   `utils/query_gpsdo_sensors`. To pass, it must report the GPSDO as found, lock to
   the external reference, but then report not being locked to GPS. The tool
   will report a valid GPS time, and a string such as "GPS and UHD Device time
   are aligned" in case of success.
4. Connect a GPS antenna to the input and make sure it is in a position to
   receive GPS satellite data. Confirm that GPS lock is reported by running
   `utils/query_gpsdo_sensors` within 20 minutes of connecting the antenna.
   The tool `query_gpsdo_sensors` will print a string such as "GPS Locked" in
   case of success.

All of these tests must pass for a 'pass' validation.

\subsection rdtesting_gpsdo_auto GPSDO: Automatic Test Procedure

tbd


\section rdtesting_devtest Devtests

| Test Code           | Device        | Peripherals | Manual Test Procedure         | Automatic Test Procedure    |
|---------------------|---------------|-------------|-------------------------------|-----------------------------|
| DEVTEST-X310-XG-v1  | USRP X310     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-X310-HG-v1  | USRP X310     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-X300-XG-v1  | USRP X300     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-X300-HG-v1  | USRP X300     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-E310-SG1-v1 | USRP E310-SG1 | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-E310-SG3-v1 | USRP E310-SG3 | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-B200-v1     | USRP B200     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-B210-v1     | USRP B210     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-B200m-v1    | USRP B200mini | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-B205m-v1    | USRP B205mini | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-N310-v1     | USRP N310     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |
| DEVTEST-E320-v1     | USRP E320     | None        | \ref rdtesting_devtest_manual | \ref rdtesting_devtest_auto |

The devtests are hardware tests built in to the UHD make system. They can be run
directly from the build directory and require no configuration.
Devtests are designed to always run, regardless of the actual device
configuration. This means, by definition, that devtests cannot require special
cabling, specific daughtercards, etc.

Note: The actual devtests can change, since they're part of the code. This does
not require a version bump on the test code.

\subsection rdtesting_devtest_requirements Requirements

Devtests are only defined for some devices. When running a devtest, all
peripherals must be disconnected (e.g., no daughterboards on the X-Series, no
GPSDOs on the B- and X-Series).

Running these tests requires the yaml package. On Ubuntu, run
`sudo apt-get install python-yaml` to install the Python 2 version of the YAML
library.

\subsection rdtesting_devtest_manual Devtest: Manual Test Procedure

### X3x0 procedure

1. Make sure no peripherals are connected to the device (no daughterboards, no
   GSPDO, front panel GPIO is unconnected).
2. When testing the HG image, run a test once for each connection (1 GigE and
   10 GigE). When testing the XG image, a test on either connection (SFP0 or
   SFP1) is sufficient. In both cases, also test via PCIe.
3. When the device is connected, simply run `make test_x3x0` from the command
   line in the build directory. Multiple devices connected will all get tested,
   there is no requirement to only connect a single device at a time (because
   devtest will run sequentially anyway).
4. Devtest must report no failures for a 'pass' validation.

### B2xx procedure

Note: The test codes with an 'm' suffix refer to B200mini and B205mini,
respectively.

1. Make sure no peripherals are connected to the device (no GPSDO if applicable,
   GPIO pins unconnected)
2. Test once via USB3, once via USB2.
3. Simply run `make test_b2xx`
4. Devtest must report no failures for a 'pass' validation.

### E310 procedure

1. Make sure GPIO pins are unconnected.
2. Tests need to be run natively on the device. If the build environment is
   available on the device, running `make test_e3xx` is sufficient.
3. In general, there is no build environment on the device (e.g. when doing a
   typical sshfs mount of an environment). In this case, copy the contents of
   the devtest directory onto the device, and run the following command (the
   environment variables need to point to the location of the devtest code, the
   location of the UHD build, and where you want to store log files, respectively):

       $DEVTEST_DIR/run_testsuite.py --src-dir $DEVTEST_DIR \
                                     --devtest-pattern e3xx \
                                     --build-type na \
                                     --build-dir $BUILD_DIR \
                                     --device-filter e3x0 \
                                     --log-dir $LOG_DIR

4. Devtest must report no failures for a 'pass' validation.

### E320 procedure

1. Make sure no peripherals are connected to the device (no
   GSPDO, front panel GPIO is unconnected).
2. Run tests for both 1G and XG image.
3. When the device is connected, simply run `make test_e320` from the command
   line in the build directory.
4. Devtest must report no failures for a 'pass' validation.


\subsection rdtesting_devtest_auto Devtest: Automatic Test Procedure

As all these tests can be run unsupervised, they can be run automatically given
the correct device setup. The return code of the tests can be used to check for
pass/fail conditions (return code 0 means 'pass').

\section rdtesting_fpga_testbenches FPGA: Testing through Simulations

Test benches provide a faster way to verify the design through simulations.

| Test Code        | Device    | Peripherals       | Manual Test Procedure                   | Automatic Test Procedure             |
|------------------|-----------|-------------------|-----------------------------------------|--------------------------------------|
| FPGATB-v1        | None      | None              | \ref rdtesting_fpga_testbenches_manual  | \ref rdtesting_fpga_testbenches_auto |

\subsection rdtesting_fpga_testbenches_requirement Requirements

These tests are simulations and do not need any device. Vivado 15.4 should be
installed.

\subsection rdtesting_fpga_testbenches_manual Manual Test Procedure

1. Go to the fpga directory depending on which test needs to be run.

  1. NoC block test benches:
     Most of the NoC blocks have a test bench written in System Verilog that provides stimuli to the noc_block to verify it. The test bench for a block resides in `<fpga-dir>/usrp3/lib/rfnoc/&zwj;*_tb`.

  2. Running unit test benches:
     A few sub-blocks like noc-shell and sine_tone are used within the bigger noc_blocks. They have their own test benches. Their test benches reside in `<fpga-dir>/usrp3/lib/sim/rfnoc/&zwj;*`.

  3. Radio test bench:
     The radio test bench resides in `<fpga-dir>/usrp3/lib/radio/noc_block_radio_core_tb/`.

  4. Device specific test benches:
     IPs specific to a device have test benches that exist in `<fpga-dir>/usrp3/top/x300/sim/*`. e.g. DMA testbench, PCIe, etc.

2. Setup the environment by running `source <fpga-dir>/usrp3/top/<device>/setupenv.sh`.

3. In the test bench directory and run the test bench by 'make xsim' or 'make vsim'.

4. All of these tests must report no failure with a 'PASS' validation. Example testbench output:

\code
========================================================
TESTBENCH STARTED: noc_block_skeleton
========================================================
[TEST CASE   1] (t=000000000) BEGIN: Wait for Reset...
[TEST CASE   1] (t=000001002) DONE... Passed
[TEST CASE   2] (t=000001002) BEGIN: Check NoC ID...
Read Skeleton NOC ID: 1234000000000000
[TEST CASE   2] (t=000001238) DONE... Passed
[TEST CASE   3] (t=000001238) BEGIN: Connect RFNoC blocks...
Connecting noc_block_tb (SID: 1:0) to noc_block_skeleton (SID: 0:0)
Connecting noc_block_skeleton (SID: 0:0) to noc_block_tb (SID: 1:0)
[TEST CASE   3] (t=000005457) DONE... Passed
[TEST CASE   4] (t=000005457) BEGIN: Write / readback user registers...
[TEST CASE   4] (t=000006888) DONE... Passed
[TEST CASE   5] (t=000006888) BEGIN: Test sequence...
[TEST CASE   5] (t=000007403) DONE... Passed
========================================================
TESTBENCH FINISHED: noc_block_skeleton
 - Time elapsed:   7500 ns
 - Tests Expected: 5
 - Tests Run:      5
 - Tests Passed:   5
Result: PASSED
========================================================
\endcode

Failing tests can be debugged by checking the waveform in a Vivado GUI by
running 'make GUI=1 xsim'. More details on
debugging: https://kb.ettus.com/Debugging_FPGA_images

\subsection rdtesting_fpga_testbenches_auto Automatic Test Procedure

 Go to <fpga-dir>/usrp3/ and run 'build.py xsim all'. All tests should report 'PASS'.

\section rdtesting_fpgadspverif FPGA DSP Verification

| Test Code                | Device        | Peripherals | Manual Test Procedure              | Automatic Test Procedure         |
|--------------------------|---------------|-------------|------------------------------------|----------------------------------|
| FPGADSPVERIF-X310-HG-v1  | USRP X310     | 2x UBX      | \ref rdtesting_fpgadspverif_manual | \ref rdtesting_fpgadspverif_auto |
| FPGADSPVERIF-X310-XG-v1  | USRP X310     | 2x UBX      | \ref rdtesting_fpgadspverif_manual | \ref rdtesting_fpgadspverif_auto |
| FPGADSPVERIF-X300-HG-v1  | USRP X300     | 2x UBX      | \ref rdtesting_fpgadspverif_manual | \ref rdtesting_fpgadspverif_auto |
| FPGADSPVERIF-X300-XG-v1  | USRP X300     | 2x UBX      | \ref rdtesting_fpgadspverif_manual | \ref rdtesting_fpgadspverif_auto |
| FPGADSPVERIF-E310-SG1-v1 | USRP E310 SG1 | None        | \ref rdtesting_fpgadspverif_manual | \ref rdtesting_fpgadspverif_auto |
| FPGADSPVERIF-E310-SG3-v1 | USRP E310 SG3 | None        | \ref rdtesting_fpgadspverif_manual | \ref rdtesting_fpgadspverif_auto |
| FPGADSPVERIF-E320-v1     | USRP E320     | None        | \ref rdtesting_fpgadspverif_manual | \ref rdtesting_fpgadspverif_auto |

\subsection rdtesting_fpgadspverif_requirements Requirements

- Signal generator and spectrum analyzer
- X300 & X310 with 2x UBX daughterboard
- E310 SG1 & SG3 with SSH access
- E320 with SSH access

\subsection rdtesting_fpgadspverif_manual FPGA DSP Verification: Manual Test Procedure

This procedure tests the DDC and DUC signal quality and the block's capability
to change sample rate while streaming.

#### RX testing

1. Run calibration on device, if applicable
2. Using a signal generator, inject a sine tone into RX channel 0 at 915.5 MHz @
   -40 dBm
3. Inspect the received spectrum using `uhd_fft`
  - X3x0: `uhd_fft -f 915e6 -s 10e6 -g 10`
  - E31x: `uhd_fft -f 915e6 -s 2e6 -g 50`
  - E320: `uhd_fft -f 915e6 -s 15.36e6 -g 50`
  - Embedded devices will require either using network mode or using X
    forwarding over ssh to run the app natively
4. In the GUI, inspect the spectrum. There should be a strong tone at the test
   tone frequency. There may be a small tone at the carrier frequency due to DC
   offset and a quadrature image due to IQ imbalance.
5. Check the input tone frequencies outlined below. The tone should shift from
   left to right as the frequency changes and may have some amplitude variation,
   especially at the band edges.
  - X3x0: 910 MHz to 920 MHz in 1 MHz steps
  - E3xx: 914 MHz to 916 MHz in 200 kHz steps
6. Set input tone back to 915.5 MHz. Check the sampling rate as outlined below.
   The spectrum should reflect the change in sample rate.
  - X3x0: 1, 5, 20, 33.333, 50, 66.666, 100, 200 MHz
  - E3x0: 0.1, 0.5, 1, 1.143, 1.684 MHz
7. Repeat on each RX channel of the device.
8. This test fails if:
  - DC offset and IQ imbalance tones are unusually large
  - There are any other strong tones or spectrum distortion
  - The spectrum changes significantly between frequencies or sample rates
    - An initial transient distortion is acceptable
    - Amplitude variation on the order of +/-10 dB is acceptable
  - Console reports any of the following:
    - Overruns 'O' if continuous and not due to host computer's lack of
      processing performance
    - Dropped packets 'D'
    - Sequence number errors 'S'
    - Timeouts

#### TX testing

1. Run calibration on device, if applicable
2. Using `uhd_siggen_gui`, generate a sine tone TX channel 0 at 915.5 MHz:
  - X3x0: `uhd_siggen_gui -f 915e6 -s 10e6 -g 10 -x 500e3 --sine`
  - E31x: `uhd_siggen_gui -f 915e6 -s 2e6 -g 50 -x 500e3 --sine`
  - E320: `uhd_siggen_gui -f 915e6 -s 15.36e6 -g 50 -x 500e3 --sine`
3. Using a spectrum analyzer, inspect the output spectrum. There should be a
   strong tone at the test tone frequency. There may be a small tone at the
   carrier frequency due to DC offset and a quadrature image due to IQ
   imbalance.
4. Using the GUI, test the follow offset frequencies. The tone should shift from
   left to right as the frequency changes and may have some amplitude variation,
   especially at the band edges.
  - X3x0: -5 to +5 MHz in 1 MHz steps
  - E3xx: -1 to +1 MHz in 200 kHz steps
5. Set output tone offset back to 500e3. Change sampling rate as outlined below.
   The spectrum should not significantly differ between sample rates.
  - X3x0: 1, 5, 20, 33.333, 50, 66.666, 100, 200 MHz
  - E3xx: 0.1, 0.5, 1, 1.143, 1.684 MHz
6. Repeat on each TX channel of the device
7. This test fails if:
  - DC offset and IQ imbalance tones are unusually large
  - There are any other strong tones or spectrum distortion
  - The spectrum changes significantly between sample rates
    - An initial transient distortion is acceptable
  - Console reports any of the following:
    - Underruns 'U' if continuous and not due to host computer's lack of
      processing performance
    - Late packets 'L'
    - Sequence number errors 'S'

\subsection rdtesting_fpgadspverif_auto FPGA DSP Verification: Automatic Test Procedure

tbd

\section rdtesting_fpgafuncverif FPGA Functional Verification

| Test Code                 | Device        | Peripherals | Manual Test Procedure               | Automatic Test Procedure          |
|---------------------------|---------------|-------------|-------------------------------------|-----------------------------------|
| FPGAFUNCVERIF-X310-HG-v1  | USRP X310     | 2x UBX      | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-X310-XG-v1  | USRP X300     | 2x UBX      | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-X300-HG-v1  | USRP X310     | 2x UBX      | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-X300-XG-v1  | USRP X300     | 2x UBX      | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-E310-SG1-v1 | USRP E310 SG1 | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-E310-SG3-v1 | USRP E310 SG3 | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-N320-HG-v1  | USRP N320     | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-N320-XG-v1  | USRP N320     | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-N310-HG-v1  | USRP N310     | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-N310-XG-v1  | USRP N310     | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-N300-HG-v1  | USRP N300     | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-N300-XG-v1  | USRP N300     | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |
| FPGAFUNCVERIF-E320-XG-v1  | USRP E320     | None        | \ref rdtesting_fpgafuncverif_manual | \ref rdtesting_fpgafuncverif_auto |

The FPGA functional verification tests exercise the Digital Downconverter (DDC),
Digital Upconverter (DUC), and Radio Core RFNoC blocks.

\subsection rdtesting_fpgafuncverif_requirements Requirements

- X300 & X310 with two daughterboards
  - 2x UBX recommended
  - HG tests require a single 10 GigE connection, XG requires two for the 2x RX
    200 MSPS test
  - 1 GigE and PCIe adapters and cabling for optional tests
- E310: SG1 & SG3 with SSH access
- N310: No special requirements
- E320: SFP connection to run network mode

\subsection rdtesting_fpgafuncverif_manual FPGA Functional Verification: Manual Test Procedure

This procedure verifies that the DDC, DUC, and Radio Core can run at various sample
rates and channel configurations without any data flow issues.

1. Run `benchmark_rate` using the parameters outlined in the tables below
2. Unless otherwise noted, to pass each test:
  - Benchmark rate must run without reporting any of the following:
    - Underruns 'U'
    - Overruns 'O'
    - Dropped packets 'D'
    - Sequence number errors 'S'
    - Late commands 'L'
    - Timeouts
  - Appropriate TX/RX LEDs must be illuminated
3. Unless specified in 'Notes' column, use default values for unlisted
   parameters
4. Example commands:
  - X3x0: `benchmark_rate --tx_rate 1e6 --rx_rate 1e6 --channels 0,1 --duration 120`
  - E3xx: `benchmark_rate --args="master_clock_rate=10e6" --tx_rate 1e6 --rx_rate 1e6 --channels 0,1 --duration 120`

#### USRP X3x0: 10 GigE Interface

- Required images to test: X310 HG
- Optional images to test: X310 XG, X300 HG, X300 XG
- Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test

| Channels      | Sample Rates             | Duration | Notes              |
|---------------|--------------------------|----------|--------------------|
| 1x RX         | 10e6, 50e6, 100e6, 200e6 | 60       | Test both channels |
| 2x RX         | 10e6, 50e6, 100e6        | 60       |                    |
| 2x RX         | 200e6                    | 60       | 2x 10G, XG only    |
| 1x TX         | 10e6, 50e6, 100e6, 200e6 | 60       | Test both channels |
| 2x TX         | 10e6, 50e6, 100e6        | 60       |                    |
| 1x RX & 1x TX | 10e6, 50e6, 100e6        | 60       | Test both channels |
| 1x RX & 1x TX | 200e6                    | 60       | Use channel 0      |
| 2x RX & 2x TX | 10e6, 50e6               | 60       |                    |
| 1x RX & 1x TX | 200e6                    | 600      | Use channel 1      |
| 2x RX & 2x TX | 100e6                    | 600      |                    |

#### USRP X3x0: 1 GigE Interface

- Required images to test: None
- Optional images to test: X310 HG, X310 XG, X300 HG, X300 XG
- Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test

| Channels      | Sample Rates            | Duration |
|---------------|-------------------------|----------|
| 1x RX         | 1e6, 10e6, 25e6         | 60       |
| 2x RX         | 1e6, 10e6               | 60       |
| 1x TX         | 1e6, 10e6, 25e6         | 60       |
| 2x TX         | 1e6, 10e6               | 60       |
| 1x RX & 1x TX | 1e6, 10e6, 25e6         | 60       |
| 2x RX & 2x TX | 1e6, 10e6               | 60       |

#### USRP X3x0: PCIe Interface

- Required images to test: None
- Optional images to test: X310 HG, X310 XG, X300 HG, X300 XG
- Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test

| Channels      | Sample Rates             | Duration |
|---------------|--------------------------|----------|
| 1x RX         | 10e6, 50e6, 100e6, 200e6 | 60       |
| 2x RX         | 10e6, 50e6, 100e6        | 60       |
| 1x TX         | 10e6, 50e6, 100e6, 200e6 | 60       |
| 2x TX         | 10e6, 50e6, 100e6        | 60       |
| 1x RX & 1x TX | 10e6, 50e6, 100e6        | 60       |
| 1x RX & 1x TX | 200e6                    | 60       |
| 2x RX & 2x TX | 10e6, 50e6               | 60       |

Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test

#### USRP E31x (SG3 Required, SG1 Optional)

| Channels      | Master Clock Rate       | Sample Rate | Duration | Notes              |
|---------------|-------------------------|-------------|----------|--------------------|
| 1x RX         | 10e6                    | 1e6         | 60       | Test both channels |
| 1x RX         | 61.44e6                 | 3.84e6      | 60       | Test both channels |
| 1x TX         | 10e6                    | 1e6         | 60       | Test both channels |
| 1x TX         | 61.44e6                 | 3.84e6      | 60       | Test both channels |
| 2x RX         | 10e6                    | 1e6         | 60       |                    |
| 2x RX         | 30.72e6                 | 1.92e6      | 60       |                    |
| 2x TX         | 10e6                    | 1e6         | 60       |                    |
| 2x TX         | 30.72e6                 | 1.92e6      | 60       |                    |
| 1x RX & 1x TX | 10e6                    | 1e6         | 60       | Test both channels |
| 1x RX & 1x TX | 61.44e6                 | 3.84e6      | 60       | Use channel 1      |
| 2x RX & 2x TX | 10e6                    | 1e6         | 60       |                    |
| 2x RX & 2x TX | 30.72e6                 | 1.92e6      | 60       |                    |
| 1x RX & 1x TX | 61.44e6                 | 3.84e6      | 600      | Use channel 0      |
| 2x RX & 2x TX | 30.72e6                 | 1.92e6      | 600      |                    |

#### USRP E320: 1 GigE Interface

| Channels      | Master Clock Rate       | Sample Rate | Duration | Notes              |
|---------------|-------------------------|-------------|----------|--------------------|
| 1x RX         | 10e6                    | 1e6         | 60       | Test both channels |
| 1x RX         | 61.44e6                 | 1.024e6     | 60       | Test both channels |
| 1x TX         | 10e6                    | 1e6         | 60       | Test both channels |
| 1x TX         | 61.44e6                 | 1.024e6     | 60       | Test both channels |
| 2x RX         | 10e6                    | 1e6         | 60       |                    |
| 2x RX         | 30.72e6                 | 1.024e6     | 60       |                    |
| 2x TX         | 10e6                    | 1e6         | 60       |                    |
| 2x TX         | 30.72e6                 | 1.024e6     | 60       |                    |
| 1x RX & 1x TX | 10e6                    | 1e6         | 60       | Test both channels |
| 1x RX & 1x TX | 61.44e6                 | 1.024e6     | 60       | Use channel 1      |
| 2x RX & 2x TX | 10e6                    | 1e6         | 60       |                    |
| 2x RX & 2x TX | 30.72e6                 | 1.024e6     | 60       |                    |
| 1x RX & 1x TX | 61.44e6                 | 1.024e6     | 600      | Use channel 0      |
| 2x RX & 2x TX | 30.72e6                 | 1.024e6     | 600      |                    |

#### USRP E320: 10 GigE Interface

| Channels      | Master Clock Rate       | Sample Rate          | Duration | Notes              |
|---------------|-------------------------|----------------------|----------|--------------------|
| 1x RX         | 61.44e6                 | 1.024e6, 61.44e6     | 60       | Test both channels |
| 1x TX         | 61.44e6                 | 1.024e6, 61.44e6     | 60       | Test both channels |
| 2x RX         | 30.72e6                 | 1.024e6, 30.72e6     | 60       |                    |
| 2x TX         | 30.72e6                 | 1.024e6, 30.72e6     | 60       |                    |
| 1x RX & 1x TX | 61.44e6                 | 1.024e6, 30.72e6     | 60       | Test both channels |
| 2x RX & 2x TX | 30.72e6                 | 1.024e6, 30.72e6     | 60       |                    |
| 1x RX & 1x TX | 61.44e6                 | 1e6, 30.72e6         | 600      | Use channel 0      |
| 2x RX & 2x TX | 30.72e6                 | 1e6, 30.72e6         | 600      |                    |

#### USRP N300/N310: 1 GigE Interface

- Required images to test: HG
- Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test

<!--Note: If you change this table, also change tools/gr-usrptest/apps/usrp_fpga_funcverif.py!-->
| Channels      | Master Clock Rate | Sample Rates            | Duration | Notes                             |
|---------------|-------------------|-------------------------|----------|-----------------------------------|
| 1x RX         | 125e6             | 1.25e6                  | 60       | One test each for all 4 channels  |
| 1x RX         | 122.88e6          | 1.2288e6                | 60       | One test each for all 4 channels  |
| 1x RX         | 153.6e6           | 1.536e6                 | 60       | One test each for all 4 channels  |
| 1x TX         | 125e6             | 1.25e6                  | 60       | One test each for all 4 channels  |
| 1x TX         | 122.88e6          | 1.2288e6                | 60       | One test each for all 4 channels  |
| 1x TX         | 153.6e6           | 1.536e6                 | 60       | One test each for all 4 channels  |
| 2/3/4x RX     | 125e6             | 1.25e6                  | 60       | 3 tests total                     |
| 2/3/4x RX     | 122.88e6          | 1.2288e6                | 60       | 3 tests total                     |
| 2/3/4x RX     | 153.6e6           | 1.536e6                 | 60       | 3 tests total                     |
| 2/3/4x TX     | 125e6             | 1.25e6                  | 60       | 3 tests total                     |
| 2/3/4x TX     | 122.88e6          | 1.2288e6                | 60       | 3 tests total                     |
| 2/3/4x TX     | 153.6e6           | 1.536e6                 | 60       | 3 tests total                     |
| 4x RX & 4x TX | 125e6             | 1.25e6                  | 60       | Drop to 2 channels for N300
| 4x RX & 4x TX | 122.88e6          | 1.2288e6                | 60       | Drop to 2 channels for N300
| 4x RX & 4x TX | 153e6             | 1.536e6                 | 60       | Drop to 2 channels for N300

#### USRP N300/N310: 10 GigE Interface

- Required images to test: N310 HG + XG
- Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test

<!--Note: If you change this table, also change tools/gr-usrptest/apps/usrp_fpga_funcverif.py!-->
| Channels      | Master Clock Rate | Sample Rates            | Duration | Notes                             |
|---------------|-------------------|-------------------------|----------|-----------------------------------|
| 1x RX         | 125e6             | 1.25e6, 125e6           | 60       | One test each for all 4 channels  |
| 1x RX         | 122.88e6          | 1.2288e6, 122.88e6      | 60       | One test each for all 4 channels  |
| 1x RX         | 153.6e6           | 1.536e6, 153.6e6        | 60       | One test each for all 4 channels  |
| 1x TX         | 125e6             | 1.25e6, 125e6           | 60       | One test each for all 4 channels  |
| 1x TX         | 122.88e6          | 1.2288e6, 122.88e6      | 60       | One test each for all 4 channels  |
| 1x TX         | 153.6e6           | 1.536e6, 153.6e6        | 60       | One test each for all 4 channels  |
| 2x RX         | 125e6             | 1.25e6, 125e6           | 60       |                                   |
| 2x RX         | 122.88e6          | 1.2288e6, 122.88e6      | 60       |                                   |
| 2x RX         | 153.6e6           | 1.536e6                 | 60       |                                   |
| 3x RX         | 125e6             | 1.25e6                  | 60       | N310 only                         |
| 3x RX         | 122.88e6          | 1.2288e6                | 60       | N310 only                         |
| 3x RX         | 153.6e6           | 1.536e6                 | 60       | N310 only                         |
| 2x TX         | 125e6             | 1.25e6, 12.5e6          | 60       |                                   |
| 2x TX         | 122.88e6          | 1.2288e6, 12.288e6      | 60       |                                   |
| 2x TX         | 153.6e6           | 1.536e6, 15.36e6        | 60       |                                   |
| 3x TX         | 125e6             | 1.25e6                  | 60       | N310 only                         |
| 3x TX         | 122.88e6          | 1.2288e6                | 60       | N310 only                         |
| 3x TX         | 153.6e6           | 1.536e6                 | 60       | N310 only                         |
| 4x RX         | 125e6             | 1.25e6, 62.5e6          | 60       | N310 only
| 4x TX         | 125e6             | 1.25e6, 12.5e6          | 60       | N310 only
| 4x RX & 4x TX | 125e6             | 1.25e6, 62.5e6          | 60       | Drop to 2 channels for N300
| 4x RX & 4x TX | 122.88e6          | 1.2288e6, 61.44e6       | 60       | Drop to 2 channels for N300
| 4x RX & 4x TX | 153e6             | 1.536e6, 76.8e6         | 60       | Drop to 2 channels for N300
| 4x RX & 4x TX | 125e6             | 62.5e6                  | 600      | Drop to 2 channels for N300
| 4x RX & 4x TX | 122.88e6          | 61.44e6                 | 600      | Drop to 2 channels for N300
| 4x RX & 4x TX | 153e6             | 76.8e6                  | 600      | Drop to 2 channels for N300
| 4x RX & 4x TX | 125e6             | 125e6 RX, 62.5e6 TX     | 60       | Use dual 10GigE, N310 XG only
| 4x RX & 4x TX | 122.88e6          | 122.88e6 RX, 61.44e6 TX | 60       | Use dual 10GigE, N310 XG only
| 4x RX & 4x TX | 153e6             | 153e6 RX, 76.8e6 TX     | 60       | Use dual 10GigE, N310 XG only
| 2x RX & 2x TX | 125e6             | 125e6 RX, 62.5e6 TX     | 60       | Use dual 10GigE, N300 XG only
| 2x RX & 2x TX | 122.88e6          | 122.88e6 RX, 61.44e6 TX | 60       | Use dual 10GigE, N300 XG only
| 2x RX & 2x TX | 153e6             | 153e6 RX, 76.8e6 TX     | 60       | Use dual 10GigE, N300 XG only

#### USRP N320/N321: 1 GigE Interface

- Required images to test: HG
- Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test
- Note: The following tests need to be completed only on either N320 OR N321

<!--Note: If you change this table, also change tools/gr-usrptest/apps/usrp_fpga_funcverif.py!-->
| Channels      | Master Clock Rate | Sample Rates            | Duration | Notes                             |
|---------------|-------------------|-------------------------|----------|-----------------------------------|
| 1x RX         | 250e6             | 2.5e6                   | 60       | One test each for both channels   |
| 1x RX         | 245.76e6          | 2.4576e6                | 60       | One test each for both channels   |
| 1x RX         | 200e6             | 2e6                     | 60       | One test each for both channels   |
| 1x TX         | 250e6             | 2.5e6                   | 60       | One test each for both channels   |
| 1x TX         | 245.76e6          | 2.4576e6                | 60       | One test each for both channels   |
| 1x TX         | 200e6             | 2e6                     | 60       | One test each for both channels   |
| 2x RX         | 250e6             | 2.5e6                   | 60       |                                   |
| 2x RX         | 245.76e6          | 2.4576e6                | 60       |                                   |
| 2x RX         | 200e6             | 2e6                     | 60       |                                   |
| 2x TX         | 250e6             | 2.5e6                   | 60       |                                   |
| 2x TX         | 245.76e6          | 2.4576e6                | 60       |                                   |
| 2x TX         | 200e6             | 2e6                     | 60       |                                   |
| 2x RX & 2x TX | 250e6             | 2.5e6                   | 60       |                                   |
| 2x RX & 2x TX | 245.76e6          | 2.4576e6                | 60       |                                   |
| 2x RX & 2x TX | 200e6             | 2e6                     | 60       |                                   |

#### USRP N320/N321: 10 GigE Interface

- Required images to test: N320 HG + XG
- Note: On TX tests, initial Us within the first 5 seconds can be ignored and do not fail the test
- Note: The following tests need to be completed only on either N320 OR N321

<!--Note: If you change this table, also change tools/gr-usrptest/apps/usrp_fpga_funcverif.py!-->
| Channels      | Master Clock Rate | Sample Rates            | Duration | Notes                             |
|---------------|-------------------|-------------------------|----------|-----------------------------------|
| 1x RX         | 250e6             | 2.5e6 , 125e6           | 60       | One test each for both channels   |
| 1x RX         | 245.76e6          | 2.4576e6, 122.88e6      | 60       | One test each for both channels   |
| 1x RX         | 200e6             | 2e6 , 200e6             | 60       | One test each for both channels   |
| 1x TX         | 250e6             | 2.5e6 , 125e6           | 60       | One test each for both channels   |
| 1x TX         | 245.76e6          | 2.4576e6 , 122.88e6     | 60       | One test each for both channels   |
| 1x TX         | 200e6             | 2e6 , 100e6             | 60       | One test each for both channels   |
| 2x RX         | 250e6             | 2.5e6 , 125e6           | 60       |                                   |
| 2x RX         | 245.76e6          | 2.4576e6, 122.88e6      | 60       |                                   |
| 2x RX         | 200e6             | 2e6 , 100e6             | 60       |                                   |
| 2x TX         | 250e6             | 62.5e6                  | 60       |                                   |
| 2x TX         | 245.76e6          | 61.44e6                 | 60       |                                   |
| 2x TX         | 200e6             | 100e6                   | 60       |                                   |
| 2x RX & 2x TX | 250e6             | 2.5e6                   | 60       |                                   |
| 2x RX & 2x TX | 245.76e6          | 2.4576e6                | 60       |                                   |
| 2x RX & 2x TX | 200e6             | 2e6                     | 60       |                                   |
| 2x RX & 2x TX | 250e6             | 125e6 RX, 62.5e6 TX     | 600      |                                   |
| 2x RX & 2x TX | 245.76e6          | 122.88e6 RX, 61.44e6 TX | 600      |                                   |
| 2x RX & 2x TX | 200e6             | 100e6 RX, 66.67e6 TX    | 600      |                                   |
| 2x RX & 2x TX | 250e6             | 125e6 RX, 83.33e6 TX    | 600      | Use dual 10GigE, N320/1 XG only   |
| 2x RX & 2x TX | 245.76e6          | 122.88e6 RX, 81.92e6 TX | 600      | Use dual 10GigE, N320/1 XG only   |
| 2x RX & 2x TX | 200e6             | 200e6 RX, 100e6 TX      | 600      | Use dual 10GigE, N320/1 XG only   |
| 2x RX & 2x TX | 250e6             | 250e6                   | 600      | Dual 10GigE, N320/1 XG, DPDK only |
| 2x RX & 2x TX | 245.76e6          | 245.76e6                | 600      | Dual 10GigE, N320/1 XG, DPDK only |
| 2x RX & 2x TX | 200e6             | 200e6                   | 600      | Dual 10GigE, N320/1 XG, DPDK only |

\subsection rdtesting_fpgafuncverif_auto FPGA Functional Verification: Automatic Test Procedure

In all cases, make sure UHD is compiled in 'Release' mode (highest
optimization), and that all NIC and kernel are set to optimal (CPU governor,
ring buffer settings, ...).

### X310/X300
The X310/X300 tests depend on the FPGA image to be tested.

#### HG
-Connect a 1GigE cable into port 0 and a 10GigE cable into port 1.
-The following command must pass:

          $ usrp_fpga_funcverif x3x0hg -a 192.168.40.2 -2 192.168.10.2 -p /path/to/examples

#### XG
-Connect 10GigE cables to both ethernet ports.
-The following command must pass:

          $ usrp_fpga_funcverif x3x0xg -a 192.168.40.2 -2 192.168.30.2 -p /path/to/examples

### N310/N300

The N310/N300 tests depend slightly on the type of FPGA image to be tested.
All calls to usrp_fpga_funcverif.py need to be adapted to ensure the correct
IP addresses and paths to the examples. Also, replace n310 with n300 where
appropriate.

#### HG

- Connect a 1GigE cable on SFP0, and a 10 GigE cable on SFP1.
- The following command must pass:

         $ usrp_fpga_funcverif n310hg -a 192.168.20.2 -2 192.168.10.2 -p /path/to/examples

#### XG

- Connect a 10GigE cable on both SFP0 and SFP1.
- The following command must pass:

         $ usrp_fpga_funcverif n310xg -a 192.168.10.2 -2 192.168.20.2 -p /path/to/examples

#### HA

- Connect a 1GigE cable on SFP0
- The following command must pass:

         $ usrp_fpga_funcverif n310ha -2 192.168.10.2 -p /path/to/examples

#### XA

- Connect a 10GigE cable on SFP0
- The following command must pass:

         $ usrp_fpga_funcverif n310xa -a 192.168.10.2 -p /path/to/examples

#### WX

- Connect a 10GigE cable on SFP1
- The following command must pass:

         $ usrp_fpga_funcverif n310wx -a 192.168.20.2 -p /path/to/examples

### N320/N321

The N320/N321 tests depend slightly on the type of FPGA image to be tested. All
calls to usrp_fpga_funcverif.py need to be adapted to ensure the correct IP
addresses and paths to the examples. Also, the following test need to be run only
on either N320 OR N321.

#### HG

- Connect a 1GigE cable on SFP0, and a 10 GigE cable on SFP1.
- The following command must pass:

         $ usrp_fpga_funcverif n320hg -a 192.168.20.2 -2 192.168.10.2 -p /path/to/examples

#### XG

- Connect a 10GigE cable on both SFP0 and SFP1.
- The following command must pass:

         $ usrp_fpga_funcverif n320xg -a 192.168.10.2 -2 192.168.20.2 -p /path/to/examples

#### XQ

- Connect a QSFP+ cable, carrying 2x10GigE, to the QSFP+ port
- The following command must pass:

         $ usrp_fpga_funcverif n320xq -a 192.168.10.2 -2 192.168.20.2 -p /path/to/examples

#### AQ

- Connect a 10GigE cable on both SFP0 and SFP1.
- The following command must pass:

         $ usrp_fpga_funcverif n320aq -a 192.168.10.2 -2 192.168.20.2 -p /path/to/examples

#### WX

- Connect a 10GigE cable on SFP1.
- The following command must pass:

         $ usrp_fpga_funcverif n320wx -a 192.168.20.2 -p /path/to/examples


### E320
The E320 tests depend on the FPGA image to be tested.

#### 1G
- Connect a 1GigE cable on the SFP port.
- The following command must pass:

         $ usrp_fpga_funcverif e3201g -a 192.168.10.2 -p /path/to/examples

#### XG
- Connect a 10GigE cable on the SFP port.
- The following command must pass:

         $ usrp_fpga_funcverif e320xg -a 192.168.10.2 -p /path/to/examples


\section rdtesting_phasealignment Phase alignment tests

| Test Code           | Device    | Peripherals        | Manual Test Procedure                | Automatic Test Procedure    |
|---------------------|-----------|--------------------|--------------------------------------|-----------------------------|
| PHASE-Twin-RX-v1    | 2xTwinRX  | 1xX3x0 + LOSharing cables | \ref rdtesting_phase_rx_X3x0_twinrx | \ref rdtesting_phase_rx_auto |
| PHASE-UBX-40-RX-v1  | 2xUBX-40  | 2xX3x0  | \ref rdtesting_phase_rx_X3x0_sbx_ubx | \ref rdtesting_phase_rx_auto |
| PHASE-UBX-160-RX-v1  | 2xUBX-160  | 2xX3x0 | \ref rdtesting_phase_rx_X3x0_sbx_ubx | \ref rdtesting_phase_rx_auto |
| PHASE-SBX-40-RX-v1  | 2xSBX-40  | 2xX3x0 | \ref rdtesting_phase_rx_X3x0_sbx_ubx | \ref rdtesting_phase_rx_auto |
| PHASE-SBX-120-RX-v1  | 2xSBX-120  | 2xX3x0 | \ref rdtesting_phase_rx_X3x0_sbx_ubx | \ref rdtesting_phase_rx_auto |
| PHASE-N2x0-MIMO-v1 | 2x N2x0 + MIMO cable | 2x SBX | \ref rdtesting_phase_rx_N2x0_MIMO | \ref rdtesting_phase_rx_auto |


| Device \anchor phase_band_table        | Frequency Range         | Number of bands |
|---------------|-------------------------|-----------------|
| TwinRX        | 10 - 6000 MHz           |      12         |
| UBX-{160, 40} | 10 - 6000 MHz           |      12         |
| SBX-{120, 40} | 400 - 4400 MHz          |      7          |

Phase alignment testing is necessary to verify device synchronization across multiple daughter- and motherboards is working as expected for CBX, SBX and UBX daughterboards. To enable efficient Phase alignment testing a GNU Radio Out-of-Tree module gr-usrptest exists in tools/gr-usrptest. It is required for testing RX testcases and later may be required to perform TX testcases.

To test phase alignment we measure phase offset between DUTs at an offset of 2 MHz offset from the selected center frequency. The phase difference for a given center frequency has to stay the same across retunes and power cycles of the DUT.

Correct synchronization with PPS and 10 MHz references is required for these tests.

\subsection rdtesting_phase_rx_manual Manual phase alignment testing (Receiver)

Equipment Required
- Octoclock-G
- Signal Generator
- 2-way splitter that covers frequency range for daughterboard (4-way for TwinRX)
- 5+ SMA Cables

Software Required
- UHD
- gnuradio
- gr-usrptest

\subsection rdtesting_phase_rx_X3x0_twinrx X3x0 with TwinRX
1.  Make sure correct FPGA image is loaded on X3x0.
2.  Place first daughterboard in slot A and second daughterboard in slot B.
3.  Connect LO sharing cables between boards.
4.  Connect host to device via 1 GbE, 10 GbE, or PCIe.
5.  Connect 10 MHz and PPS from Octoclock-G to X3x0.
6.  Connect Signal Generator to input of 4-way splitter and outputs of the splitter to the 2 RX ports on each daughterboard.
7.  Set Signal Generator output power at -30 dBm.
8.  From the top of the UHD source, run the command:

  -  `./tools/gr-usrptest/apps/usrp_phasealignment.py --spec "A:0 A:1 B:0 B:1" --channels 0,1,2,3 --sync pps --time-source external --clock-source external -s 5e6 -g 75 -f 10e6 --freq-bands 12 --start-freq 10e6 --stop-freq 6e9 --duration 2.0 --auto --lo-export True,False,False,False --lo-source internal,companion,external,external`

9.  At each frequency step, tune Signal Generator to the displayed frequency + 1 MHz and increase output power by 3 dB.
10.  Analyze terminal output.  The "run avg" across all runs should not deviate more than 1 degree and the "stddev" for any run should not deviate more than 1 degree.

\subsection rdtesting_phase_rx_X3x0_sbx_ubx X3x0 with SBX or UBX
1.  Set different IP addresses on each X3x0 and make sure correct FPGA image is loaded on each.
2.  Place first daughterboard in slot A of first X3x0 and second daughterboard in slot A of second X3x0.
3.  Connect host to both X3x0s.
4.  Connect 10 MHz and PPS from Octoclock-G to both X3x0s.
5.  Connect Signal Generator to input of splitter and outputs of the splitter to the RX2 port on each daughterboard.
6.  Set Signal Generator output power at -35 dBm for UBX and -29 dBm for SBX.
7.  From the top of the UHD source, run the command:

  -  `./tools/gr-usrptest/apps/usrp_phasealignment.py --args "addr0=<first X3x0 IP addr>,addr1=<second X3x0 IP addr>,dboard_clock_rate=20e6" --clock-source external --time-source external --sync pps --spec "A:0" --channels 0,1 -s 10e6 -g \<33 if UBX 37.5 if SBX\> -f \<lowest DB freq\> --freq-bands \<# frequency bands\> --start-freq \<lowest freq\> --stop-freq \<highest freq\> --duration 2.0 --auto`

8.  At each frequency step, tune Signal Generator to the displayed frequency + 1 MHz and increase output power by 1dB.
9.  Analyze terminal output.  The "run avg" across all runs should not deviate more than 2 degrees and the "stddev" for any run should not deviate more than 2 degrees.

\subsection rdtesting_phase_rx_N2x0_MIMO N2x0 MIMO with SBX
1.  Set different IP addresses on each N2x0 and make sure correct FPGA image and firmware are loaded.
2.  Connect MIMO cable between devices.
3.  Connect host to master device via 1 GbE.
4.  Connect 10 MHz and PPS from Octoclock-G to master device only.
5.  Connect Signal Generator to input of splitter and outputs of the splitter to the RX2 port on each daughterboard.
6.  Set Signal Generator output power at -36 dBm.
7.  From the top of the UHD source, run the command:

  -  `./tools/gr-usrptest/apps/usrp_phasealignment.py --args "addr0=<IP address of master>,addr1=<IP address of slave>" --clock-source external,mimo --time-source external,mimo --sync default --channels 0,1 -s 10e6 -f 400e6 -g 31.5 --freq-bands 7 --start-freq 400e6 --stop-freq 4400e6 --duration 2.0 --auto`

8.  At each frequency step, tune Signal Generator to the displayed frequency + 1 MHz and increase output power by 2 dB.
9.  Analyze terminal output.  The "run avg" across all runs should not deviate more than 2 degrees and the "stddev" for any run should not deviate more than 5 degrees.

\subsection rdtesting_phase_rx_auto Automatic phase alignment testing (Receiver)

tbd

\section rdtesting_bist BISTs

| Test Code           | Device    | Peripherals                                           | Manual Test Procedure           | Automatic Test Procedure      |
|---------------------|-----------|-------------------------------------------------------|---------------------------------|-------------------------------|
| BIST-N310-v1        | 1xN310    | DB-15 GPIO Loopback                                   | \ref rdtesting_bist_n3x0_manual | \ref rdtesting_bist_n3x0_auto |
| BIST-N300-v1        | 1xN300    | DB-15 GPIO Loopback                                   | \ref rdtesting_bist_n3x0_manual | \ref rdtesting_bist_n3x0_auto |
| BIST-E320-v1        | 1xE320    | Type C HDMI Cable + Breakout board with GPIO Loopback | \ref rdtesting_bist_e320_manual | \ref rdtesting_bist_e320_auto |

Some of our devices have built-in self-tests (BISTs).

\subsection rdtesting_bist_n3x0_manual N300/N310 Manual Procedure

Note: The N300 and N310 have identical BISTs.

1. Connect the front-panel GPIO loopback to the front panel
   (see \ref rdtesting_n3xx_peripherals_gpiolb)
2. Execute the following commands:

        $ n3xx_bist standard # Note: This will run multiple tests
        $ n3xx_bist gpio

3. Load the AA image from a host computer. Adapt the following command to your
   system:

        $ uhd_image_loader --args type=n3xx,addr=ni-n3xx-$SERIAL --fpga-path=/path/to/usrp_n310_fpga_AA.bit

4. The final BIST is the SFP test, and there are three valid ways of executing
   them. For the purpose of running the test, only one of these needs to be
   run, and can be chosen based on the available peripherals.
  a. Connect an SFP loopback module to both SFP0 and SFP1. Run the command
     `n3xx_bist sfp0_loopback sfp1_loopback`.
  b. If only one SFP loopback module is available, connect the loopback module
     to SFP0 and run `n3xx_bist sfp0_loopback`. Then, connect the loopback
     module to SFP1 and run the command `n3xx_bist sfp1_loopback`.
  c. If no SFP loopback module is available, connect an SFP cable to both SFP0
     and SFP1, and run the command `n3xx_bist sfp_loopback`. Note while this
     option is a legitimate substitute to the previous two options, it is of
     limited use when trying to debug actual SFP issues.

Every test will produce a JSON-serialized dictionary. All tests have passed if
the "status" key is "true", or the return code for `n3xx_bist` is 0.

Note: Keep in mind that after the test, an Aurora image is loaded. If this is
not desired, re-run `uhd_image_loader` to load whatever image is requested.

\subsection rdtesting_bist_n3x0_auto N300/N310 Automatic Procedure

Note: The N300 and N310 have identical BISTs.

Assuming the peripherals described in \ref rdtesting_bist_n3x0_manual are all
plugged in, the test can trivially be executed automatically by running

        $ n3xx_bist standard
        $ n3xx_bist gpio
	$ n3xx_bist sfp_loopback # Or sfp0_loopback and sfp1_loopback

and making sure that all return values are 0.

\section rdtesting_n3xx_peripherals Required Peripherals

\section rdtesting_n3xx_peripherals_gpiolb DB15 GPIO Loopback

This is a cable or breakout board which connects to the DB15 connector and loops
back the following pins:

- 0<->6
- 1<->7
- 2<->8
- 3<->9
- 4<->10
- 5<->11

\subsection rdtesting_bist_e320_manual E320 Manual Procedure

1. Connect the front-panel GPIO loopback to the front panel
   (see \ref rdtesting_e320_peripherals_gpiolb)
2. Execute the following commands:

        $ e320_bist standard # Note: This will run multiple tests
        $ e320_bist gpio

3. The final BIST is the SFP test. Connect an SFP loopback module
   to the SFP port. Run the command:

        $ e320_bist sfp_loopback

Every test will produce a JSON-serialized dictionary. All tests have passed if
the "status" key is "true", or the return code for `e320_bist` is 0.

\subsection rdtesting_bist_e320_auto E320 Automatic Procedure

Assuming the peripherals described in \ref rdtesting_bist_e320_manual are all
plugged in, the test can trivially be executed automatically by running

        $ e320_bist standard
        $ e320_bist gpio
        $ e320_bist sfp_loopback

and making sure that all return values are 0.

\section rdtesting_e320_peripherals Required Peripherals

\section rdtesting_e320_peripherals_gpiolb  GPIO Loopback

1. Type C to Type A HDMI Cable
2. Breakout Board which connects to the connector and loops
back the following pins:

- 0<->4
- 1<->5
- 2<->6
- 3<->7

\section rdtesting_defining Defining R&D Tests

Tests can be added any time to define procedures for pass/fail validation. Any
test must include the following:

- An unambiguous test code. This code consists of three characters that
  identify the test, a short description of the devices required, and a version
  suffix. Example: `GPS-X310-OCXO-v1` is a GPS-related test, requires an X310
  and an OCXO to run, and is version 1 of this test.
- A manual testing procedure. This must unambiguously define a set of tasks,
  and clearly identify whether or not a test has failed or passed. Tests do not
  require any other defined outcome other than 'pass' and 'fail'.
- Optional, but highly recommended: An automatic test procedure. This must
  consist of a command, or a script, or a set of commands that can be
  automatically executed, and that will report a failure condition by means of
  returning a non-zero return value.

Basic understanding of the operation of USRPs by the test operator should be
assumed when authoring test procedures. The descriptions should be as short as
possible to fully describe, unambiguously, how to reach a pass/fail conclusion.

Test procedures may be updated at any time. If this happens, a new test code
must be generated, with the version number increased. Old test codes are
considered deprecated (if there exists a version 2 of a test, version 1 should
not be run any more).

*/
// vim:ft=doxygen: