aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerickshepherdNI <erickshepherd@ni.com>2019-09-24 14:56:47 -0500
committerMartin Braun <martin.braun@ettus.com>2019-10-10 16:54:39 -0700
commit549d8d010173b4abfc4e4911a5e7fd5e9e1ef601 (patch)
treeb65cac47c8f1068e5cc65b60b2e7e436e312dbaa
parentn320: updated rhodium dboard mcr initialization (diff)
downloaduhd-549d8d010173b4abfc4e4911a5e7fd5e9e1ef601.tar.xz
uhd-549d8d010173b4abfc4e4911a5e7fd5e9e1ef601.zip
Python: Added LO source and export arguments to the phase alignment test
-rwxr-xr-xtools/gr-usrptest/apps/uhd_phase_alignment.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/gr-usrptest/apps/uhd_phase_alignment.py b/tools/gr-usrptest/apps/uhd_phase_alignment.py
index e0b3f5c2e..532aec2ed 100755
--- a/tools/gr-usrptest/apps/uhd_phase_alignment.py
+++ b/tools/gr-usrptest/apps/uhd_phase_alignment.py
@@ -110,6 +110,10 @@ def parse_args():
help="Subdevice(s) of UHD device where appropriate. Use "
"a space-separated list to set different boards to "
"different specs.")
+ parser.add_argument("--lo-export",
+ help="Set LO export {True, False} for each channel with a comma-separated list.")
+ parser.add_argument("--lo-source",
+ help="Set LO source {None, internal, companion, external} for each channel with a comma-separated list. None skips this channel.")
# Signal Source
parser.add_argument("--source-plugin", type=str, default="default",
help="Select source plugin. This can either be one of"
@@ -139,6 +143,17 @@ def parse_args():
return args
+def normalize_lo_source_export_sel(args):
+ """Parses and returns the lo inputs and makes sure there is one argument per channel"""
+ lo_source = [x.strip() for x in args.lo_source.split(",")]
+ lo_export = [x.strip() for x in args.lo_export.split(",")]
+ if len(lo_source) != len(args.channels):
+ raise ValueError("Invalid number of lo-source settings {n} for {c} channels. Must be one argument per channel.".format(n=len(lo_source), c=len(args.channels)))
+ if len(lo_export) != len(args.channels):
+ raise ValueError("Invalid number of lo-export settings {n} for {c} channels. Must be one argument per channel.".format(n=len(lo_source), c=len(args.channels)))
+ return (lo_source, lo_export)
+
+
class LogFormatter(logging.Formatter):
"""Log formatter which prints the timestamp with fractional seconds"""
@staticmethod
@@ -229,6 +244,19 @@ def setup_usrp(args):
return None
# At this point, we can assume our device has valid and locked clock and PPS
+ # Set the LO source and export
+ if (args.lo_export is not None) and (args.lo_source is not None):
+ (args.lo_source, args.lo_export) = normalize_lo_source_export_sel(args)
+ for chan, lo_source, lo_export in zip(args.channels, args.lo_source, args.lo_export):
+ if lo_export == "True":
+ logger.info("LO export enabled on channel %s", chan)
+ usrp.set_rx_lo_export_enabled(True, "all", chan)
+ usrp.set_tx_lo_export_enabled(True, "all", chan)
+ if lo_source != "None":
+ logger.info("Channel %s source set to %s", chan, lo_source)
+ usrp.set_rx_lo_source(lo_source, "all", chan)
+ usrp.set_tx_lo_source(lo_source, "all", chan)
+
# Determine channel settings
# TODO: Add support for >2 channels! (TwinRX)
if len(args.channels) != 2: