From 06fbb47dae3530c20202414d5c9e77626419079e Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Fri, 1 May 2015 12:15:36 -0700 Subject: e300: gps: If gps is detected, set device time to gps time on init. Before the device time wasn't set for E310 on initialization. This will allow 'query_gpsdo_sensors' to pass if gps has lock. Signed-off-by: Moritz Fischer --- host/lib/usrp/e300/e300_impl.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 2e8f50e05..8a41d44cd 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -574,6 +574,17 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) } _tree->access(mb_path / "rx_subdev_spec").set(rx_spec); _tree->access(mb_path / "tx_subdev_spec").set(tx_spec); + + // GPS installed: use external ref, time, and init time spec + if (_sensor_manager->get_gps_found()) { + _tree->access(mb_path / "time_source" / "value").set("gpsdo"); + UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; + const time_t tp = time_t(_sensor_manager->get_sensor("gps_time").to_int()+1); + _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); + } else { + //init to internal clock and time source + _tree->access(mb_path / "time_source/value").set("internal"); + } } boost::uint8_t e300_impl::_get_internal_gpio( -- cgit v1.2.3 From 4d3b80c338f34d7dc9516e7cdff7782aaf922b9c Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Fri, 1 May 2015 12:17:10 -0700 Subject: e300: gps: Keep antenna power supply and pps running all the time. This is a change from behaviour so far. Before the GPS was only on while UHD is running. This behaviour was confusing users, and didn't match our other devices. Signed-off-by: Moritz Fischer --- host/lib/usrp/e300/e300_impl.cpp | 6 +++--- host/lib/usrp/e300/e300_ublox_control_impl.cpp | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 8a41d44cd..735f109b4 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -575,14 +575,14 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) _tree->access(mb_path / "rx_subdev_spec").set(rx_spec); _tree->access(mb_path / "tx_subdev_spec").set(tx_spec); - // GPS installed: use external ref, time, and init time spec - if (_sensor_manager->get_gps_found()) { + // gps installed: use time and init time spec + if (_sensor_manager->get_sensor("gps_locked").to_bool()) { _tree->access(mb_path / "time_source" / "value").set("gpsdo"); UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; const time_t tp = time_t(_sensor_manager->get_sensor("gps_time").to_int()+1); _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); } else { - //init to internal clock and time source + //init to internal time source _tree->access(mb_path / "time_source/value").set("internal"); } } diff --git a/host/lib/usrp/e300/e300_ublox_control_impl.cpp b/host/lib/usrp/e300/e300_ublox_control_impl.cpp index 0f56fdb67..0b8a2048d 100644 --- a/host/lib/usrp/e300/e300_ublox_control_impl.cpp +++ b/host/lib/usrp/e300/e300_ublox_control_impl.cpp @@ -83,9 +83,6 @@ std::time_t control_impl::_get_epoch_time(void) control_impl::~control_impl(void) { - // turn it all off again - configure_antenna(0x001a, 0x8251); - configure_pps(0xf4240, 0x3d090, 1, 1, 0, 0, 0, 0); } void control_impl::_decode_init(void) -- cgit v1.2.3 From e1f466e24ebf3f890330d0dadbb399548d156ae4 Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Fri, 1 May 2015 16:06:12 -0700 Subject: e300: gps: If gps doesn't have lock return 0 as time. Signed-off-by: Moritz Fischer --- host/lib/usrp/e300/e300_impl.cpp | 13 +++---------- host/lib/usrp/e300/e300_ublox_control_impl.cpp | 5 ++++- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 735f109b4..b35bbab4e 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -575,16 +575,9 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) _tree->access(mb_path / "rx_subdev_spec").set(rx_spec); _tree->access(mb_path / "tx_subdev_spec").set(tx_spec); - // gps installed: use time and init time spec - if (_sensor_manager->get_sensor("gps_locked").to_bool()) { - _tree->access(mb_path / "time_source" / "value").set("gpsdo"); - UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; - const time_t tp = time_t(_sensor_manager->get_sensor("gps_time").to_int()+1); - _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); - } else { - //init to internal time source - _tree->access(mb_path / "time_source/value").set("internal"); - } + UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; + const time_t tp = time_t(_sensor_manager->get_sensor("gps_time").to_int()+1); + _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); } boost::uint8_t e300_impl::_get_internal_gpio( diff --git a/host/lib/usrp/e300/e300_ublox_control_impl.cpp b/host/lib/usrp/e300/e300_ublox_control_impl.cpp index 0b8a2048d..389bf79fa 100644 --- a/host/lib/usrp/e300/e300_ublox_control_impl.cpp +++ b/host/lib/usrp/e300/e300_ublox_control_impl.cpp @@ -65,7 +65,10 @@ std::vector control_impl::get_sensors(void) uhd::sensor_value_t control_impl::get_sensor(std::string key) { if (key == "gps_time") { - return sensor_value_t("GPS epoch time", int(_get_epoch_time()), "seconds"); + bool lock; + _locked.wait_and_see(lock); + return sensor_value_t("GPS epoch time", + lock ? int(_get_epoch_time()) : 0, "seconds"); } else if (key == "gps_locked") { bool lock; _locked.wait_and_see(lock); -- cgit v1.2.3