diff --git a/devices/plutosdr/deviceplutosdr.cpp b/devices/plutosdr/deviceplutosdr.cpp index bc2c6cb01..c2242cfe4 100644 --- a/devices/plutosdr/deviceplutosdr.cpp +++ b/devices/plutosdr/deviceplutosdr.cpp @@ -16,8 +16,11 @@ #include "deviceplutosdr.h" -const uint64_t DevicePlutoSDR::loLowLimitFreq = 70000000UL; // 70 MHz: take AD9364 specs -const uint64_t DevicePlutoSDR::loHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs +const uint64_t DevicePlutoSDR::rxLOLowLimitFreq = 70000000UL; // 70 MHz: take AD9364 specs +const uint64_t DevicePlutoSDR::rxLOHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs + +const uint64_t DevicePlutoSDR::txLOLowLimitFreq = 46875000UL; // 46.875 MHz: take AD9364 specs +const uint64_t DevicePlutoSDR::txLOHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs const uint32_t DevicePlutoSDR::srLowLimitFreq = (25000000U/12U)+3U; // 25/12 MS/s without FIR interpolation/decimation (+3 so it is the next multiple of 4) const uint32_t DevicePlutoSDR::srHighLimitFreq = 20000000U; // 20 MS/s: take AD9363 speces diff --git a/devices/plutosdr/deviceplutosdr.h b/devices/plutosdr/deviceplutosdr.h index bef2503ab..30016ce36 100644 --- a/devices/plutosdr/deviceplutosdr.h +++ b/devices/plutosdr/deviceplutosdr.h @@ -36,8 +36,10 @@ public: DevicePlutoSDRBox* getDeviceFromURI(const std::string& uri); DevicePlutoSDRBox* getDeviceFromSerial(const std::string& serial); - static const uint64_t loLowLimitFreq; //!< LO lower frequency limit (Hz) - static const uint64_t loHighLimitFreq; //!< LO lower frequency limit (Hz) + static const uint64_t rxLOLowLimitFreq; //!< Rx LO hard coded lower frequency limit (Hz) + static const uint64_t rxLOHighLimitFreq; //!< Rx LO hard coded lower frequency limit (Hz) + static const uint64_t txLOLowLimitFreq; //!< Tx LO hard coded lower frequency limit (Hz) + static const uint64_t txLOHighLimitFreq; //!< Tx LO hard coded lower frequency limit (Hz) static const uint32_t srLowLimitFreq; //!< Device sample rate lower limit in S/s static const uint32_t srHighLimitFreq; //!< Device sample rate higher limit in S/s static const uint32_t bbLPRxLowLimitFreq; //!< Analog base band Rx low pass filter lower frequency limit (Hz) diff --git a/devices/plutosdr/deviceplutosdrbox.cpp b/devices/plutosdr/deviceplutosdrbox.cpp index 0bf1106a8..62ccb8c1c 100644 --- a/devices/plutosdr/deviceplutosdrbox.cpp +++ b/devices/plutosdr/deviceplutosdrbox.cpp @@ -713,22 +713,45 @@ bool DevicePlutoSDRBox::getTxRSSI(std::string& rssiStr, unsigned int chan) return get_param(DEVICE_PHY, buff, rssiStr); } -void DevicePlutoSDRBox::getRxLORange(uint64_t& minLimit, uint64_t& maxLimit, unsigned int chan) +void DevicePlutoSDRBox::getRxLORange(uint64_t& minLimit, uint64_t& maxLimit) { // values are returned in Hz qint64 stepLimit; std::string rangeStr; - chan = chan % 2; char buff[50]; - snprintf(buff, sizeof(buff), "out_altvoltage%i_RX_LO_frequency_available", chan); + snprintf(buff, sizeof(buff), "out_altvoltage0_RX_LO_frequency_available"); - if(get_param(DEVICE_PHY, buff, rangeStr)) { + if (get_param(DEVICE_PHY, buff, rangeStr)) + { std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2)); - instream >> minLimit >> stepLimit >> maxLimit; - } else { - minLimit = DevicePlutoSDR::loLowLimitFreq; - maxLimit = DevicePlutoSDR::loHighLimitFreq; + instream >> minLimit >> stepLimit >> maxLimit; + } + else + { + minLimit = DevicePlutoSDR::rxLOLowLimitFreq; + maxLimit = DevicePlutoSDR::rxLOHighLimitFreq; + } +} + +void DevicePlutoSDRBox::getTxLORange(uint64_t& minLimit, uint64_t& maxLimit) +{ + // values are returned in Hz + qint64 stepLimit; + std::string rangeStr; + + char buff[50]; + snprintf(buff, sizeof(buff), "out_altvoltage1_TX_LO_frequency_available"); + + if (get_param(DEVICE_PHY, buff, rangeStr)) + { + std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2)); + instream >> minLimit >> stepLimit >> maxLimit; + } + else + { + minLimit = DevicePlutoSDR::txLOLowLimitFreq; + maxLimit = DevicePlutoSDR::txLOHighLimitFreq; } } diff --git a/devices/plutosdr/deviceplutosdrbox.h b/devices/plutosdr/deviceplutosdrbox.h index 90467873c..16abfb4f3 100644 --- a/devices/plutosdr/deviceplutosdrbox.h +++ b/devices/plutosdr/deviceplutosdrbox.h @@ -105,7 +105,8 @@ public: bool getRxGain(int& gaindB, unsigned int chan); bool getRxRSSI(std::string& rssiStr, unsigned int chan); bool getTxRSSI(std::string& rssiStr, unsigned int chan); - void getRxLORange(uint64_t& minLimit, uint64_t& maxLimit, unsigned int chan); + void getRxLORange(uint64_t& minLimit, uint64_t& maxLimit); + void getTxLORange(uint64_t& minLimit, uint64_t& maxLimit); bool fetchTemp(); float getTemp() const { return m_temp; } bool getRateGovernors(std::string& rateGovernors); diff --git a/plugins/samplesink/plutosdroutput/plutosdroutput.cpp b/plugins/samplesink/plutosdroutput/plutosdroutput.cpp index ec727f0a3..44c66faf6 100644 --- a/plugins/samplesink/plutosdroutput/plutosdroutput.cpp +++ b/plugins/samplesink/plutosdroutput/plutosdroutput.cpp @@ -590,6 +590,16 @@ void PlutoSDROutput::getRSSI(std::string& rssiStr) } } +void PlutoSDROutput::getLORange(qint64& minLimit, qint64& maxLimit) +{ + uint64_t min, max; + DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox(); + + plutoBox->getTxLORange(min, max); + minLimit = min; + maxLimit = max; +} + bool PlutoSDROutput::fetchTemperature() { DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox(); diff --git a/plugins/samplesink/plutosdroutput/plutosdroutput.h b/plugins/samplesink/plutosdroutput/plutosdroutput.h index abc20902d..502ef9384 100644 --- a/plugins/samplesink/plutosdroutput/plutosdroutput.h +++ b/plugins/samplesink/plutosdroutput/plutosdroutput.h @@ -122,6 +122,7 @@ public: uint32_t getDACSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; } uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; } void getRSSI(std::string& rssiStr); + void getLORange(qint64& minLimit, qint64& maxLimit); bool fetchTemperature(); float getTemperature(); diff --git a/plugins/samplesink/plutosdroutput/plutosdroutputgui.cpp b/plugins/samplesink/plutosdroutput/plutosdroutputgui.cpp index 68fd31011..d56ddb27c 100644 --- a/plugins/samplesink/plutosdroutput/plutosdroutputgui.cpp +++ b/plugins/samplesink/plutosdroutput/plutosdroutputgui.cpp @@ -393,10 +393,13 @@ void PlutoSDROutputGUI::setSampleRateLimits() void PlutoSDROutputGUI::updateFrequencyLimits() { + qint64 minLimit, maxLimit; // values in kHz qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0; - qint64 minLimit = DevicePlutoSDR::loLowLimitFreq/1000 + deltaFrequency; - qint64 maxLimit = DevicePlutoSDR::loHighLimitFreq/1000 + deltaFrequency; + ((PlutoSDROutput *) m_sampleSink)->getLORange(minLimit, maxLimit); + + minLimit = minLimit/1000 + deltaFrequency; + maxLimit = maxLimit/1000 + deltaFrequency; minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit; maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit; diff --git a/plugins/samplesource/plutosdrinput/plutosdrinput.cpp b/plugins/samplesource/plutosdrinput/plutosdrinput.cpp index 7c3fa8bc6..9632444b4 100644 --- a/plugins/samplesource/plutosdrinput/plutosdrinput.cpp +++ b/plugins/samplesource/plutosdrinput/plutosdrinput.cpp @@ -680,7 +680,7 @@ void PlutoSDRInput::getLORange(qint64& minLimit, qint64& maxLimit) uint64_t min, max; DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox(); - plutoBox->getRxLORange(min, max, 0); + plutoBox->getRxLORange(min, max); minLimit = min; maxLimit = max; }