Configuration for hardware version 0xD0
Some checks failed
Build / PC_Application_Ubuntu (push) Has been cancelled
Build / PC_Application_RPi5 (push) Has been cancelled
Build / PC_Application_Windows (push) Has been cancelled
Build / PC_Application_OSX (push) Has been cancelled
Build / PC_Application_OSX_13 (push) Has been cancelled
Build / Embedded_Firmware (push) Has been cancelled
HIL_Tests / Get_Repository (push) Has been cancelled
Unit_Tests / Tests (push) Has been cancelled
HIL_Tests / PC_Application_RPi5 (push) Has been cancelled
HIL_Tests / Embedded_Firmware (push) Has been cancelled
HIL_Tests / HIL (push) Has been cancelled

This commit is contained in:
Jan Käberich 2025-10-28 12:08:13 +01:00
parent 273dfa8037
commit be123420db
8 changed files with 322 additions and 1 deletions

View file

@ -0,0 +1,72 @@
#include "deviceconfigurationdialogvd0.h"
#include "ui_deviceconfigurationdialogvd0.h"
DeviceConfigurationDialogVD0::DeviceConfigurationDialogVD0(LibreVNADriver &dev, QWidget *parent) :
QDialog(parent),
ui(new Ui::DeviceConfigurationDialogVD0),
dev(dev)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
emit dev.acquireControl();
auto updateIF = [=]() {
auto ADCrate = ui->ADCRate->value();
ui->IF->setValue(ADCrate * ui->ADCphaseInc->value() / 65536);
};
connect(ui->ADCRate, &SIUnitEdit::valueChanged, this, updateIF);
connect(ui->ADCphaseInc, qOverload<int>(&QSpinBox::valueChanged), this, updateIF);
ui->ADCRate->setUnit("Hz");
ui->ADCRate->setPrefixes(" kM");
ui->ADCRate->setPrecision(5);
ui->IF->setUnit("Hz");
ui->IF->setPrefixes(" kM");
ui->IF->setPrecision(5);
ui->ADCRate->setValue(1496000);
ui->ADCphaseInc->setValue(10240);
updateIF();
connect(&dev, &LibreVNADriver::receivedPacket, this, [=](const Protocol::PacketInfo &p) {
if(p.type == Protocol::PacketType::DeviceConfiguration) {
updateGUI(p.deviceConfig);
}
});
dev.sendWithoutPayload(Protocol::PacketType::RequestDeviceConfiguration);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [=](){
updateDevice();
accept();
});
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=](){
reject();
});
}
DeviceConfigurationDialogVD0::~DeviceConfigurationDialogVD0()
{
dev.releaseControl();
delete ui;
}
void DeviceConfigurationDialogVD0::updateGUI(const Protocol::DeviceConfig &c)
{
ui->ADCRate->setValue(c.VD0.ADCrate);
ui->ADCphaseInc->setValue(c.VD0.DFTphaseInc);
ui->PLLSettlingDelay->setValue(c.VD0.PLLSettlingDelay);
}
void DeviceConfigurationDialogVD0::updateDevice()
{
Protocol::PacketInfo p;
p.type = Protocol::PacketType::DeviceConfiguration;
p.deviceConfig.VD0.ADCrate = ui->ADCRate->value();
p.deviceConfig.VD0.DFTphaseInc = ui->ADCphaseInc->value();
p.deviceConfig.VD0.PLLSettlingDelay = ui->PLLSettlingDelay->value();
dev.SendPacket(p);
}

View file

@ -0,0 +1,28 @@
#ifndef DEVICECONFIGURATIONDIALOGVD0_H
#define DEVICECONFIGURATIONDIALOGVD0_H
#include <QDialog>
#include "librevnadriver.h"
namespace Ui {
class DeviceConfigurationDialogVD0;
}
class DeviceConfigurationDialogVD0 : public QDialog
{
Q_OBJECT
public:
explicit DeviceConfigurationDialogVD0(LibreVNADriver &dev, QWidget *parent = nullptr);
~DeviceConfigurationDialogVD0();
private:
void updateGUI(const Protocol::DeviceConfig &c);
void updateDevice();
Ui::DeviceConfigurationDialogVD0 *ui;
LibreVNADriver &dev;
};
#endif // DEVICECONFIGURATIONDIALOGVD0_H

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceConfigurationDialogVD0</class>
<widget class="QDialog" name="DeviceConfigurationDialogVD0">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>421</width>
<height>314</height>
</rect>
</property>
<property name="windowTitle">
<string>Device Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>This dialog contains advanced system settings. It is recommended to leave them at default values unless you know what you are doing.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_15">
<property name="title">
<string>IF and ADC frequencies</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>ADC sample rate:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="SIUnitEdit" name="ADCRate">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_32">
<property name="text">
<string>DFT Phase increment:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="ADCphaseInc">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Phase increment per ADC sample. Together with the ADC sample rate this determines the frequency of the second IF&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>10240</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_33">
<property name="text">
<string>IF:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="SIUnitEdit" name="IF">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Other settings</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>PLL settling delay [us]:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="PLLSettlingDelay">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>SIUnitEdit</class>
<extends>QLineEdit</extends>
<header>CustomWidgets/siunitedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -219,6 +219,21 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
addInteger(VFE, "MCU temperature", sFE.temp_MCU);
addDouble(VFE, "eCal temperature", (double) sFE.temp_eCal / 100.0);
addDouble(VFE, "eCal heater power", (double) sFE.power_heater / 1000.0);
auto sD0 = e.p->status.VD0;
auto VD0 = new QTreeWidgetItem();
VD0->setData(2, Qt::DisplayRole, "VD0");
item->addChild(VD0);
addBool(VD0, "External reference available", sD0.extRefAvailable);
addBool(VD0, "External reference in use", sD0.extRefInUse);
addBool(VD0, "FPGA configured", sD0.FPGA_configured);
addBool(VD0, "Source locked", sD0.source_locked);
addBool(VD0, "LO locked", sD0.LO_locked);
addBool(VD0, "ADC overload", sD0.ADC_overload);
addBool(VD0, "Unlevel", sD0.unlevel);
addInteger(VD0, "MCU temperature", sD0.temp_MCU);
addInteger(VD0, "Supply voltage", sD0.supply_voltage);
addInteger(VD0, "Supply current", sD0.supply_current);
}
break;
case Protocol::PacketType::DeviceInfo: {
@ -311,6 +326,32 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
addEnum(VFE, "Reference gain", s.VFE.RefGain, {"1 V/V", "10 V/V", "20 V/V", "30 V/V", "40 V/V", "60 V/V", "80 V/V", "120 V/V", "157 V/V", "0.25 V/V"});
addEnum(VFE, "eCal state", s.VFE.eCal_state, {"Port", "Open", "Short", "Load"});
addDouble(VFE, "eCal target temperature", (double) s.VFE.eCal_target / 100.0);
auto VD0 = new QTreeWidgetItem();
VD0->setData(2, Qt::DisplayRole, "VD0");
item->addChild(VD0);
addBool(VD0, "High Source chip enable", s.VD0.SourceHighCE);
addInteger(VD0, "High Source power", s.VD0.SourceHighPower);
addEnum(VD0, "High Source lowpass", s.VD0.SourceHighLowpass, {"947 MHz", "1880 MHz", "3550 MHz", "None"});
addDouble(VD0, "High Source frequency", s.VD0.SourceHighFrequency);
addBool(VD0, "Low Source enable", s.VD0.SourceLowEN);
addEnum(VD0, "Low Source power", s.VD0.SourceLowPower, {"2 mA", "4 mA", "6 mA", "8 mA"});
addDouble(VD0, "Low Source frequency", s.VD0.SourceLowFrequency);
addDouble(VD0, "Attenuator", s.VD0.attenuator * 0.25);
addEnum(VD0, "Source band selection", s.VD0.SourceHighband, {"Low Source", "High Source"});
addEnum(VD0, "Port switch", s.VD0.PortSwitch, {"Port 1", "Port 2"});
addBool(VD0, "High LO chip enable", s.VD0.LOHighCE);
addDouble(VD0, "High LO frequency", s.VD0.LOHighFrequency);
addInteger(VD0, "High LO power", s.VD0.LOHighPower);
addBool(VD0, "Low LO enable", s.VD0.LOLowEN);
addEnum(VD0, "Low LO power", s.VD0.LOLowPower, {"2 mA", "4 mA", "6 mA", "8 mA"});
addDouble(VD0, "Low LO frequency", s.VD0.LOLowFrequency);
addEnum(VD0, "LO band selection", s.VD0.LOHighband, {"Low Source", "High Source"});
addBool(VD0, "Port 1 receiver enable", s.VD0.Port1EN);
addBool(VD0, "Port 2 receiver enable", s.VD0.Port2EN);
addBool(VD0, "Reference receiver enable", s.VD0.RefEN);
addInteger(VD0, "Samples", s.VD0.Samples);
addEnum(VD0, "Window type", s.VD0.WindowType, {"None", "Kaiser", "Hann", "Flattop"});
}
break;
case Protocol::PacketType::ManualStatus: {
@ -364,6 +405,24 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
addBool(VFE, "LO locked", s.VFE.LO_locked);
addDouble(VFE, "eCal temperature", (double) s.VFE.temp_eCal / 100.0);
addDouble(VFE, "eCal heater power", (double) s.VFE.power_heater / 1000.0);
auto VD0 = new QTreeWidgetItem();
VD0->setData(2, Qt::DisplayRole, "VD0");
item->addChild(VD0);
addInteger(VD0, "ADC port 1 minimum", s.VD0.port1min);
addInteger(VD0, "ADC port 1 maximum", s.VD0.port1max);
addInteger(VD0, "ADC port 2 minimum", s.VD0.port2min);
addInteger(VD0, "ADC port 2 maximum", s.VD0.port2max);
addInteger(VD0, "ADC reference minimum", s.VD0.refmin);
addInteger(VD0, "ADC reference maximum", s.VD0.refmax);
addDouble(VD0, "Port 1 real", s.VD0.port1real);
addDouble(VD0, "Port 1 imaginary", s.VD0.port1imag);
addDouble(VD0, "Port 2 real", s.VD0.port2real);
addDouble(VD0, "Port 2 imaginary", s.VD0.port2imag);
addDouble(VD0, "Reference real", s.VD0.refreal);
addDouble(VD0, "Reference imaginary", s.VD0.refimag);
addBool(VD0, "Source locked", s.VD0.source_locked);
addBool(VD0, "LO1 locked", s.VD0.LO_locked);
}
break;
case Protocol::PacketType::SpectrumAnalyzerSettings: {
@ -453,6 +512,7 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
addDouble(V1, "1.IF", s1.IF1, "Hz");
addInteger(V1, "ADC prescaler", s1.ADCprescaler);
addInteger(V1, "DFT phase increment", s1.DFTphaseInc);
addInteger(V1, "PLL settling delay", s1.PLLSettlingDelay);
auto sFF = e.p->deviceConfig.VFF;
auto VFF = new QTreeWidgetItem();
@ -473,6 +533,14 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
addBool(VFE, "PGA autogain", sFE.autogain);
addInteger(VFE, "Port gain", sFE.portGain);
addInteger(VFE, "Reference gain", sFE.refGain);
auto sD0 = e.p->deviceConfig.VD0;
auto VD0 = new QTreeWidgetItem();
VD0->setData(2, Qt::DisplayRole, "VD0");
item->addChild(VD0);
addInteger(VD0, "ADC rate", sD0.ADCrate);
addInteger(VD0, "DFT phase increment", sD0.DFTphaseInc);
addInteger(VD0, "PLL settling delay", sD0.PLLSettlingDelay);
}
break;
default:

