From 4d8310ae0ffe1f78a2b8623d55f63ae504ff1aa8 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 4 Nov 2017 08:36:03 +0100 Subject: Make DPD Feedback server SDRDevice-agnostic --- src/output/SDRDevice.h | 136 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 src/output/SDRDevice.h (limited to 'src/output/SDRDevice.h') diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h new file mode 100644 index 0000000..856233b --- /dev/null +++ b/src/output/SDRDevice.h @@ -0,0 +1,136 @@ +/* + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the + Queen in Right of Canada (Communications Research Center Canada) + + Copyright (C) 2017 + Matthias P. Braendli, matthias.braendli@mpb.li + + http://opendigitalradio.org + +DESCRIPTION: + Common interface for all SDR outputs +*/ + +/* + This file is part of ODR-DabMod. + + ODR-DabMod is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + ODR-DabMod is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ODR-DabMod. If not, see . + */ + +#pragma once + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include "TimestampDecoder.h" + +namespace Output { + +enum refclk_lock_loss_behaviour_t { CRASH, IGNORE }; + +using complexf = std::complex; + +/* This structure is used as initial configuration for all SDR devices. + * It must also contain all remote-controllable settings, otherwise + * they will get lost on a modulator restart. */ +struct SDRDeviceConfig { + std::string device; + std::string subDevice; // For UHD + + long masterClockRate = 32768000; + unsigned sampleRate = 2048000; + double frequency = 0.0; + double lo_offset = 0.0; + double txgain = 0.0; + double rxgain = 0.0; + bool enableSync = false; + + // When working with timestamps, mute the frames that + // do not have a timestamp + bool muteNoTimestamps = false; + unsigned dabMode = 0; + unsigned maxGPSHoldoverTime = 0; + + /* allowed values for UHD : auto, int, sma, mimo */ + std::string refclk_src; + + /* allowed values for UHD : int, sma, mimo */ + std::string pps_src; + + /* allowed values for UHD : pos, neg */ + std::string pps_polarity; + + /* What to do when the reference clock PLL loses lock */ + refclk_lock_loss_behaviour_t refclk_lock_loss_behaviour; + + // muting can only be changed using the remote control + bool muting = false; + + // TCP port on which to serve TX and RX samples for the + // digital pre distortion learning tool + uint16_t dpdFeedbackServerPort = 0; +}; + +// Each frame contains one OFDM frame, and its +// associated timestamp +struct FrameData { + // Buffer holding frame data + std::vector buf; + + // A full timestamp contains a TIST according to standard + // and time information within MNSC with tx_second. + struct frame_timestamp ts; +}; + + +// All SDR Devices must implement the SDRDevice interface +class SDRDevice { + public: + struct RunStatistics { + size_t num_underruns; + size_t num_late_packets; + size_t num_overruns; + size_t num_frames_modulated; //TODO increment + }; + + // TODO make some functions const + virtual void tune(double lo_offset, double frequency) = 0; + virtual double get_tx_freq(void) = 0; + virtual void set_txgain(double txgain) = 0; + virtual double get_txgain(void) = 0; + virtual void transmit_frame(const struct FrameData& frame) = 0; + virtual RunStatistics get_run_statistics(void) = 0; + virtual double get_real_secs(void) = 0; + virtual void set_rxgain(double rxgain) = 0; + virtual double get_rxgain(void) = 0; + virtual size_t receive_frame( + complexf *buf, + size_t num_samples, + struct frame_timestamp& ts, + double timeout_secs) = 0; + + + // Return true if GPS and reference clock inputs are ok + virtual bool is_clk_source_ok(void) = 0; + + virtual const char* device_name(void) = 0; +}; + +} // namespace Output -- cgit v1.2.3 From ac0b24dc76cae40cf513e97160da9305a7d5505c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 16 Jan 2018 12:11:27 +0100 Subject: Make some SDR functions const --- src/output/SDR.cpp | 1 - src/output/SDRDevice.h | 15 +++++++-------- src/output/Soapy.cpp | 16 ++++++++-------- src/output/Soapy.h | 16 ++++++++-------- src/output/UHD.cpp | 16 ++++++++-------- src/output/UHD.h | 18 +++++++++--------- 6 files changed, 40 insertions(+), 42 deletions(-) (limited to 'src/output/SDRDevice.h') diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index a2fb42a..e478de5 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -201,7 +201,6 @@ void SDR::process_thread_entry() } m_running.store(false); - etiLog.level(warn) << "SDR Device thread terminated"; } const char* SDR::name() diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h index 856233b..89a9856 100644 --- a/src/output/SDRDevice.h +++ b/src/output/SDRDevice.h @@ -110,16 +110,15 @@ class SDRDevice { size_t num_frames_modulated; //TODO increment }; - // TODO make some functions const virtual void tune(double lo_offset, double frequency) = 0; - virtual double get_tx_freq(void) = 0; + virtual double get_tx_freq(void) const = 0; virtual void set_txgain(double txgain) = 0; - virtual double get_txgain(void) = 0; + virtual double get_txgain(void) const = 0; virtual void transmit_frame(const struct FrameData& frame) = 0; - virtual RunStatistics get_run_statistics(void) = 0; - virtual double get_real_secs(void) = 0; + virtual RunStatistics get_run_statistics(void) const = 0; + virtual double get_real_secs(void) const = 0; virtual void set_rxgain(double rxgain) = 0; - virtual double get_rxgain(void) = 0; + virtual double get_rxgain(void) const = 0; virtual size_t receive_frame( complexf *buf, size_t num_samples, @@ -128,9 +127,9 @@ class SDRDevice { // Return true if GPS and reference clock inputs are ok - virtual bool is_clk_source_ok(void) = 0; + virtual bool is_clk_source_ok(void) const = 0; - virtual const char* device_name(void) = 0; + virtual const char* device_name(void) const = 0; }; } // namespace Output diff --git a/src/output/Soapy.cpp b/src/output/Soapy.cpp index e0a6f10..82c926b 100644 --- a/src/output/Soapy.cpp +++ b/src/output/Soapy.cpp @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -114,7 +114,7 @@ void Soapy::tune(double lo_offset, double frequency) m_device->setFrequency(SOAPY_SDR_TX, 0, m_conf.frequency, offset_arg); } -double Soapy::get_tx_freq(void) +double Soapy::get_tx_freq(void) const { if (not m_device) throw runtime_error("Soapy device not set up"); @@ -129,13 +129,13 @@ void Soapy::set_txgain(double txgain) m_device->setGain(SOAPY_SDR_TX, 0, m_conf.txgain); } -double Soapy::get_txgain(void) +double Soapy::get_txgain(void) const { if (not m_device) throw runtime_error("Soapy device not set up"); return m_device->getGain(SOAPY_SDR_TX, 0); } -SDRDevice::RunStatistics Soapy::get_run_statistics(void) +SDRDevice::RunStatistics Soapy::get_run_statistics(void) const { RunStatistics rs; rs.num_underruns = underflows; @@ -146,7 +146,7 @@ SDRDevice::RunStatistics Soapy::get_run_statistics(void) } -double Soapy::get_real_secs(void) +double Soapy::get_real_secs(void) const { if (m_device) { long long time_ns = m_device->getHardwareTime(); @@ -163,7 +163,7 @@ void Soapy::set_rxgain(double rxgain) m_conf.rxgain = m_device->getGain(SOAPY_SDR_RX, 0); } -double Soapy::get_rxgain(void) +double Soapy::get_rxgain(void) const { return m_device->getGain(SOAPY_SDR_RX, 0); } @@ -197,13 +197,13 @@ size_t Soapy::receive_frame( } -bool Soapy::is_clk_source_ok() +bool Soapy::is_clk_source_ok() const { // TODO return true; } -const char* Soapy::device_name(void) +const char* Soapy::device_name(void) const { return "Soapy"; } diff --git a/src/output/Soapy.h b/src/output/Soapy.h index c603193..7bf0239 100644 --- a/src/output/Soapy.h +++ b/src/output/Soapy.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -61,15 +61,15 @@ class Soapy : public Output::SDRDevice ~Soapy(); virtual void tune(double lo_offset, double frequency) override; - virtual double get_tx_freq(void) override; + virtual double get_tx_freq(void) const override; virtual void set_txgain(double txgain) override; - virtual double get_txgain(void) override; + virtual double get_txgain(void) const override; virtual void transmit_frame(const struct FrameData& frame) override; - virtual RunStatistics get_run_statistics(void) override; - virtual double get_real_secs(void) override; + virtual RunStatistics get_run_statistics(void) const override; + virtual double get_real_secs(void) const override; virtual void set_rxgain(double rxgain) override; - virtual double get_rxgain(void) override; + virtual double get_rxgain(void) const override; virtual size_t receive_frame( complexf *buf, size_t num_samples, @@ -77,8 +77,8 @@ class Soapy : public Output::SDRDevice double timeout_secs) override; // Return true if GPS and reference clock inputs are ok - virtual bool is_clk_source_ok(void) override; - virtual const char* device_name(void) override; + virtual bool is_clk_source_ok(void) const override; + virtual const char* device_name(void) const override; private: SDRDeviceConfig& m_conf; diff --git a/src/output/UHD.cpp b/src/output/UHD.cpp index 97cf5bb..dda008b 100644 --- a/src/output/UHD.cpp +++ b/src/output/UHD.cpp @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -230,7 +230,7 @@ void UHD::tune(double lo_offset, double frequency) m_usrp->set_rx_freq(frequency); } -double UHD::get_tx_freq(void) +double UHD::get_tx_freq(void) const { return m_usrp->get_tx_freq(); } @@ -241,7 +241,7 @@ void UHD::set_txgain(double txgain) m_conf.txgain = m_usrp->get_tx_gain(); } -double UHD::get_txgain(void) +double UHD::get_txgain(void) const { return m_usrp->get_tx_gain(); } @@ -306,7 +306,7 @@ void UHD::transmit_frame(const struct FrameData& frame) } -SDRDevice::RunStatistics UHD::get_run_statistics(void) +SDRDevice::RunStatistics UHD::get_run_statistics(void) const { RunStatistics rs; rs.num_underruns = num_underflows; @@ -316,7 +316,7 @@ SDRDevice::RunStatistics UHD::get_run_statistics(void) return rs; } -double UHD::get_real_secs(void) +double UHD::get_real_secs(void) const { return m_usrp->get_time_now().get_real_secs(); } @@ -327,7 +327,7 @@ void UHD::set_rxgain(double rxgain) m_conf.rxgain = m_usrp->get_rx_gain(); } -double UHD::get_rxgain() +double UHD::get_rxgain() const { return m_usrp->get_rx_gain(); } @@ -358,7 +358,7 @@ size_t UHD::receive_frame( } // Return true if GPS and reference clock inputs are ok -bool UHD::is_clk_source_ok(void) +bool UHD::is_clk_source_ok(void) const { bool ok = true; @@ -390,7 +390,7 @@ bool UHD::is_clk_source_ok(void) return ok; } -const char* UHD::device_name(void) +const char* UHD::device_name(void) const { return "UHD"; } diff --git a/src/output/UHD.h b/src/output/UHD.h index 448fb3f..ddcb33b 100644 --- a/src/output/UHD.h +++ b/src/output/UHD.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -74,15 +74,15 @@ class UHD : public Output::SDRDevice ~UHD(); virtual void tune(double lo_offset, double frequency) override; - virtual double get_tx_freq(void) override; + virtual double get_tx_freq(void) const override; virtual void set_txgain(double txgain) override; - virtual double get_txgain(void) override; + virtual double get_txgain(void) const override; virtual void transmit_frame(const struct FrameData& frame) override; - virtual RunStatistics get_run_statistics(void) override; - virtual double get_real_secs(void) override; + virtual RunStatistics get_run_statistics(void) const override; + virtual double get_real_secs(void) const override; virtual void set_rxgain(double rxgain) override; - virtual double get_rxgain(void) override; + virtual double get_rxgain(void) const override; virtual size_t receive_frame( complexf *buf, size_t num_samples, @@ -90,8 +90,8 @@ class UHD : public Output::SDRDevice double timeout_secs) override; // Return true if GPS and reference clock inputs are ok - virtual bool is_clk_source_ok(void) override; - virtual const char* device_name(void) override; + virtual bool is_clk_source_ok(void) const override; + virtual const char* device_name(void) const override; private: SDRDeviceConfig& m_conf; @@ -112,7 +112,7 @@ class UHD : public Output::SDRDevice // Returns true if we want to verify loss of refclk bool refclk_loss_needs_check(void) const; - bool suppress_refclk_loss_check = false; + mutable bool suppress_refclk_loss_check = false; // Poll asynchronous metadata from UHD std::atomic m_running; -- cgit v1.2.3 From d5db57bf0290133450b7cd10525532415076bf0e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 17 Jan 2018 10:13:20 +0100 Subject: Increment num_frames_modulated --- TODO | 2 ++ src/output/SDRDevice.h | 2 +- src/output/Soapy.cpp | 1 + src/output/Soapy.h | 2 +- src/output/UHD.cpp | 2 ++ src/output/UHD.h | 2 +- 6 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/output/SDRDevice.h') diff --git a/TODO b/TODO index 53932ea..8f49571 100644 --- a/TODO +++ b/TODO @@ -15,6 +15,8 @@ that the LimeSDR gets support for a HW timestamp that can be set from a PPS signal. Discussion ongoing here https://discourse.myriadrf.org/t/synchronize-two-limesdr/1714 +DPD will be possible too. + Move dpd port from uhd section to somewhere else. diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h index 89a9856..bcd5a39 100644 --- a/src/output/SDRDevice.h +++ b/src/output/SDRDevice.h @@ -107,7 +107,7 @@ class SDRDevice { size_t num_underruns; size_t num_late_packets; size_t num_overruns; - size_t num_frames_modulated; //TODO increment + size_t num_frames_modulated; }; virtual void tune(double lo_offset, double frequency) = 0; diff --git a/src/output/Soapy.cpp b/src/output/Soapy.cpp index 82c926b..44f8f58 100644 --- a/src/output/Soapy.cpp +++ b/src/output/Soapy.cpp @@ -255,6 +255,7 @@ void Soapy::transmit_frame(const struct FrameData& frame) num_acc_samps += ret; } + num_frames_modulated++; } } // namespace Output diff --git a/src/output/Soapy.h b/src/output/Soapy.h index 7bf0239..67b280d 100644 --- a/src/output/Soapy.h +++ b/src/output/Soapy.h @@ -89,7 +89,7 @@ class Soapy : public Output::SDRDevice size_t underflows = 0; size_t overflows = 0; size_t late_packets = 0; - size_t num_frames_modulated = 0; //TODO increment + size_t num_frames_modulated = 0; }; } // namespace Output diff --git a/src/output/UHD.cpp b/src/output/UHD.cpp index dda008b..c55939f 100644 --- a/src/output/UHD.cpp +++ b/src/output/UHD.cpp @@ -303,6 +303,8 @@ void UHD::transmit_frame(const struct FrameData& frame) break; } } + + num_frames_modulated++; } diff --git a/src/output/UHD.h b/src/output/UHD.h index ddcb33b..b34455c 100644 --- a/src/output/UHD.h +++ b/src/output/UHD.h @@ -103,7 +103,7 @@ class UHD : public Output::SDRDevice size_t num_underflows = 0; size_t num_overflows = 0; size_t num_late_packets = 0; - size_t num_frames_modulated = 0; //TODO increment + size_t num_frames_modulated = 0; size_t num_underflows_previous = 0; size_t num_late_packets_previous = 0; -- cgit v1.2.3 From 1035eb6574ac4062333e756a1ba4f47a4bfa9855 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Thu, 18 Jan 2018 02:13:29 +0100 Subject: Add antenna selection to config --- TODO | 18 +++++++----------- doc/example.ini | 8 ++++++++ src/ConfigParser.cpp | 9 ++++++--- src/output/SDRDevice.h | 2 ++ src/output/Soapy.cpp | 13 +++++++++++-- src/output/UHD.cpp | 21 ++++++++++++--------- 6 files changed, 46 insertions(+), 25 deletions(-) (limited to 'src/output/SDRDevice.h') diff --git a/TODO b/TODO index ac0a877..cff3a99 100644 --- a/TODO +++ b/TODO @@ -27,7 +27,7 @@ Clean up and separate GPS and refclk checks. * Ensure muting is set properly at startup. * Ensure synchronous is taken in account. -Add antenna selection to config. +*done* Add antenna selection to config. Test RC entries. @@ -53,6 +53,12 @@ Tests, both with B200 and LimeSDR: - Proper teardown - DPD server +Smaller things +-------------- + +Remove GuardIntervalInserter implementation for window==0, as it was shown both are equivalent. + + Replace all prints to stderr ---------------------------- We have a nice logging subsystem, use it to avoid that fprintf(stderr, ...) and @@ -84,13 +90,3 @@ The CIC Equaliser was used for the USRP1 to compensate for spectrum flatness. It is not documented, and its effect poorly explained. Review if still needed, and document appropriately. - -Add metadata to flowgraph -------------------------- -The flowgraph does not support metadata. This is why the timestamp has this -kludge with the delay queue, so that the timestamps are delayed properly -depending on what is included in the flowgraph. - -Without metadata inside the flowgraph, it is more difficult to pipeline the DSP -processing to make use of many-core systems, because the timestamp cannot be -carried alongside the data it corresponds to. diff --git a/doc/example.ini b/doc/example.ini index d919f4a..b0bf022 100644 --- a/doc/example.ini +++ b/doc/example.ini @@ -190,6 +190,11 @@ txgain=40 ; More information and measurements available on: ; http://wiki.opendigitalradio.org/index.php/USRP_B200_Measurements +; You can set what TX and RX antennas to use. This will depend on the +; USRP model you are using. +;tx_antenna= +;rx_antenna=RX2 + ; Settings for a USRP B100: ;device= @@ -271,6 +276,9 @@ master_clock_rate=32768000 txgain=40 ;frequency=234208000 channel=13C +; You can set what TX antenna to use. This will depend on the +; SDR device you are using. +;tx_antenna= ; Used for SFN with the UHD output [delaymanagement] diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index a4219af..5f3f61e 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -3,7 +3,7 @@ Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -244,6 +244,8 @@ static void parse_configfile( } sdr_device_config.txgain = pt.get("uhdoutput.txgain", 0.0); + sdr_device_config.tx_antenna = pt.get("uhdoutput.tx_antenna", ""); + sdr_device_config.rx_antenna = pt.get("uhdoutput.rx_antenna", "RX2"); sdr_device_config.rxgain = pt.get("uhdoutput.rxgain", 0.0); sdr_device_config.frequency = pt.get("uhdoutput.frequency", 0); std::string chan = pt.get("uhdoutput.channel", ""); @@ -295,6 +297,7 @@ static void parse_configfile( outputsoapy_conf.masterClockRate = pt.get("soapyoutput.master_clock_rate", 0); outputsoapy_conf.txgain = pt.get("soapyoutput.txgain", 0.0); + outputsoapy_conf.tx_antenna = pt.get("soapyoutput.tx_antenna", ""); outputsoapy_conf.lo_offset = pt.get("soapyoutput.lo_offset", 0.0); outputsoapy_conf.frequency = pt.get("soapyoutput.frequency", 0); std::string chan = pt.get("soapyoutput.channel", ""); @@ -421,9 +424,7 @@ void parse_args(int argc, char **argv, mod_settings_t& mod_settings) break; case 'o': mod_settings.tist_offset_s = strtod(optarg, NULL); -#if defined(HAVE_OUTPUT_UHD) mod_settings.sdr_device_config.enableSync = true; -#endif break; case 'm': mod_settings.dabMode = strtol(optarg, NULL, 0); @@ -445,6 +446,8 @@ void parse_args(int argc, char **argv, mod_settings_t& mod_settings) mod_settings.sdr_device_config.pps_src = "none"; mod_settings.sdr_device_config.pps_polarity = "pos"; mod_settings.useUHDOutput = true; +#else + throw std::invalid_argument("Cannot select UHD output, not compiled in!"); #endif break; case 'V': diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h index bcd5a39..bd1a518 100644 --- a/src/output/SDRDevice.h +++ b/src/output/SDRDevice.h @@ -53,6 +53,8 @@ using complexf = std::complex; struct SDRDeviceConfig { std::string device; std::string subDevice; // For UHD + std::string tx_antenna; + std::string rx_antenna; long masterClockRate = 32768000; unsigned sampleRate = 2048000; diff --git a/src/output/Soapy.cpp b/src/output/Soapy.cpp index 44f8f58..8ee420e 100644 --- a/src/output/Soapy.cpp +++ b/src/output/Soapy.cpp @@ -71,23 +71,32 @@ Soapy::Soapy(SDRDeviceConfig& config) : m_device->setMasterClockRate(m_conf.masterClockRate); etiLog.level(info) << "SoapySDR master clock rate set to " << + std::fixed << std::setprecision(4) << m_device->getMasterClockRate()/1000.0 << " kHz"; m_device->setSampleRate(SOAPY_SDR_TX, 0, m_conf.sampleRate); etiLog.level(info) << "SoapySDR:Actual TX rate: " << + std::fixed << std::setprecision(4) << m_device->getSampleRate(SOAPY_SDR_TX, 0) / 1000.0 << " ksps."; tune(m_conf.lo_offset, m_conf.frequency); m_conf.frequency = m_device->getFrequency(SOAPY_SDR_TX, 0); etiLog.level(info) << "SoapySDR:Actual frequency: " << - m_conf.frequency / 1000.0 << - " kHz."; + std::fixed << std::setprecision(3) << + m_conf.frequency / 1000.0 << " kHz."; m_device->setGain(SOAPY_SDR_TX, 0, m_conf.txgain); etiLog.level(info) << "SoapySDR:Actual tx gain: " << + std::fixed << std::setprecision(2) << m_device->getGain(SOAPY_SDR_TX, 0); + if (not m_conf.tx_antenna.empty()) { + m_device->setAntenna(SOAPY_SDR_TX, 0, m_conf.tx_antenna); + } + etiLog.level(info) << "SoapySDR:Actual tx antenna: " << + m_device->getAntenna(SOAPY_SDR_TX, 0); + const std::vector channels({0}); m_tx_stream = m_device->setupStream(SOAPY_SDR_TX, "CF32", channels); m_device->activateStream(m_tx_stream); diff --git a/src/output/UHD.cpp b/src/output/UHD.cpp index 8876b0e..2c571fd 100644 --- a/src/output/UHD.cpp +++ b/src/output/UHD.cpp @@ -159,10 +159,10 @@ UHD::UHD(SDRDeviceConfig& config) : tune(m_conf.lo_offset, m_conf.frequency); m_conf.frequency = m_usrp->get_tx_freq(); - etiLog.level(info) << std::fixed << std::setprecision(3) << + etiLog.level(debug) << std::fixed << std::setprecision(3) << "OutputUHD:Actual TX frequency: " << m_conf.frequency; - etiLog.level(info) << std::fixed << std::setprecision(3) << + etiLog.level(debug) << std::fixed << std::setprecision(3) << "OutputUHD:Actual RX frequency: " << m_usrp->get_tx_freq(); m_usrp->set_tx_gain(m_conf.txgain); @@ -175,18 +175,21 @@ UHD::UHD(SDRDeviceConfig& config) : m_usrp->set_rx_rate(m_conf.sampleRate); etiLog.log(debug, "OutputUHD:Actual RX Rate: %f sps.", m_usrp->get_rx_rate()); - m_usrp->set_rx_antenna("RX2"); - etiLog.log(debug, "OutputUHD:Set RX Antenna: %s", + if (not m_conf.rx_antenna.empty()) { + m_usrp->set_rx_antenna(m_conf.rx_antenna); + } + etiLog.log(debug, "OutputUHD:Actual RX Antenna: %s", m_usrp->get_rx_antenna().c_str()); + if (not m_conf.tx_antenna.empty()) { + m_usrp->set_tx_antenna(m_conf.tx_antenna); + } + etiLog.log(debug, "OutputUHD:Actual TX Antenna: %s", + m_usrp->get_tx_antenna().c_str()); + m_usrp->set_rx_gain(m_conf.rxgain); etiLog.log(debug, "OutputUHD:Actual RX Gain: %f", m_usrp->get_rx_gain()); - /* TODO - uhdFeedback = std::make_shared( - m_usrp, m_conf.dpdFeedbackServerPort, m_conf.sampleRate); - */ - const uhd::stream_args_t stream_args("fc32"); //complex floats m_rx_stream = m_usrp->get_rx_stream(stream_args); m_tx_stream = m_usrp->get_tx_stream(stream_args); -- cgit v1.2.3