From 8055ac0d4f10c8c13709d49fedcc66615e472a79 Mon Sep 17 00:00:00 2001 From: michael-west Date: Fri, 8 Aug 2014 17:40:54 -0700 Subject: - Fixes for channel alignment - Added analog delay for radio clock - Added analog delay for DAC reference clocks - Removed resetting of clock control - Removed setting of reference clock and PPS to external sources during initialization - Fixes for set_time_unknown_pps - Removed wait for PPS edge after setting time from GPSDO - Changed set_time_unknonw_pps to time out based on system time rather than device VITA time --- host/lib/usrp/x300/x300_impl.cpp | 67 +++++++++++++++------------------------- 1 file changed, 25 insertions(+), 42 deletions(-) (limited to 'host/lib/usrp/x300/x300_impl.cpp') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 3561bc2f1..1b651065d 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -809,45 +809,32 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) _tree->access(mb_path / "tx_subdev_spec").set(tx_fe_spec); UHD_MSG(status) << "Initializing clock and PPS references..." << std::endl; - try { - //First, try external source - _tree->access(mb_path / "clock_source" / "value").set("external"); - wait_for_ref_locked(mb.zpu_ctrl, 1.0); - _tree->access(mb_path / "time_source" / "value").set("external"); - UHD_MSG(status) << "References initialized to external sources" << std::endl; - } catch (uhd::exception::runtime_error &e) { - //No external source detected - set to the GPSDO if installed - if (mb.gps and mb.gps->gps_detected()) - { - _tree->access(mb_path / "clock_source" / "value").set("gpsdo"); - try { - wait_for_ref_locked(mb.zpu_ctrl, 1.0); - } catch (uhd::exception::runtime_error &e) { - UHD_MSG(warning) << "Clock reference failed to lock to GPSDO during device initialization. " << - "Check for the lock before operation or ignore this warning if using another clock source." << std::endl; - } - _tree->access(mb_path / "time_source" / "value").set("gpsdo"); - UHD_MSG(status) << "References initialized to GPSDO sources" << std::endl; - UHD_MSG(status) << "Initializing time to the GPSDO time" << std::endl; - const time_t tp = time_t(mb.gps->get_sensor("gps_time").to_int()+1); - _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); - - //wait for next PPS edge (timeout after 1 second) - time_spec_t pps_time = _tree->access(mb_path / "time" / "pps").get(); - for (size_t i = 0; i < 10 && _tree->access(mb_path / "time" / "pps").get() == pps_time; i++) - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); - } else { - _tree->access(mb_path / "clock_source" / "value").set("internal"); - try { - wait_for_ref_locked(mb.zpu_ctrl, 1.0); - } catch (uhd::exception::runtime_error &e) { - // Ignore for now - It can sometimes take longer than 1 second to lock and that is OK. - //UHD_MSG(warning) << "Clock reference failed to lock to internal source during device initialization. " << - // "Check for the lock before operation or ignore this warning if using another clock source." << std::endl; - } - _tree->access(mb_path / "time_source" / "value").set("internal"); - UHD_MSG(status) << "References initialized to internal sources" << std::endl; + //Set to the GPSDO if installed + if (mb.gps and mb.gps->gps_detected()) + { + _tree->access(mb_path / "clock_source" / "value").set("gpsdo"); + try { + wait_for_ref_locked(mb.zpu_ctrl, 1.0); + } catch (uhd::exception::runtime_error &e) { + UHD_MSG(warning) << "Clock reference failed to lock to GPSDO during device initialization. " << + "Check for the lock before operation or ignore this warning if using another clock source." << std::endl; + } + _tree->access(mb_path / "time_source" / "value").set("gpsdo"); + UHD_MSG(status) << "References initialized to GPSDO sources" << std::endl; + UHD_MSG(status) << "Initializing time to the GPSDO time" << std::endl; + const time_t tp = time_t(mb.gps->get_sensor("gps_time").to_int()+1); + _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); + } else { + _tree->access(mb_path / "clock_source" / "value").set("internal"); + try { + wait_for_ref_locked(mb.zpu_ctrl, 1.0); + } catch (uhd::exception::runtime_error &e) { + // Ignore for now - It can sometimes take longer than 1 second to lock and that is OK. + //UHD_MSG(warning) << "Clock reference failed to lock to internal source during device initialization. " << + // "Check for the lock before operation or ignore this warning if using another clock source." << std::endl; } + _tree->access(mb_path / "time_source" / "value").set("internal"); + UHD_MSG(status) << "References initialized to internal sources" << std::endl; } } @@ -1395,10 +1382,6 @@ void x300_impl::update_clock_source(mboard_members_t &mb, const std::string &sou this->update_clock_control(mb); - //reset the clock control - //without this, the lock time is long and can be as much as 30 seconds - mb.clock->reset_clocks(); - /* FIXME: implement when we know the correct timeouts * //wait for lock * double timeout = 1.0; -- cgit v1.2.3