diff --git a/host/examples/rfnoc_radio_loopback.cpp b/host/examples/rfnoc_radio_loopback.cpp index 5bc52f893..e6187c09b 100644 --- a/host/examples/rfnoc_radio_loopback.cpp +++ b/host/examples/rfnoc_radio_loopback.cpp @@ -72,8 +72,8 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("rate", po::value(&rate)->default_value(0.0), "Sampling rate") ("duration", po::value(&total_time)->default_value(0), "total number of seconds to receive") ("int-n", "Tune USRP with integer-N tuning") - ("ref", po::value(&ref)->default_value("internal"), "clock reference (internal, external, mimo, gpsdo)") - ("pps", po::value(&pps)->default_value("internal"), "PPS source (internal, external, mimo, gpsdo)") + ("ref", po::value(&ref), "clock reference (internal, external, gpsdo, mimo)") + ("pps", po::value(&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); diff --git a/host/examples/rfnoc_replay_samples_from_file.cpp b/host/examples/rfnoc_replay_samples_from_file.cpp index ed7742688..d7552dcc0 100644 --- a/host/examples/rfnoc_replay_samples_from_file.cpp +++ b/host/examples/rfnoc_replay_samples_from_file.cpp @@ -75,7 +75,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("gain", po::value(&gain), "gain for the RF chain") ("ant", po::value(&ant), "antenna selection") ("bw", po::value(&bw), "analog front-end filter bandwidth in Hz") - ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") + ("ref", po::value(&ref), "clock reference (internal, external, mimo, gpsdo)") ; // clang-format on po::variables_map vm; diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp index 12f9477a8..eddc23270 100644 --- a/host/examples/rx_ascii_art_dft.cpp +++ b/host/examples/rx_ascii_art_dft.cpp @@ -48,7 +48,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("frame-rate", po::value(&frame_rate)->default_value(5), "frame rate of the display (fps)") ("ref-lvl", po::value(&ref_lvl)->default_value(0), "reference level for the display (dB)") ("dyn-rng", po::value(&dyn_rng)->default_value(60), "dynamic range for the display (dB)") - ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") + ("ref", po::value(&ref), "reference source (internal, external, gpsdo, mimo)") ("step", po::value(&step)->default_value(1e6), "tuning step for rate/bw/freq") ("show-controls", po::value(&show_controls)->default_value(true), "show the keyboard controls") ("int-n", "tune USRP with integer-N tuning") diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp index 75a728847..191eec67c 100644 --- a/host/examples/rx_samples_to_file.cpp +++ b/host/examples/rx_samples_to_file.cpp @@ -379,7 +379,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("subdev", po::value(&subdev), "subdevice specification") ("channels,channel", po::value(&channels)->default_value("0"), "which channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)") ("bw", po::value(&bw), "analog frontend filter bandwidth in Hz") - ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") + ("ref", po::value(&ref), "reference source (internal, external, mimo)") ("wirefmt", po::value(&wirefmt)->default_value("sc16"), "wire format (sc8, sc16 or s16)") ("setup", po::value(&setup_time)->default_value(1.0), "seconds of setup time") ("progress", "periodically display short-term bandwidth") diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp index 002d30ec4..f619e6a94 100644 --- a/host/examples/rx_samples_to_udp.cpp +++ b/host/examples/rx_samples_to_udp.cpp @@ -43,7 +43,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("bw", po::value(&bw), "analog frontend filter bandwidth in Hz") ("port", po::value(&port)->default_value("7124"), "server udp port") ("addr", po::value(&addr)->default_value("192.168.1.10"), "resolvable server address") - ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") + ("ref", po::value(&ref), "clock reference (internal, external, mimo, gpsdo)") ("int-n", "tune USRP with integer-N tuning") ; // clang-format on diff --git a/host/examples/test_dboard_coercion.cpp b/host/examples/test_dboard_coercion.cpp index 7dd053610..b7370d9f9 100644 --- a/host/examples/test_dboard_coercion.cpp +++ b/host/examples/test_dboard_coercion.cpp @@ -377,7 +377,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("gain-step", po::value(&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(&ref)->default_value("internal"), "Waveform type: internal, external, or mimo") + ("ref", po::value(&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 sensor_names = usrp->get_mboard_sensor_names(0); diff --git a/host/examples/tx_bursts.cpp b/host/examples/tx_bursts.cpp index fc1ff00c9..3992ea115 100644 --- a/host/examples/tx_bursts.cpp +++ b/host/examples/tx_bursts.cpp @@ -50,7 +50,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("channels", po::value(&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(&subdev), "subdevice specification") - ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") + ("ref", po::value(&ref), "reference source (internal, external, gpsdo, mimo)") ("lo-offset", po::value(&lo_offset)->default_value(0.0), "Offset for frontend LO in Hz (optional)") ("bw", po::value(&bw), "analog frontend filter bandwidth in Hz") diff --git a/host/examples/tx_samples_from_file.cpp b/host/examples/tx_samples_from_file.cpp index 695cdf6f4..ac3a1262c 100644 --- a/host/examples/tx_samples_from_file.cpp +++ b/host/examples/tx_samples_from_file.cpp @@ -80,7 +80,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("ant", po::value(&ant), "antenna selection") ("subdev", po::value(&subdev), "subdevice specification") ("bw", po::value(&bw), "analog frontend filter bandwidth in Hz") - ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") + ("ref", po::value(&ref), "clock reference (internal, external, mimo, gpsdo)") ("wirefmt", po::value(&wirefmt)->default_value("sc16"), "wire format (sc8 or sc16)") ("delay", po::value(&delay)->default_value(0.0), "specify a delay between repeated transmission of file (in seconds)") ("channel", po::value(&channel)->default_value("0"), "which channel to use") diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp index 58f1a6885..daa539023 100644 --- a/host/examples/tx_waveforms.cpp +++ b/host/examples/tx_waveforms.cpp @@ -65,7 +65,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("bw", po::value(&bw), "analog frontend filter bandwidth in Hz") ("wave-type", po::value(&wave_type)->default_value("CONST"), "waveform type (CONST, SQUARE, RAMP, SINE)") ("wave-freq", po::value(&wave_freq)->default_value(0), "waveform frequency in Hz") - ("ref", po::value(&ref)->default_value("internal"), "clock reference (internal, external, mimo, gpsdo)") + ("ref", po::value(&ref), "clock reference (internal, external, mimo, gpsdo)") ("pps", po::value(&pps), "PPS source (internal, external, mimo, gpsdo)") ("otw", po::value(&otw)->default_value("sc16"), "specify the over-the-wire sample mode") ("channels", po::value(&channel_list)->default_value("0"), "which channels to use (specify \"0\", \"1\", \"0,1\", etc)") diff --git a/host/examples/txrx_loopback_to_file.cpp b/host/examples/txrx_loopback_to_file.cpp index e58d5ecc3..d05bff2bd 100644 --- a/host/examples/txrx_loopback_to_file.cpp +++ b/host/examples/txrx_loopback_to_file.cpp @@ -230,7 +230,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) ("rx-bw", po::value(&rx_bw), "analog receive filter bandwidth in Hz") ("wave-type", po::value(&wave_type)->default_value("CONST"), "waveform type (CONST, SQUARE, RAMP, SINE)") ("wave-freq", po::value(&wave_freq)->default_value(0), "waveform frequency in Hz") - ("ref", po::value(&ref)->default_value("internal"), "clock reference (internal, external, mimo)") + ("ref", po::value(&ref), "reference source (internal, external, gpsdo, mimo)") ("otw", po::value(&otw)->default_value("sc16"), "specify the over-the-wire sample mode") ("tx-channels", po::value(&tx_channels)->default_value("0"), "which TX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)") ("rx-channels", po::value(&rx_channels)->default_value("0"), "which RX channel(s) to use (specify \"0\", \"1\", \"0,1\", etc)")