From 06970692ae172aad68e4826b447d6f712e2970b8 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Wed, 3 Oct 2018 19:00:12 -0700 Subject: utils: fix bmark_rate MIMO synchronization Fix USRP2 MIMO synchronization in benchmark_rate. When synchronizing N2XXs connected with a MIMO cable, only the master's time needs to be set; the slave will be synchronized automatically. Currently, calling set_time_unknown_pps will attempt to synchronize the slave on the next PPS, which can cause problems since the MIMO cable doesn't propogate a PPS signal. --- host/examples/benchmark_rate.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'host/examples') diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index 88be83a7b..3a089dc62 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -469,16 +469,17 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } std::cout << boost::format("[%s] Setting device timestamp to 0...") % NOW() << std::endl; - const bool sync_channels = - pps == "mimo" or - ref == "mimo" or - rx_channel_nums.size() > 1 or - tx_channel_nums.size() > 1 - ; - if (!sync_channels) { - usrp->set_time_now(0.0); + if (pps == "mimo" or ref == "mimo") { + // only set the master's time, the slave's is automatically sync'd + usrp->set_time_now(uhd::time_spec_t(0.0), 0); + // ensure that the setter has completed + usrp->get_time_now(); + // wait for the time to sync + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } else if (rx_channel_nums.size() > 1 or tx_channel_nums.size() > 1) { + usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); } else { - usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); + usrp->set_time_now(0.0); } //spawn the receive test thread -- cgit v1.2.3