XTRX output: implemented baseband or device sample rate input option

This commit is contained in:
f4exb 2019-04-10 22:10:49 +02:00
parent 719f04493a
commit c94b7ccbe2
9 changed files with 108 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

View File

@ -154,7 +154,11 @@ Use this toggle button to switch the sample rate input next (10) between host to
- **SR**: host to device sample rate input mode. The baseband sample rate (2B) is the host to device sample rate (10) divided by the software interpolation factor (9).
- **BB**: baseband sample rate input mode. The host to device sample rate (2B) is the baseband sample rate (8) multiplied by the software interpolation factor (9).
<h3>10: Host to device stream sample rate</h3>
<h3>10: Sample rate</h3>
This is the LMS7002M device to/from host stream sample rate or baseband sample rate in samples per second (S/s). The control (10A) is used to switch between the two input modes. The device to/from host stream sample rate is the same for the Rx and Tx systems.
The limits are adjusted automatically. In baseband input mode the limits are driven by the interpolation factor (9). You may need to increase this interpolation factor to be able to reach lower values.
This is the LMS7002M device to/from host stream sample rate in S/s. It is the same for the Rx and Tx systems.

View File

@ -65,10 +65,11 @@ This is the center frequency of transmission in kHz.
LimeSDR is a 2x2 MIMO device so it has two transmitting channels. This shows the corresponding Tx channel index (0 or 1).
<h3>5: Stream sample rate</h3>
Baseband I/Q sample rate in kS/s. This is the device to host sample rate (11) divided by the software interpolation factor (10).
In host to device sample rate input mode (11A) this is the baseband I/Q sample rate in kS/s. This is the host to device sample rate (11) divided by the software interpolation factor (10).
In baseband sample rate input mode (11A) this is the host to device sample rate in kS/s. This is the baseband sample rate (11) multiplied by the software interpolation factor (10)
<h3>6: NCO toggle</h3>
@ -118,9 +119,18 @@ The first position in the combo is marked as "A". This is because interpolation
The I/Q stream from the baseband is upsampled by a power of two by software inside the plugin before being sent to the LimeSDR device. Possible values are increasing powers of two: 1 (no interpolation), 2, 4, 8, 16, 32.
<h3>11: Host to device stream sample rate</h3>
<h3>11A: Host to device sample rate / Baseband sample rate input toggle</h3>
This is the LMS7002M device to/from host stream sample rate in S/s. It is the same for the Rx and Tx systems.
Use this toggle button to switch the sample rate input next (10) between host to device sample rate and baseband sample rate input. The button shows the current mode:
- **SR**: host to device sample rate input mode. The baseband sample rate (5) is the host to device sample rate (11) divided by the software interpolation factor (10).
- **BB**: baseband sample rate input mode. The host to device sample rate (5) is the baseband sample rate (11) multiplied by the software interpolation factor (10).
<h3>11: Sample rate</h3>
This is the LMS7002M device to/from host stream sample rate or baseband sample rate in samples per second (S/s). The control (11A) is used to switch between the two input modes. The device to/from host stream sample rate is the same for the Rx and Tx systems.
The limits are adjusted automatically. In baseband input mode the limits are driven by the interpolation factor (10). You may need to increase this interpolation factor to be able to reach lower values.
Use the wheels to adjust the sample rate. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows.

View File

