mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-14 20:58:09 +00:00
examples: Remove default --ref and --pps values
This changes the behaviour of the examples in a way that leaving
out the --ref argument will not force it to be 'internal'. Previously,
the following command:
rx_samples_to_file --args type=xxx,clock_source=external
would still use the internal reference, because the default value for
--ref was internal, and no other value for --ref was provided. Even
worse, the following command:
rx_samples_to_file --args \
type=xxx,clock_source=external,time_source=external
might throw errors/warnings, because internal clock source plus external
time source is generally not supported, and the example would force the
clock source to be internal unless `--ref internal` was also provided.
For all cases that `clock_source` or `time_source` were not given as
a device argument, this is a no-op because `internal` is the default
value anyway.
In two examples, this includes minor code changes:
- In rfnoc_radio_loopback, if both --ref and --pps were given, we now
use set_sync_source() to speed up setting the reference sources. On
the N310/N300 series in particular, this saves a few seconds at
initialization over the previous implementation (which set clock and
time reference separately).
- In test_dboard_coercion, the code would fail without a default value
for --ref, so we no longer require such a default value.
This commit is contained in:
parent
cf1b65143d
commit
e398d13d67
10 changed files with 22 additions and 16 deletions
|
|
@ -72,8 +72,8 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("rate", po::value<double>(&rate)->default_value(0.0), "Sampling rate")
|
||||
("duration", po::value<double>(&total_time)->default_value(0), "total number of seconds to receive")
|
||||
("int-n", "Tune USRP with integer-N tuning")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "clock reference (internal, external, mimo, gpsdo)")
|
||||
("pps", po::value<std::string>(&pps)->default_value("internal"), "PPS source (internal, external, mimo, gpsdo)")
|
||||
("ref", po::value<std::string>(&ref), "clock reference (internal, external, gpsdo, mimo)")
|
||||
("pps", po::value<std::string>(&pps), "PPS source (internal, external, mimo, gpsdo)")
|
||||
;
|
||||
// clang-format on
|
||||
po::variables_map vm;
|
||||
|
|
@ -127,13 +127,16 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
rx_radio_ctrl->enable_rx_timestamps(rx_timestamps, rx_chan);
|
||||
|
||||
// Set time and clock reference
|
||||
if (vm.count("ref")) {
|
||||
if (vm.count("ref") && vm.count("pps")) {
|
||||
for (size_t i = 0; i < graph->get_num_mboards(); ++i) {
|
||||
graph->get_mb_controller(i)->set_sync_source(ref, pps);
|
||||
}
|
||||
} else if (vm.count("ref")) {
|
||||
// Lock mboard clocks
|
||||
for (size_t i = 0; i < graph->get_num_mboards(); ++i) {
|
||||
graph->get_mb_controller(i)->set_clock_source(ref);
|
||||
}
|
||||
}
|
||||
if (vm.count("pps")) {
|
||||
} else if (vm.count("pps")) {
|
||||
// Lock mboard clocks
|
||||
for (size_t i = 0; i < graph->get_num_mboards(); ++i) {
|
||||
graph->get_mb_controller(i)->set_time_source(pps);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("gain", po::value<double>(&gain), "gain for the RF chain")
|
||||
("ant", po::value<std::string>(&ant), "antenna selection")
|
||||
("bw", po::value<double>(&bw), "analog front-end filter bandwidth in Hz")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "reference source (internal, external, mimo)")
|
||||
("ref", po::value<std::string>(&ref), "clock reference (internal, external, mimo, gpsdo)")
|
||||
;
|
||||
// clang-format on
|
||||
po::variables_map vm;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("frame-rate", po::value<double>(&frame_rate)->default_value(5), "frame rate of the display (fps)")
|
||||
("ref-lvl", po::value<float>(&ref_lvl)->default_value(0), "reference level for the display (dB)")
|
||||
("dyn-rng", po::value<float>(&dyn_rng)->default_value(60), "dynamic range for the display (dB)")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "reference source (internal, external, mimo)")
|
||||
("ref", po::value<std::string>(&ref), "reference source (internal, external, gpsdo, mimo)")
|
||||
("step", po::value<double>(&step)->default_value(1e6), "tuning step for rate/bw/freq")
|
||||
("show-controls", po::value<bool>(&show_controls)->default_value(true), "show the keyboard controls")
|
||||
("int-n", "tune USRP with integer-N tuning")
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("subdev", po::value<std::string>(&subdev), "subdevice specification")
|
||||
("channels,channel", po::value<std::string>(&channels)->default_value("0"), "which channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")
|
||||
("bw", po::value<double>(&bw), "analog frontend filter bandwidth in Hz")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "reference source (internal, external, mimo)")
|
||||
("ref", po::value<std::string>(&ref), "reference source (internal, external, mimo)")
|
||||
("wirefmt", po::value<std::string>(&wirefmt)->default_value("sc16"), "wire format (sc8, sc16 or s16)")
|
||||
("setup", po::value<double>(&setup_time)->default_value(1.0), "seconds of setup time")
|
||||
("progress", "periodically display short-term bandwidth")
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("bw", po::value<double>(&bw), "analog frontend filter bandwidth in Hz")
|
||||
("port", po::value<std::string>(&port)->default_value("7124"), "server udp port")
|
||||
("addr", po::value<std::string>(&addr)->default_value("192.168.1.10"), "resolvable server address")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "reference source (internal, external, mimo)")
|
||||
("ref", po::value<std::string>(&ref), "clock reference (internal, external, mimo, gpsdo)")
|
||||
("int-n", "tune USRP with integer-N tuning")
|
||||
;
|
||||
// clang-format on
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("gain-step", po::value<double>(&gain_step)->default_value(1.0), "Specify the delta between gain scans")
|
||||
("tx", "Specify to test TX frequency and gain coercion")
|
||||
("rx", "Specify to test RX frequency and gain coercion")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "Waveform type: internal, external, or mimo")
|
||||
("ref", po::value<std::string>(&ref), "clock reference (internal, external, mimo, gpsdo)")
|
||||
("no-tx-gain", "Do not test TX gain")
|
||||
("no-rx-gain", "Do not test RX gain")
|
||||
("verbose", "Output every frequency and gain check instead of just final summary")
|
||||
|
|
@ -424,7 +424,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
and (usrp->get_rx_gain_range().stop() > 0);
|
||||
bool verbose = vm.count("verbose") > 0;
|
||||
|
||||
if (ref != "internal" and ref != "external" and ref != "mimo") {
|
||||
if (!ref.empty() and ref != "internal" and ref != "external" and ref != "mimo") {
|
||||
std::cout << desc << std::endl;
|
||||
std::cout << "REF must equal internal, external, or mimo." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
@ -474,7 +474,10 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
}
|
||||
|
||||
// Setting clock source
|
||||
usrp->set_clock_source(ref);
|
||||
if (!ref.empty()) {
|
||||
usrp->set_clock_source(ref);
|
||||
}
|
||||
ref = usrp->get_clock_source(0);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
std::vector<std::string> sensor_names = usrp->get_mboard_sensor_names(0);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("channels", po::value<std::string>(&channel_list)->default_value("0"), "which channel(s) to use (specify \"0\", \"1\", \"0,1\", etc")
|
||||
("int-n", "tune USRP with integer-n tuning")
|
||||
("subdev", po::value<std::string>(&subdev), "subdevice specification")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "reference source (internal, external, mimo)")
|
||||
("ref", po::value<std::string>(&ref), "reference source (internal, external, gpsdo, mimo)")
|
||||
("lo-offset", po::value<double>(&lo_offset)->default_value(0.0),
|
||||
"Offset for frontend LO in Hz (optional)")
|
||||
("bw", po::value<double>(&bw), "analog frontend filter bandwidth in Hz")
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("ant", po::value<std::string>(&ant), "antenna selection")
|
||||
("subdev", po::value<std::string>(&subdev), "subdevice specification")
|
||||
("bw", po::value<double>(&bw), "analog frontend filter bandwidth in Hz")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "reference source (internal, external, mimo)")
|
||||
("ref", po::value<std::string>(&ref), "clock reference (internal, external, mimo, gpsdo)")
|
||||
("wirefmt", po::value<std::string>(&wirefmt)->default_value("sc16"), "wire format (sc8 or sc16)")
|
||||
("delay", po::value<double>(&delay)->default_value(0.0), "specify a delay between repeated transmission of file (in seconds)")
|
||||
("channel", po::value<std::string>(&channel)->default_value("0"), "which channel to use")
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("bw", po::value<double>(&bw), "analog frontend filter bandwidth in Hz")
|
||||
("wave-type", po::value<std::string>(&wave_type)->default_value("CONST"), "waveform type (CONST, SQUARE, RAMP, SINE)")
|
||||
("wave-freq", po::value<double>(&wave_freq)->default_value(0), "waveform frequency in Hz")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "clock reference (internal, external, mimo, gpsdo)")
|
||||
("ref", po::value<std::string>(&ref), "clock reference (internal, external, mimo, gpsdo)")
|
||||
("pps", po::value<std::string>(&pps), "PPS source (internal, external, mimo, gpsdo)")
|
||||
("otw", po::value<std::string>(&otw)->default_value("sc16"), "specify the over-the-wire sample mode")
|
||||
("channels", po::value<std::string>(&channel_list)->default_value("0"), "which channels to use (specify \"0\", \"1\", \"0,1\", etc)")
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
|
|||
("rx-bw", po::value<double>(&rx_bw), "analog receive filter bandwidth in Hz")
|
||||
("wave-type", po::value<std::string>(&wave_type)->default_value("CONST"), "waveform type (CONST, SQUARE, RAMP, SINE)")
|
||||
("wave-freq", po::value<double>(&wave_freq)->default_value(0), "waveform frequency in Hz")
|
||||
("ref", po::value<std::string>(&ref)->default_value("internal"), "clock reference (internal, external, mimo)")
|
||||
("ref", po::value<std::string>(&ref), "reference source (internal, external, gpsdo, mimo)")
|
||||
("otw", po::value<std::string>(&otw)->default_value("sc16"), "specify the over-the-wire sample mode")
|
||||
("tx-channels", po::value<std::string>(&tx_channels)->default_value("0"), "which TX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")
|
||||
("rx-channels", po::value<std::string>(&rx_channels)->default_value("0"), "which RX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")
|
||||
|
|
|
|||
Loading…
Reference in a new issue