Commit b6e2f0e0 authored by Sagar Parsawar's avatar Sagar Parsawar

gps time sync improvements

parent 78e96664
......@@ -201,10 +201,21 @@ static int sync_to_gps(openair0_device *device) {
LOG_W(HW,"WARNING: GPS not locked - time will not be accurate until locked\n");
}
//wait for next pps
uhd::time_spec_t last = s->usrp->get_time_last_pps();
uhd::time_spec_t next = s->usrp->get_time_last_pps();
while(next == last) {
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
last = next;
next = s->usrp->get_time_last_pps();
}
boost::this_thread::sleep(boost::posix_time::milliseconds(200));
//Set to GPS time
uhd::time_spec_t gps_time = uhd::time_spec_t(time_t(s->usrp->get_mboard_sensor("gps_time", mboard).to_int()));
s->usrp->set_time_next_pps(gps_time+1.0, mboard);
//s->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
//Wait for it to apply
//The wait is 2 seconds because N-Series has a known issue where
//the time at the last PPS does not properly update at the PPS edge
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment