summaryrefslogtreecommitdiffstats
path: root/src/OutputUHD.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-03-03 08:58:22 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-03-03 08:58:22 +0100
commit568f462aff32a23f1f9db9c1192da44cf8380858 (patch)
tree3c4abae8496b084f74cbe766a7ce70a27b408b2e /src/OutputUHD.cpp
parenteedb09b596ca0934d3d4a5f8603429182cb669e2 (diff)
parent0bdb1ce8e7753f6617074fb859419a6185d91ad1 (diff)
downloaddabmod-568f462aff32a23f1f9db9c1192da44cf8380858.tar.gz
dabmod-568f462aff32a23f1f9db9c1192da44cf8380858.tar.bz2
dabmod-568f462aff32a23f1f9db9c1192da44cf8380858.zip
Merge branch 'next' into restructureEDIvsETI
Diffstat (limited to 'src/OutputUHD.cpp')
-rw-r--r--src/OutputUHD.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index b4344f5..3a4511a 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -221,11 +221,31 @@ OutputUHD::OutputUHD(
throw std::runtime_error("Cannot set USRP sample rate. Aborted.");
}
- //set the centre frequency
- MDEBUG("OutputUHD:Setting freq to %f...\n", myConf.frequency);
- myUsrp->set_tx_freq(myConf.frequency);
+ if (myConf.lo_offset != 0.0) {
+ etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ "OutputUHD:Setting freq to " << myConf.frequency <<
+ " with LO offset " << myConf.lo_offset << "...";
+
+ const auto tr = uhd::tune_request_t(myConf.frequency, myConf.lo_offset);
+ uhd::tune_result_t result = myUsrp->set_tx_freq(tr);
+
+ etiLog.level(debug) << "OutputUHD:" <<
+ std::fixed << std::setprecision(0) <<
+ " Target RF: " << result.target_rf_freq <<
+ " Actual RF: " << result.actual_rf_freq <<
+ " Target DSP: " << result.target_dsp_freq <<
+ " Actual DSP: " << result.actual_dsp_freq;
+ }
+ else {
+ //set the centre frequency
+ etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ "OutputUHD:Setting freq to " << myConf.frequency << "...";
+ myUsrp->set_tx_freq(myConf.frequency);
+ }
+
myConf.frequency = myUsrp->get_tx_freq();
- MDEBUG("OutputUHD:Actual frequency: %f\n", myConf.frequency);
+ etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ "OutputUHD:Actual frequency: " << myConf.frequency;
myUsrp->set_tx_gain(myConf.txgain);
MDEBUG("OutputUHD:Actual TX Gain: %f ...\n", myUsrp->get_tx_gain());
@@ -430,6 +450,7 @@ void OutputUHD::set_usrp_time()
else {
myUsrp->set_time_now(uhd::time_spec_t(now.tv_sec));
etiLog.level(info) << "OutputUHD: Setting USRP time to " <<
+ std::fixed <<
uhd::time_spec_t(now.tv_sec).get_real_secs();
}
}
@@ -462,6 +483,7 @@ void OutputUHD::set_usrp_time()
usleep(200000); // 200ms, we want the PPS to be later
myUsrp->set_time_unknown_pps(uhd::time_spec_t(seconds + 2));
etiLog.level(info) << "OutputUHD: Setting USRP time next pps to " <<
+ std::fixed <<
uhd::time_spec_t(seconds + 2).get_real_secs();
}
@@ -733,6 +755,7 @@ void UHDWorker::handle_frame(const struct UHDWorkerFrameData *frame)
if (md.time_spec.get_real_secs() > usrp_time + TIMESTAMP_ABORT_FUTURE) {
etiLog.level(error) <<
"OutputUHD: Timestamp way too far in the future! offset: " <<
+ std::fixed <<
md.time_spec.get_real_secs() - usrp_time;
throw std::runtime_error("Timestamp error. Aborted.");
}