PlutoSDR input: debug (2)

This commit is contained in:
f4exb 2017-09-09 10:44:42 +02:00
parent aa047c77cc
commit f38e7704ad
5 changed files with 24 additions and 15 deletions

View File

@ -132,6 +132,10 @@ void DevicePlutoSDRBox::set_params(DeviceType devType,
}
std::cerr << "DevicePlutoSDRBox::set_params: Unable to write " << item << " attribute " << key << "=" << val << ": " << ret << std::endl;
}
else
{
std::cerr << "DevicePlutoSDRBox::set_params: set attribute " << key << "=" << val << ": " << ret << std::endl;
}
}
}

View File

@ -153,7 +153,7 @@ bool PlutoSDRInput::handleMessage(const Message& message)
bool PlutoSDRInput::openDevice()
{
if (!m_sampleFifo.setSize(96000 * 4))
if (!m_sampleFifo.setSize(1<<19))
{
qCritical("PlutoSDRInput::openDevice: could not allocate SampleFifo");
return false;
@ -368,7 +368,6 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
{
std::vector<std::string> params;
params.push_back(QString(tr("out_altvoltage0_RX_LO_frequency=%1").arg(settings.m_centerFrequency)).toStdString());
paramsToSet = true;
forwardChangeOwnDSP = true;
@ -376,14 +375,12 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
{
std::vector<std::string> params;
params.push_back(QString(tr("in_voltage_rf_bandwidth=%1").arg(settings.m_lpfBW)).toStdString());
paramsToSet = true;
}
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
{
std::vector<std::string> params;
QString rfPortStr;
PlutoSDRInputSettings::translateRFPath(settings.m_antennaPath, rfPortStr);
params.push_back(QString(tr("in_voltage0_rf_port_select=%1").arg(rfPortStr)).toStdString());
@ -392,7 +389,6 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
if ((m_settings.m_gainMode != settings.m_gainMode) || force)
{
std::vector<std::string> params;
QString gainModeStr;
PlutoSDRInputSettings::translateGainMode(settings.m_gainMode, gainModeStr);
params.push_back(QString(tr("in_voltage0_gain_control_mode=%1").arg(gainModeStr)).toStdString());
@ -401,7 +397,6 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
if ((m_settings.m_gain != settings.m_gain) || force)
{
std::vector<std::string> params;
params.push_back(QString(tr("in_voltage0_hardwaregain=%1").arg(settings.m_gain)).toStdString());
paramsToSet = true;
}

View File

@ -34,7 +34,7 @@ void PlutoSDRInputSettings::resetToDefaults()
m_devSampleRate = 2500 * 1000;
m_dcBlock = false;
m_iqCorrection = false;
m_lpfBW = 1500000.0f;
m_lpfBW = 1500000;
m_lpfFIREnable = false;
m_lpfFIRBW = 500000U;
m_lpfFIRlog2Decim = 0;
@ -54,7 +54,7 @@ QByteArray PlutoSDRInputSettings::serialize() const
s.writeS32(5, m_fcPos);
s.writeBool(7, m_dcBlock);
s.writeBool(8, m_iqCorrection);
s.writeFloat(9, m_lpfBW);
s.writeU32(9, m_lpfBW);
s.writeBool(10, m_lpfFIREnable);
s.writeU32(11, m_lpfFIRBW);
s.writeU64(12, m_devSampleRate);
@ -97,7 +97,7 @@ bool PlutoSDRInputSettings::deserialize(const QByteArray& data)
}
d.readBool(7, &m_dcBlock, false);
d.readBool(8, &m_iqCorrection, false);
d.readFloat(9, &m_lpfBW, 1500000.0f);
d.readU32(9, &m_lpfBW, 1500000);
d.readBool(10, &m_lpfFIREnable, false);
d.readU32(11, &m_lpfFIRBW, 500000U);
d.readU64(12, &m_devSampleRate, 1536000U);

View File

@ -66,8 +66,8 @@ struct PlutoSDRInputSettings {
bool m_dcBlock;
bool m_iqCorrection;
quint32 m_log2Decim;
float m_lpfBW; //!< analog lowpass filter bandwidth (Hz)
uint32_t m_gain; //!< "hardware" gain
quint32 m_lpfBW; //!< analog lowpass filter bandwidth (Hz)
quint32 m_gain; //!< "hardware" gain
RFPath m_antennaPath;
GainMode m_gainMode;

View File

@ -23,7 +23,7 @@ PlutoSDRInputThread::PlutoSDRInputThread(uint32_t blocksize, DevicePlutoSDRBox*
m_running(false),
m_plutoBox(plutoBox),
m_blockSize(blocksize),
m_convertBuffer(blocksize),
m_convertBuffer(1<<15),
m_sampleFifo(sampleFifo),
m_convertIt(m_convertBuffer.begin()),
m_log2Decim(0),
@ -81,7 +81,7 @@ void PlutoSDRInputThread::run()
// Refill RX buffer
nbytes_rx = m_plutoBox->rxBufferRefill();
if (nbytes_rx < 0) { qWarning("Error refilling buf %d\n",(int) nbytes_rx); break; }
if (nbytes_rx < 0) { qWarning("PlutoSDRInputThread::run: error refilling buf %d\n",(int) nbytes_rx); break; }
// READ: Get pointers to RX buf and read IQ from RX buf port 0
p_inc = m_plutoBox->rxBufferStep();
@ -93,15 +93,25 @@ void PlutoSDRInputThread::run()
m_buf[2*is] = ((int16_t*)p_dat)[0]; // Real (I)
m_buf[2*is+1] = ((int16_t*)p_dat)[1]; // Imag (Q)
if (is == ((1<<m_log2Decim) - 1))
if (is == 32768-1)
{
convert(); // I+Q -> 2
m_sampleFifo->write((unsigned char *) m_buf, 32768*4);
is = 0;
}
else
{
is++;
}
// if (is == ((1<<m_log2Decim) - 1))
// {
// convert(); // I+Q -> 2
// is = 0;
// }
// else
// {
// is++;
// }
}
}