@ -35,6 +35,7 @@ XTRXOutputGUI::XTRXOutputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
ui(new Ui::XTRXOutputGUI),
m_deviceUISet(deviceUISet),
m_settings(),
m_sampleRateMode(true),
m_sampleRate(0),
m_lastEngineState((DSPDeviceSinkEngine::State)-1),
m_doApplySettings(true),
@ -275,7 +276,39 @@ void XTRXOutputGUI::updateSampleRateAndFrequency()
{
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateLabel->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5)));
displaySampleRate();
}
void XTRXOutputGUI::displaySampleRate()
{
float minF, maxF, stepF;
m_XTRXOutput->getSRRange(minF, maxF, stepF);
ui->sampleRate->blockSignals(true);
if (m_sampleRateMode)
{
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }");
ui->sampleRateMode->setText("SR");
ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF);
ui->sampleRate->setValue(m_settings.m_devSampleRate);
ui->sampleRate->setToolTip("Device to host sample rate (S/s)");
ui->deviceRateText->setToolTip("Baseband sample rate (S/s)");
uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp);
ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5)));
}
else
{
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }");
ui->sampleRateMode->setText("BB");
ui->sampleRate->setValueRange(8, (uint32_t) minF/(1<<m_settings.m_log2SoftInterp), (uint32_t) maxF/(1<<m_settings.m_log2SoftInterp));
ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp));
ui->sampleRate->setToolTip("Baseband sample rate (S/s)");
ui->deviceRateText->setToolTip("Device to host sample rate (S/s)");
ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5)));
}
ui->sampleRate->blockSignals(false);
}
void XTRXOutputGUI::displaySettings()
@ -284,7 +317,7 @@ void XTRXOutputGUI::displaySettings()
ui->extClock->setExternalClockActive(m_settings.m_extClock);
setCenterFrequencyDisplay();
ui->sampleRate->setValue(m_settings.m_devSampleRate);
displaySampleRate();
ui->hwInterp->setCurrentIndex(m_settings.m_log2HardInterp);
ui->swInterp->setCurrentIndex(m_settings.m_log2SoftInterp);
@ -454,16 +487,24 @@ void XTRXOutputGUI::on_ncoEnable_toggled(bool checked)
void XTRXOutputGUI::on_sampleRate_changed(quint64 value)
{
m_settings.m_devSampleRate = value;
if (m_sampleRateMode) {
m_settings.m_devSampleRate = value;
} else {
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2SoftInterp);
}
updateDACRate();
setNCODisplay();
sendSettings();}
void XTRXOutputGUI::on_hwInterp_currentIndexChanged(int index)
{
if ((index <0) || (index > 5))
if ((index <0) || (index > 5)) {
return;
}
m_settings.m_log2HardInterp = index;
updateDACRate();
setNCODisplay();
sendSettings();
@ -471,9 +512,19 @@ void XTRXOutputGUI::on_hwInterp_currentIndexChanged(int index)
void XTRXOutputGUI::on_swInterp_currentIndexChanged(int index)
{
if ((index <0) || (index > 6))
if ((index <0) || (index > 6)) {
return;
}
m_settings.m_log2SoftInterp = index;
displaySampleRate();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftInterp);
}
sendSettings();
}
@ -510,6 +561,12 @@ void XTRXOutputGUI::on_pwrmode_currentIndexChanged(int index)
sendSettings();
}
void XTRXOutputGUI::on_sampleRateMode_toggled(bool checked)
{
m_sampleRateMode = checked;
displaySampleRate();
}
void XTRXOutputGUI::openDeviceSettingsDialog(const QPoint& p)
{
BasicDeviceSettingsDialog dialog(this);

View File

@ -56,6 +56,7 @@ private:
DeviceUISet* m_deviceUISet;
XTRXOutput* m_XTRXOutput; //!< Same object as above but gives easy access to XTRXInput methods and attributes that are used intensively
XTRXOutputSettings m_settings;
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
QTimer m_updateTimer;
QTimer m_statusTimer;
int m_sampleRate;
@ -68,6 +69,7 @@ private:
MessageQueue m_inputMessageQueue;
void displaySettings();
void displaySampleRate();
void setNCODisplay();
void setCenterFrequencyDisplay();
void setCenterFrequencySetting(uint64_t kHzValue);
@ -90,6 +92,7 @@ private slots:
void on_antenna_currentIndexChanged(int index);
void on_extClock_clicked();
void on_pwrmode_currentIndexChanged(int index);
void on_sampleRateMode_toggled(bool checked);
void updateHardware();
void updateStatus();

View File

@ -185,7 +185,7 @@
<item>
<layout class="QHBoxLayout" name="freqRightBotLayout">
<item>
<widget class="QLabel" name="deviceRateLabel">
<widget class="QLabel" name="deviceRateText">
<property name="minimumSize">
<size>
<width>54</width>
@ -433,16 +433,28 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QToolButton" name="sampleRateMode">
<property name="minimumSize">
<size>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>SR</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>

View File

@ -129,6 +129,7 @@ void XTRXOutputThread::run()
params.tx.chs = XTRX_CH_AB;
params.tx.wfmt = XTRX_WF_16;
params.tx.hfmt = XTRX_IQ_INT16;
params.tx.flags |= XTRX_RSP_SWAP_IQ;
if (m_nbChannels == 1)
{

View File

@ -117,9 +117,11 @@ Use this toggle button to switch the sample rate input next (8) between device t
- **SR**: device to host sample rate input mode. The baseband sample rate (1.5) is the device to host sample rate (6) divided by the software decimation factor (4).
- **BB**: baseband sample rate input mode. The device to host sample rate (1.5) is the baseband sample rate (8) multiplied by the software decimation factor (4).
<h3>6: Device to host stream sample rate</h3>
<h3>6: Sample rate</h3>
This is the LMS7002M device to/from host stream sample rate in S/s. It is the same for the Rx and Tx systems.
This is the LMS7002M device to/from host stream sample rate or baseband sample rate in samples per second (S/s). The control (5) is used to switch between the two input modes. The device to/from host stream sample rate is the same for the Rx and Tx systems.
The limits are adjusted automatically. In baseband input mode the limits are driven by the decimation factor (4). You may need to increase this decimation factor to be able to reach lower values.
Use the wheels to adjust the sample rate. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows.