summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-15 20:06:14 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-15 20:06:14 +0200
commit1e01627b0653c76e215a9d8f5e9fffe510e247a6 (patch)
treef38f6b642dc0e1a44e630c5bca8467f005f64fcc
parent0ba1b6c711e4fe9622f6ca75b91b2740d640e099 (diff)
downloaddabmod-1e01627b0653c76e215a9d8f5e9fffe510e247a6.tar.gz
dabmod-1e01627b0653c76e215a9d8f5e9fffe510e247a6.tar.bz2
dabmod-1e01627b0653c76e215a9d8f5e9fffe510e247a6.zip
Add support for Ettus GPSDO
-rw-r--r--doc/example.ini5
-rw-r--r--src/OutputUHD.cpp46
-rw-r--r--src/OutputUHD.h2
3 files changed, 46 insertions, 7 deletions
diff --git a/doc/example.ini b/doc/example.ini
index 272b2e9..a2de463 100644
--- a/doc/example.ini
+++ b/doc/example.ini
@@ -181,8 +181,9 @@ txgain=2.0
;frequency=234208000
channel=13C
-; The reference clock to use.
-; possible values : internal, external, MIMO, gpsdo
+; The reference clock to use. The gpsdo is the ODR LEA-M8F board, the
+; official Ettus GPSDO is selected with gpsdo-ettus
+; possible values : internal, external, MIMO, gpsdo, gpsdo-ettus
refclk_source=internal
; The reference one pulse-per second to use
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index e71a625..609dd43 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -63,7 +63,7 @@ void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
}
}
-// Check function for GPS TIMELOCK sensor
+// Check function for GPS TIMELOCK sensor from the ODR LEA-M8F board GPSDO
bool check_gps_timelock(uhd::usrp::multi_usrp::sptr usrp)
{
try {
@@ -83,6 +83,26 @@ bool check_gps_timelock(uhd::usrp::multi_usrp::sptr usrp)
}
}
+// Check function for GPS LOCKED sensor from the Ettus GPSDO
+bool check_gps_locked(uhd::usrp::multi_usrp::sptr usrp)
+{
+ try {
+ uhd::sensor_value_t sensor_value(
+ usrp->get_mboard_sensor("gps_locked", 0));
+ if (not sensor_value.to_bool()) {
+ etiLog.level(warn) << "OutputUHD: gps_locked " <<
+ sensor_value.to_pp_string();
+ return false;
+ }
+
+ return true;
+ }
+ catch (uhd::lookup_error &e) {
+ etiLog.level(warn) << "OutputUHD: no gps_locked sensor";
+ return false;
+ }
+}
+
OutputUHD::OutputUHD(
const OutputUHDConfig& config) :
@@ -162,7 +182,12 @@ OutputUHD::OutputUHD(
MDEBUG("OutputUHD:Setting REFCLK and PPS input...\n");
- myUsrp->set_clock_source(myConf.refclk_src);
+ if (myConf.refclk_src == "gpsdo-ettus") {
+ myUsrp->set_clock_source("gpsdo");
+ }
+ else {
+ myUsrp->set_clock_source(myConf.refclk_src);
+ }
myUsrp->set_time_source(myConf.pps_src);
if (myConf.subDevice != "") {
@@ -209,6 +234,7 @@ OutputUHD::OutputUHD(
uwd.sourceContainsTimestamp = false;
uwd.muteNoTimestamps = myConf.muteNoTimestamps;
uwd.refclk_lock_loss_behaviour = myConf.refclk_lock_loss_behaviour;
+ uwd.gpsdo_is_ettus = false;
if (myConf.refclk_src == "internal") {
uwd.check_refclk_loss = false;
@@ -218,6 +244,11 @@ OutputUHD::OutputUHD(
uwd.check_refclk_loss = true;
uwd.check_gpsfix = (myConf.maxGPSHoldoverTime != 0);
}
+ else if (myConf.refclk_src == "gpsdo-ettus") {
+ uwd.check_refclk_loss = true;
+ uwd.check_gpsfix = (myConf.maxGPSHoldoverTime != 0);
+ uwd.gpsdo_is_ettus = true;
+ }
else {
uwd.check_refclk_loss = true;
uwd.check_gpsfix = false;
@@ -568,9 +599,14 @@ void OutputUHD::check_gps()
else {
// Checking the sensor here takes too much
// time, it has to be done in a separate thread.
- gps_fix_pt = boost::packaged_task<bool>(
- boost::bind(check_gps_timelock, myUsrp) );
-
+ if (uwd.gpsdo_is_ettus) {
+ gps_fix_pt = boost::packaged_task<bool>(
+ boost::bind(check_gps_locked, myUsrp) );
+ }
+ else {
+ gps_fix_pt = boost::packaged_task<bool>(
+ boost::bind(check_gps_timelock, myUsrp) );
+ }
gps_fix_future = gps_fix_pt.get_future();
gps_fix_task = boost::thread(boost::move(gps_fix_pt));
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index 88be215..124ff93 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -123,6 +123,8 @@ struct UHDWorkerData {
// If we want to check for the gps_timelock sensor
bool check_gpsfix;
+ bool gpsdo_is_ettus; // Set to false in case the ODR LEA-M8F board is used
+
// muting set by remote control
bool muting;