aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-02-25 12:05:34 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-02-25 12:05:34 +0100
commit8eb2b6842570af606c797d1bc8da55bb27487b99 (patch)
tree9546c7d4a2c3d6a178da0ad7baa74b40e6b43650
parent53c31e288732cfcee9bb04d3768b6015083e05ce (diff)
downloaddabmod-8eb2b6842570af606c797d1bc8da55bb27487b99.tar.gz
dabmod-8eb2b6842570af606c797d1bc8da55bb27487b99.tar.bz2
dabmod-8eb2b6842570af606c797d1bc8da55bb27487b99.zip
Add ability to set UHD LO offset
-rw-r--r--src/DabMod.cpp1
-rw-r--r--src/OutputUHD.cpp26
-rw-r--r--src/OutputUHD.h1
3 files changed, 25 insertions, 3 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 37db71a..741ac73 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -503,6 +503,7 @@ int launch_modulator(int argc, char* argv[])
throw std::runtime_error("Configuration error");
}
+ outputuhd_conf.lo_offset = pt.get<double>("uhdoutput.lo_offset", 0);
outputuhd_conf.refclk_src = pt.get("uhdoutput.refclk_source", "internal");
outputuhd_conf.pps_src = pt.get("uhdoutput.pps_source", "none");
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index 7f880e0..072b63a 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -221,9 +221,29 @@ 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.log(info, "OutputUHD:Setting freq to %f with LO offset %f...\n",
+ myConf.frequency, 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(info) << "OutputUHD: " << std::fixed <<
+ "Target RF: " << result.target_rf_freq <<
+ "Actual RF: " << result.actual_rf_freq <<
+ "Target DSP: " << result.target_dsp_freq <<
+ "Actual DSP: " << result.actual_dsp_freq;
+
+ if (result.clipped_rf_freq != result.target_rf_freq) {
+ etiLog.level(warn) <<
+ "OutputUHD: clipped RF frequency " << std::fixed <<
+ " different from target";
+ }
+ }
+ else {
+ //set the centre frequency
+ etiLog.log(info, "OutputUHD:Setting freq to %f...\n", myConf.frequency);
+ myUsrp->set_tx_freq(myConf.frequency);
+ }
myConf.frequency = myUsrp->get_tx_freq();
MDEBUG("OutputUHD:Actual frequency: %f\n", myConf.frequency);
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index e477e47..cbf159f 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -182,6 +182,7 @@ struct OutputUHDConfig {
long masterClockRate = 32768000;
unsigned sampleRate = 2048000;
double frequency = 0.0;
+ double lo_offset = 0.0;
double txgain = 0.0;
bool enableSync = false;
bool muteNoTimestamps = false;