mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-05 14:47:50 -04:00
PlutoSDR: debug (3)
This commit is contained in:
parent
ceb304cb9f
commit
04d06085fe
@ -19,8 +19,8 @@
|
|||||||
const uint64_t DevicePlutoSDR::loLowLimitFreq = 70000000UL; // 70 MHz: take AD9364 specs
|
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::loHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs
|
||||||
|
|
||||||
const uint32_t DevicePlutoSDR::srLowLimitFreq = 521000U; // 521 kS/s
|
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
|
const uint32_t DevicePlutoSDR::srHighLimitFreq = 20000000U; // 20 MS/s: take AD9363 speces
|
||||||
|
|
||||||
const uint32_t DevicePlutoSDR::bbLPRxLowLimitFreq = 200000U; // 200 kHz
|
const uint32_t DevicePlutoSDR::bbLPRxLowLimitFreq = 200000U; // 200 kHz
|
||||||
const uint32_t DevicePlutoSDR::bbLPRxHighLimitFreq = 14000000U; // 14 MHz
|
const uint32_t DevicePlutoSDR::bbLPRxHighLimitFreq = 14000000U; // 14 MHz
|
||||||
|
@ -409,16 +409,11 @@ bool DevicePlutoSDRBox::parseSampleRates(const std::string& rateStr, SampleRates
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
sampleRates.m_bbRateHz = boost::lexical_cast<uint32_t>(desc_match[1]);
|
sampleRates.m_bbRateHz = boost::lexical_cast<uint32_t>(desc_match[1]);
|
||||||
sampleRates.m_addaConnvRateBPS = boost::lexical_cast<uint32_t>(desc_match[2]);
|
sampleRates.m_addaConnvRate = boost::lexical_cast<uint32_t>(desc_match[2]);
|
||||||
sampleRates.m_hb3RateBPS = boost::lexical_cast<uint32_t>(desc_match[3]);
|
sampleRates.m_hb3Rate = boost::lexical_cast<uint32_t>(desc_match[3]);
|
||||||
sampleRates.m_hb2RateBPS = boost::lexical_cast<uint32_t>(desc_match[4]);
|
sampleRates.m_hb2Rate = boost::lexical_cast<uint32_t>(desc_match[4]);
|
||||||
sampleRates.m_hb1RateBPS = boost::lexical_cast<uint32_t>(desc_match[5]);
|
sampleRates.m_hb1Rate = boost::lexical_cast<uint32_t>(desc_match[5]);
|
||||||
sampleRates.m_firRateBPS = boost::lexical_cast<uint32_t>(desc_match[6]);
|
sampleRates.m_firRate = boost::lexical_cast<uint32_t>(desc_match[6]);
|
||||||
sampleRates.m_addaConnvRateSS = sampleRates.m_addaConnvRateBPS / 4;
|
|
||||||
sampleRates.m_hb3RateSS = sampleRates.m_hb3RateBPS / 4;
|
|
||||||
sampleRates.m_hb2RateSS = sampleRates.m_hb2RateBPS / 4;
|
|
||||||
sampleRates.m_hb1RateSS = sampleRates.m_hb1RateBPS / 4;
|
|
||||||
sampleRates.m_firRateSS = sampleRates.m_firRateBPS / 4;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (const boost::bad_lexical_cast &e)
|
catch (const boost::bad_lexical_cast &e)
|
||||||
@ -437,11 +432,11 @@ void DevicePlutoSDRBox::setSampleRate(uint32_t sampleRate)
|
|||||||
{
|
{
|
||||||
char buff[100];
|
char buff[100];
|
||||||
std::vector<std::string> params;
|
std::vector<std::string> params;
|
||||||
snprintf(buff, sizeof(buff), "in_voltage_sampling_frequency=%d", sampleRate*4); // expressed in bytes per second
|
snprintf(buff, sizeof(buff), "in_voltage_sampling_frequency=%d", sampleRate);
|
||||||
params.push_back(std::string(buff));
|
params.push_back(std::string(buff));
|
||||||
snprintf(buff, sizeof(buff), "out_voltage_sampling_frequency=%d", sampleRate*4); // expressed in bytes per second
|
snprintf(buff, sizeof(buff), "out_voltage_sampling_frequency=%d", sampleRate);
|
||||||
params.push_back(std::string(buff));
|
params.push_back(std::string(buff));
|
||||||
set_params(DEVICE_PHY, params); // set end point frequency first
|
set_params(DEVICE_PHY, params);
|
||||||
m_devSampleRate = sampleRate;
|
m_devSampleRate = sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,10 +466,10 @@ void DevicePlutoSDRBox::setFIR(uint32_t log2IntDec, uint32_t bw, int gain)
|
|||||||
|
|
||||||
setFIREnable(false); // disable again
|
setFIREnable(false); // disable again
|
||||||
|
|
||||||
uint32_t nbGroups = sampleRates.m_addaConnvRateBPS / 16;
|
uint32_t nbGroups = sampleRates.m_addaConnvRate / 16;
|
||||||
nbTaps = nbGroups*8 > 128 ? 128 : nbGroups*8;
|
nbTaps = nbGroups*8 > 128 ? 128 : nbGroups*8;
|
||||||
nbTaps = intdec == 1 ? (nbTaps > 64 ? 64 : nbTaps) : nbTaps;
|
nbTaps = intdec == 1 ? (nbTaps > 64 ? 64 : nbTaps) : nbTaps;
|
||||||
normalizedBW = ((float) bw) / sampleRates.m_hb1RateBPS;
|
normalizedBW = ((float) bw) / sampleRates.m_hb1Rate;
|
||||||
normalizedBW = normalizedBW < 0.1 ? 0.1 : normalizedBW > 0.9 ? 0.9 : normalizedBW;
|
normalizedBW = normalizedBW < 0.1 ? 0.1 : normalizedBW > 0.9 ? 0.9 : normalizedBW;
|
||||||
|
|
||||||
qDebug("DevicePlutoSDRBox::setFIR: intdec: %u gain: %d nbTaps: %u BWin: %u BW: %f (%f)",
|
qDebug("DevicePlutoSDRBox::setFIR: intdec: %u gain: %d nbTaps: %u BWin: %u BW: %f (%f)",
|
||||||
@ -482,7 +477,7 @@ void DevicePlutoSDRBox::setFIR(uint32_t log2IntDec, uint32_t bw, int gain)
|
|||||||
gain,
|
gain,
|
||||||
nbTaps,
|
nbTaps,
|
||||||
bw,
|
bw,
|
||||||
normalizedBW*sampleRates.m_hb1RateBPS,
|
normalizedBW*sampleRates.m_hb1Rate,
|
||||||
normalizedBW);
|
normalizedBW);
|
||||||
|
|
||||||
// set the right filter
|
// set the right filter
|
||||||
@ -542,6 +537,7 @@ void DevicePlutoSDRBox::getXO()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_xoInitial = boost::lexical_cast<int64_t>(valueStr);
|
m_xoInitial = boost::lexical_cast<int64_t>(valueStr);
|
||||||
|
qDebug("DevicePlutoSDRBox::getXO: %ld", m_xoInitial);
|
||||||
}
|
}
|
||||||
catch (const boost::bad_lexical_cast &e)
|
catch (const boost::bad_lexical_cast &e)
|
||||||
{
|
{
|
||||||
|
@ -44,19 +44,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SampleRates {
|
struct SampleRates {
|
||||||
uint32_t m_bbRateHz; //!< Baseband PLL rate (Hz) - used internally
|
uint32_t m_bbRateHz; //!< Baseband PLL rate (Hz) - used internally
|
||||||
// bytes per second
|
uint32_t m_addaConnvRate; //!< A/D or D/A converter rat - this is the HB3 working sample rate
|
||||||
uint32_t m_addaConnvRateBPS; //!< A/D or D/A converter rat - this is the HB3 working sample rate
|
uint32_t m_hb3Rate; //!< Rate of the HB3/(DEC3 or INT3) filter (Rx: out, Tx: in) - this is the HB2 working sample rate
|
||||||
uint32_t m_hb3RateBPS; //!< Rate of the HB3/(DEC3 or INT3) filter (Rx: out, Tx: in) - this is the HB2 working sample rate
|
uint32_t m_hb2Rate; //!< Rate of the HB2 filter (Rx: out, Tx: in) - this is the HB1 working sample rate
|
||||||
uint32_t m_hb2RateBPS; //!< Rate of the HB2 filter (Rx: out, Tx: in) - this is the HB1 working sample rate
|
uint32_t m_hb1Rate; //!< Rate of the HB1 filter (Rx: out, Tx: in) - this is the FIR working sample rate
|
||||||
uint32_t m_hb1RateBPS; //!< Rate of the HB1 filter (Rx: out, Tx: in) - this is the FIR working sample rate
|
uint32_t m_firRate; //!< Rate of FIR filter (Rx: out, Tx: in) - this is the host/device communication sample rate
|
||||||
uint32_t m_firRateBPS; //!< Rate of FIR filter (Rx: out, Tx: in) - this is the host/device communication sample rate
|
|
||||||
// samples per second
|
|
||||||
uint32_t m_addaConnvRateSS; //!< A/D or D/A converter rat - this is the HB3 working sample rate
|
|
||||||
uint32_t m_hb3RateSS; //!< Rate of the HB3/(DEC3 or INT3) filter (Rx: out, Tx: in) - this is the HB2 working sample rate
|
|
||||||
uint32_t m_hb2RateSS; //!< Rate of the HB2 filter (Rx: out, Tx: in) - this is the HB1 working sample rate
|
|
||||||
uint32_t m_hb1RateSS; //!< Rate of the HB1 filter (Rx: out, Tx: in) - this is the FIR working sample rate
|
|
||||||
uint32_t m_firRateSS; //!< Rate of FIR filter (Rx: out, Tx: in) - this is the host/device communication sample rate
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64_t m_devSampleRate; //!< Host interface sample rate
|
uint64_t m_devSampleRate; //!< Host interface sample rate
|
||||||
|
@ -153,7 +153,7 @@ bool PlutoSDRInput::handleMessage(const Message& message)
|
|||||||
|
|
||||||
bool PlutoSDRInput::openDevice()
|
bool PlutoSDRInput::openDevice()
|
||||||
{
|
{
|
||||||
if (!m_sampleFifo.setSize(1<<19))
|
if (!m_sampleFifo.setSize(PLUTOSDR_BLOCKSIZE))
|
||||||
{
|
{
|
||||||
qCritical("PlutoSDRInput::openDevice: could not allocate SampleFifo");
|
qCritical("PlutoSDRInput::openDevice: could not allocate SampleFifo");
|
||||||
return false;
|
return false;
|
||||||
@ -323,16 +323,16 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
|||||||
(settings.m_lpfFIRGain != m_settings.m_lpfFIRGain) || force)
|
(settings.m_lpfFIRGain != m_settings.m_lpfFIRGain) || force)
|
||||||
{
|
{
|
||||||
plutoBox->setSampleRate(settings.m_devSampleRate); // set end point frequency first
|
plutoBox->setSampleRate(settings.m_devSampleRate); // set end point frequency first
|
||||||
plutoBox->setFIR(settings.m_lpfFIRlog2Decim, settings.m_lpfFIRBW, settings.m_lpfFIRGain);
|
//plutoBox->setFIR(settings.m_lpfFIRlog2Decim, settings.m_lpfFIRBW, settings.m_lpfFIRGain); // don't bother with the FIR at this point
|
||||||
plutoBox->setFIREnable(settings.m_lpfFIREnable); // eventually enable/disable FIR
|
//plutoBox->setFIREnable(settings.m_lpfFIREnable); // eventually enable/disable FIR
|
||||||
|
|
||||||
plutoBox->getRxSampleRates(m_deviceSampleRates); // pick up possible new rates
|
plutoBox->getRxSampleRates(m_deviceSampleRates); // pick up possible new rates
|
||||||
qDebug() << "PlutoSDRInput::applySettings: BBPLL(Hz): " << m_deviceSampleRates.m_bbRateHz
|
qDebug() << "PlutoSDRInput::applySettings: BBPLL(Hz): " << m_deviceSampleRates.m_bbRateHz
|
||||||
<< " ADC: " << m_deviceSampleRates.m_addaConnvRateSS
|
<< " ADC: " << m_deviceSampleRates.m_addaConnvRate
|
||||||
<< " -HB3-> " << m_deviceSampleRates.m_hb3RateSS
|
<< " -HB3-> " << m_deviceSampleRates.m_hb3Rate
|
||||||
<< " -HB2-> " << m_deviceSampleRates.m_hb2RateSS
|
<< " -HB2-> " << m_deviceSampleRates.m_hb2Rate
|
||||||
<< " -HB1-> " << m_deviceSampleRates.m_hb1RateSS
|
<< " -HB1-> " << m_deviceSampleRates.m_hb1Rate
|
||||||
<< " -FIR-> " << m_deviceSampleRates.m_firRateSS;
|
<< " -FIR-> " << m_deviceSampleRates.m_firRate;
|
||||||
|
|
||||||
forwardChangeOtherDSP = true;
|
forwardChangeOtherDSP = true;
|
||||||
forwardChangeOwnDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate);
|
forwardChangeOwnDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate);
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
virtual bool handleMessage(const Message& message);
|
virtual bool handleMessage(const Message& message);
|
||||||
|
|
||||||
uint32_t getADCSampleRate() const { return m_deviceSampleRates.m_addaConnvRateSS; }
|
uint32_t getADCSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; }
|
||||||
void getRSSI(std::string& rssiStr);
|
void getRSSI(std::string& rssiStr);
|
||||||
bool fetchTemperature();
|
bool fetchTemperature();
|
||||||
float getTemperature();
|
float getTemperature();
|
||||||
|
@ -27,7 +27,8 @@ PlutoSDRInputThread::PlutoSDRInputThread(uint32_t blocksize, DevicePlutoSDRBox*
|
|||||||
m_sampleFifo(sampleFifo),
|
m_sampleFifo(sampleFifo),
|
||||||
m_convertIt(m_convertBuffer.begin()),
|
m_convertIt(m_convertBuffer.begin()),
|
||||||
m_log2Decim(0),
|
m_log2Decim(0),
|
||||||
m_fcPos(PlutoSDRInputSettings::FC_POS_CENTER)
|
m_fcPos(PlutoSDRInputSettings::FC_POS_CENTER),
|
||||||
|
m_phasor(0)
|
||||||
{
|
{
|
||||||
m_buf = new qint16[blocksize*(sizeof(Sample)/sizeof(qint16))];
|
m_buf = new qint16[blocksize*(sizeof(Sample)/sizeof(qint16))];
|
||||||
}
|
}
|
||||||
@ -90,29 +91,11 @@ void PlutoSDRInputThread::run()
|
|||||||
|
|
||||||
for (p_dat = m_plutoBox->rxBufferFirst(); p_dat < p_end; p_dat += p_inc)
|
for (p_dat = m_plutoBox->rxBufferFirst(); p_dat < p_end; p_dat += p_inc)
|
||||||
{
|
{
|
||||||
m_buf[2*is] = ((int16_t*)p_dat)[0]; // Real (I)
|
memcpy(&m_buf[2*is], p_dat, 2*sizeof(int16_t));
|
||||||
m_buf[2*is+1] = ((int16_t*)p_dat)[1]; // Imag (Q)
|
is++;
|
||||||
|
|
||||||
if (is == 32768-1)
|
|
||||||
{
|
|
||||||
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++;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_sampleFifo->write((unsigned char *) m_buf, is*2*sizeof(int16_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
@ -48,7 +48,7 @@ private:
|
|||||||
bool m_running;
|
bool m_running;
|
||||||
|
|
||||||
DevicePlutoSDRBox *m_plutoBox;
|
DevicePlutoSDRBox *m_plutoBox;
|
||||||
qint16 *m_buf; // holds I+Q values of each sample
|
int16_t *m_buf; // holds I+Q values of each sample
|
||||||
uint32_t m_blockSize;
|
uint32_t m_blockSize;
|
||||||
SampleVector m_convertBuffer;
|
SampleVector m_convertBuffer;
|
||||||
SampleSinkFifo* m_sampleFifo;
|
SampleSinkFifo* m_sampleFifo;
|
||||||
@ -56,6 +56,7 @@ private:
|
|||||||
|
|
||||||
unsigned int m_log2Decim; // soft decimation
|
unsigned int m_log2Decim; // soft decimation
|
||||||
int m_fcPos;
|
int m_fcPos;
|
||||||
|
float m_phasor;
|
||||||
|
|
||||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user