View file

@ -8,6 +8,7 @@
#include "deviceconfigurationdialogv1.h"
#include "deviceconfigurationdialogvff.h"
#include "deviceconfigurationdialogvfe.h"
#include "deviceconfigurationdialogvd0.h"
#include "firmwareupdatedialog.h"
#include "frequencycaldialog.h"
#include "sourcecaldialog.h"
@ -161,6 +162,9 @@ LibreVNADriver::LibreVNADriver()
case 1:
d = new DeviceConfigurationDialogV1(*this);
break;
case 0xD0:
d = new DeviceConfigurationDialogVD0(*this);
break;
case 0xFE:
d = new DeviceConfigurationDialogVFE(*this);
break;
@ -236,7 +240,7 @@ LibreVNADriver::LibreVNADriver()
// set available actions for each hardware version
availableActions[0x01] = {manual, config, update, sep, srccal, recvcal, freqcal, sep2, log};
availableActions[0xD0] = {manual, update, sep, srccal, recvcal, freqcal, sep2, log};
availableActions[0xD0] = {manual, config, update, sep, srccal, recvcal, freqcal, sep2, log};
availableActions[0xE0] = {manual, update, sep, srccal, recvcal, freqcal, internalAlignment, sep2, log};
availableActions[0xFD] = {manual, update, sep, srccal, recvcal, freqcal, sep2, log};
availableActions[0xFE] = {manual, config, update, sep, srccal, recvcal, freqcal, sep2, log};

