diff options
Diffstat (limited to 'host/lib/usrp')
| -rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 5 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 9 | ||||
| -rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 6 | 
3 files changed, 17 insertions, 3 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 261183128..f2b3885e6 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -477,6 +477,11 @@ b200_impl::b200_impl(const device_addr_t &device_addr)          UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl;          const time_t tp = time_t(_gps->get_sensor("gps_time").to_int()+1);          _tree->access<time_spec_t>(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<time_spec_t>(mb_path / "time" / "pps").get(); +        for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(mb_path / "time" / "pps").get() == pps_time; i++) +            boost::this_thread::sleep(boost::posix_time::milliseconds(100));      }  } diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 918f3e892..7c478d8e1 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -35,6 +35,7 @@  #include <boost/assign/list_of.hpp>  #include <boost/asio/ip/address_v4.hpp>  #include <boost/asio.hpp> //used for htonl and ntohl +#include <boost/thread.hpp>  using namespace uhd;  using namespace uhd::usrp; @@ -760,7 +761,13 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){              _tree->access<std::string>(root / "time_source/value").set("gpsdo");              _tree->access<std::string>(root / "clock_source/value").set("gpsdo");              UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; -            _mbc[mb].time64->set_time_next_pps(time_spec_t(time_t(_mbc[mb].gps->get_sensor("gps_time").to_int()+1))); +            const time_t tp = time_t(_mbc[mb].gps->get_sensor("gps_time").to_int()+1); +            _tree->access<time_spec_t>(root / "time" / "pps").set(time_spec_t(tp)); + +            //wait for next PPS edge (timeout after 1 second) +            time_spec_t pps_time = _tree->access<time_spec_t>(root / "time" / "pps").get(); +            for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(root / "time" / "pps").get() == pps_time; i++) +                boost::this_thread::sleep(boost::posix_time::milliseconds(100));          }      } diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 2c291f422..fdf216cf2 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -831,8 +831,10 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)              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<time_spec_t>(mb_path / "time" / "pps").set(time_spec_t(tp)); -            //wait for time to be set (timeout after 1 second) -            for (int i = 0; i < 10 && tp != (_tree->access<time_spec_t>(mb_path / "time" / "pps").get()).get_full_secs(); i++) + +            //wait for next PPS edge (timeout after 1 second) +            time_spec_t pps_time = _tree->access<time_spec_t>(mb_path / "time" / "pps").get(); +            for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(mb_path / "time" / "pps").get() == pps_time; i++)                  boost::this_thread::sleep(boost::posix_time::milliseconds(100));          } else {              _tree->access<std::string>(mb_path / "clock_source" / "value").set("internal");  | 
