Skip to content

Commit

Permalink
Merge pull request #1391 from srcejon/fix_1389
Browse files Browse the repository at this point in the history
Lime - Partially implement #1389
  • Loading branch information
f4exb authored Aug 21, 2022
2 parents 044af0d + 6ef8415 commit 3c7e797
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
5 changes: 3 additions & 2 deletions plugins/samplesink/limesdroutput/limesdroutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,11 +1066,12 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo

if (doCalibration)
{
double bw = std::min((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_TX,
m_deviceShared.m_channel,
m_settings.m_devSampleRate,
0) < 0)
bw,
0) != 0)
{
qCritical("LimeSDROutput::applySettings: calibration failed on Tx channel %d", m_deviceShared.m_channel);
}
Expand Down
6 changes: 5 additions & 1 deletion plugins/samplesink/limesdroutput/limesdroutputgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ void LimeSDROutputGUI::updateFrequencyLimits()
m_limeSDROutput->getLORange(minF, maxF);
qint64 minLimit = minF/1000 + deltaFrequency;
qint64 maxLimit = maxF/1000 + deltaFrequency;
// Min freq is 30MHz - NCO must be used to go below this
qint64 minFreq = m_settings.m_ncoEnable ? 30000 + m_settings.m_ncoFrequency/1000 : 30000;

minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
minLimit = minLimit < minFreq ? minFreq : minLimit > 9999999 ? 9999999 : minLimit;
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;

qDebug("LimeSDROutputGUI::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
Expand Down Expand Up @@ -515,13 +517,15 @@ void LimeSDROutputGUI::on_centerFrequency_changed(quint64 value)
void LimeSDROutputGUI::on_ncoFrequency_changed(qint64 value)
{
m_settings.m_ncoFrequency = value;
updateFrequencyLimits();
setCenterFrequencyDisplay();
sendSettings();
}

void LimeSDROutputGUI::on_ncoEnable_toggled(bool checked)
{
m_settings.m_ncoEnable = checked;
updateFrequencyLimits();
setCenterFrequencyDisplay();
sendSettings();
}
Expand Down
4 changes: 4 additions & 0 deletions plugins/samplesink/limesdroutput/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Transmission latency depends essentially in the delay in the sample FIFO. The si

This is the center frequency of transmission in kHz.

The NCO must be enabled with a negative value in order to set this below 30MHz.

<h3>3A: Center frequency units</h3>

This is the center frequency units thus kHz (fixed)
Expand Down Expand Up @@ -171,6 +173,8 @@ The LMS7002M uses the same clock for both the ADCs and DACs therefore this sampl

This is the Tx hardware filter bandwidth in kHz in the LMS7002M device for the given channel. Boundaries are updated automatically but generally are from 5 to 130 MHz in 1 kHz steps. Use the wheels to adjust the value. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2.

The filter is centered at the LO frequency, so if using the NCO to achieve frequencies below 30MHz, the filter bandwidth needs to be set wide enough for not only your desired signal but the offset from the 30MHz LO as well.

<h3>12: TSP FIR filter toggle</h3>

The TSP in the LMS7002M chip has a FIR filter chain per channel. Use this button to activate or deactivate the TSP FIR filter.
Expand Down
5 changes: 3 additions & 2 deletions plugins/samplesource/limesdrinput/limesdrinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,11 +1227,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc

if (doCalibration)
{
double bw = std::min((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
m_settings.m_devSampleRate,
0) < 0)
bw,
0) != 0)
{
qCritical("LimeSDRInput::applySettings: calibration failed on Rx channel %d", m_deviceShared.m_channel);
}
Expand Down
6 changes: 5 additions & 1 deletion plugins/samplesource/limesdrinput/limesdrinputgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,10 @@ void LimeSDRInputGUI::updateFrequencyLimits()
m_limeSDRInput->getLORange(minF, maxF);
qint64 minLimit = minF/1000 + deltaFrequency;
qint64 maxLimit = maxF/1000 + deltaFrequency;
// Min freq is 30MHz - NCO must be used to go below this
qint64 minFreq = m_settings.m_ncoEnable ? 30000 + m_settings.m_ncoFrequency/1000 : 30000;

minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
minLimit = minLimit < minFreq ? minFreq : minLimit > 9999999 ? 9999999 : minLimit;
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;

qDebug("LimeSDRInputGUI::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
Expand Down Expand Up @@ -548,13 +550,15 @@ void LimeSDRInputGUI::on_centerFrequency_changed(quint64 value)
void LimeSDRInputGUI::on_ncoFrequency_changed(qint64 value)
{
m_settings.m_ncoFrequency = value;
updateFrequencyLimits();
setCenterFrequencyDisplay();
sendSettings();
}

void LimeSDRInputGUI::on_ncoEnable_toggled(bool checked)
{
m_settings.m_ncoEnable = checked;
updateFrequencyLimits();
setCenterFrequencyDisplay();
sendSettings();
}
Expand Down
4 changes: 4 additions & 0 deletions plugins/samplesource/limesdrinput/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ The top and bottom bars of the device window are described [here](../../../sdrgu

This is the center frequency of reception in kHz.

The NCO must be enabled with a negative value in order to set this below 30MHz.

<h4>1.2: Start/Stop</h4>

Device start / stop button.
Expand Down Expand Up @@ -133,6 +135,8 @@ The LMS7002M uses the same clock for both the ADCs and DACs therefore this sampl

This is the Rx hardware filter bandwidth in kHz in the LMS7002M device for the given channel. Boundaries are updated automatically but generally are from 1.4 to 130 MHz in 1 kHz steps. Use the wheels to adjust the value. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2.

The filter is centered at the LO frequency, so if using the NCO to achieve frequencies below 30MHz, the filter bandwidth needs to be set wide enough for not only your desired signal but the offset from the 30MHz LO as well.

<h4>7.2: TSP FIR filter toggle</h4>

The TSP in the LMS7002M chip has a FIR filter chain per channel. Use this button to activate or deactivate the TSP FIR filter.
Expand Down

0 comments on commit 3c7e797

Please sign in to comment.