LimeSDR: fixed amalog LP bandwidth filter and general calibration

This commit is contained in:
f4exb 2017-11-09 17:31:32 +01:00
parent c4e26bf66d
commit 23b9450c56
2 changed files with 58 additions and 42 deletions

View File

@ -637,6 +637,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
bool forwardClockSource = false;
bool ownThreadWasRunning = false;
bool doCalibration = false;
bool doLPCalibration = false;
double clockGenFreq = 0.0;
// QMutexLocker mutexLocker(&m_mutex);
@ -713,18 +714,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
{
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (LMS_SetLPFBW(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_TX,
m_deviceShared.m_channel,
settings.m_lpfBW) < 0)
{
qCritical("LimeSDROutput::applySettings: could not set LPF to %f Hz", settings.m_lpfBW);
}
else
{
//doCalibration = true;
qDebug("LimeSDROutput::applySettings: LPF set to %f Hz", settings.m_lpfBW);
}
doLPCalibration = true;
}
}
@ -869,7 +859,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
doCalibration = doCalibration || (clockGenFreqAfter != clockGenFreq);
}
if (doCalibration && m_channelAcquired)
if ((doCalibration || doLPCalibration) && m_channelAcquired)
{
if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning())
{
@ -880,17 +870,35 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
suspendRxBuddies();
suspendTxBuddies();
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_TX,
m_deviceShared.m_channel,
m_settings.m_lpfBW,
0) < 0)
if (doCalibration)
{
qCritical("LimeSDROutput::applySettings: calibration failed on Tx channel %d", m_deviceShared.m_channel);
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_TX,
m_deviceShared.m_channel,
m_settings.m_devSampleRate,
0) < 0)
{
qCritical("LimeSDROutput::applySettings: calibration failed on Tx channel %d", m_deviceShared.m_channel);
}
else
{
qDebug("LimeSDROutput::applySettings: calibration successful on Tx channel %d", m_deviceShared.m_channel);
}
}
else
else if (doLPCalibration)
{
qDebug("LimeSDROutput::applySettings: calibration successful on Tx channel %d", m_deviceShared.m_channel);
if (LMS_SetLPFBW(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_TX,
m_deviceShared.m_channel,
m_settings.m_lpfBW) < 0)
{
qCritical("LimeSDROutput::applySettings: could not set LPF to %f Hz", m_settings.m_lpfBW);
}
else
{
//doCalibration = true;
qDebug("LimeSDROutput::applySettings: LPF set to %f Hz", m_settings.m_lpfBW);
}
}
resumeTxBuddies();

View File

@ -669,6 +669,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
bool forwardClockSource = false;
bool ownThreadWasRunning = false;
bool doCalibration = false;
bool doLPCalibration = false;
bool setAntennaAuto = false;
double clockGenFreq = 0.0;
// QMutexLocker mutexLocker(&m_mutex);
@ -863,18 +864,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
{
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (LMS_SetLPFBW(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
settings.m_lpfBW) < 0)
{
qCritical("LimeSDRInput::applySettings: could not set LPF to %f Hz", settings.m_lpfBW);
}
else
{
doCalibration = true;
qDebug("LimeSDRInput::applySettings: LPF set to %f Hz", settings.m_lpfBW);
}
doLPCalibration = true;
}
}
@ -1021,7 +1011,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
doCalibration = doCalibration || (clockGenFreqAfter != clockGenFreq);
}
if (doCalibration)
if (doCalibration || doLPCalibration)
{
if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning())
{
@ -1032,17 +1022,35 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
suspendRxBuddies();
suspendTxBuddies();
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
m_settings.m_lpfBW,
0) < 0)
if (doCalibration)
{
qCritical("LimeSDRInput::applySettings: calibration failed on Rx channel %d", m_deviceShared.m_channel);
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
m_settings.m_devSampleRate,
0) < 0)
{
qCritical("LimeSDRInput::applySettings: calibration failed on Rx channel %d", m_deviceShared.m_channel);
}
else
{
qDebug("LimeSDRInput::applySettings: calibration successful on Rx channel %d", m_deviceShared.m_channel);
}
}
else
else if (doLPCalibration)
{
qDebug("LimeSDRInput::applySettings: calibration successful on Rx channel %d", m_deviceShared.m_channel);
if (LMS_SetLPFBW(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
m_settings.m_lpfBW) < 0)
{
qCritical("LimeSDRInput::applySettings: could not set LPF to %f Hz", m_settings.m_lpfBW);
}
else
{
doCalibration = true;
qDebug("LimeSDRInput::applySettings: LPF set to %f Hz", m_settings.m_lpfBW);
}
}
resumeTxBuddies();