View file

@ -25,6 +25,7 @@ HEADERS += \
Device/LibreVNA/Compound/compounddriver.h \
Device/LibreVNA/amplitudecaldialog.h \
Device/LibreVNA/deviceconfigurationdialogv1.h \
Device/LibreVNA/deviceconfigurationdialogvd0.h \
Device/LibreVNA/deviceconfigurationdialogvfe.h \
Device/LibreVNA/deviceconfigurationdialogvff.h \
Device/LibreVNA/devicepacketlog.h \
@ -194,6 +195,7 @@ SOURCES += \
Device/LibreVNA/Compound/compounddriver.cpp \
Device/LibreVNA/amplitudecaldialog.cpp \
Device/LibreVNA/deviceconfigurationdialogv1.cpp \
Device/LibreVNA/deviceconfigurationdialogvd0.cpp \
Device/LibreVNA/deviceconfigurationdialogvfe.cpp \
Device/LibreVNA/deviceconfigurationdialogvff.cpp \
Device/LibreVNA/devicepacketlog.cpp \
@ -361,6 +363,7 @@ FORMS += \
Device/LibreVNA/amplitudecaldialog.ui \
Device/LibreVNA/automaticamplitudedialog.ui \
Device/LibreVNA/deviceconfigurationdialogv1.ui \
Device/LibreVNA/deviceconfigurationdialogvd0.ui \
Device/LibreVNA/deviceconfigurationdialogvfe.ui \
Device/LibreVNA/deviceconfigurationdialogvff.ui \
Device/LibreVNA/devicepacketlogview.ui \

View file

@ -28,6 +28,7 @@ SOURCES += \
../LibreVNA-GUI/CustomWidgets/tracesetselector.cpp \
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.cpp \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.cpp \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvd0.cpp \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvfe.cpp \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvff.cpp \
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.cpp \
@ -219,6 +220,7 @@ HEADERS += \
../LibreVNA-GUI/CustomWidgets/tracesetselector.h \
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.h \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.h \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvd0.h \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvfe.h \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvff.h \
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.h \
@ -396,6 +398,7 @@ FORMS += \
../LibreVNA-GUI/Device/LibreVNA/amplitudecaldialog.ui \
../LibreVNA-GUI/Device/LibreVNA/automaticamplitudedialog.ui \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogv1.ui \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvd0.ui \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvfe.ui \
../LibreVNA-GUI/Device/LibreVNA/deviceconfigurationdialogvff.ui \
../LibreVNA-GUI/Device/LibreVNA/firmwareupdatedialog.ui \

View file

@ -553,6 +553,11 @@ using DeviceConfig = struct _deviceconfig {
uint16_t portGain :4;
uint16_t refGain :4;
} VFE;
struct {
uint16_t DFTphaseInc;
uint32_t ADCrate;
uint8_t PLLSettlingDelay;
} VD0;
};
};