Device protocol update: support device with up to 4 ports

This commit is contained in:
Jan Käberich 2023-02-23 23:04:50 +01:00
parent a0c45d3c56
commit 99c6d77ad8
6 changed files with 1443 additions and 32 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -245,7 +245,7 @@ QString LibreVNADriver::getStatus()
}
break;
case 0xFF:
ret.append("MCU Temp: "+QString::number(lastStatus.VFF.temp_MCU)+"°C");
ret.append(" MCU Temp: "+QString::number(lastStatus.VFF.temp_MCU)+"°C");
break;
}
return ret;
@ -358,6 +358,8 @@ bool LibreVNADriver::setVNA(const DeviceDriver::VNASettings &s, std::function<vo
zerospan = (s.freqStart == s.freqStop) && (s.dBmStart == s.dBmStop);
p.settings.port1Stage = find(s.excitedPorts.begin(), s.excitedPorts.end(), 1) - s.excitedPorts.begin();
p.settings.port2Stage = find(s.excitedPorts.begin(), s.excitedPorts.end(), 2) - s.excitedPorts.begin();
p.settings.port3Stage = find(s.excitedPorts.begin(), s.excitedPorts.end(), 3) - s.excitedPorts.begin();
p.settings.port4Stage = find(s.excitedPorts.begin(), s.excitedPorts.end(), 4) - s.excitedPorts.begin();
p.settings.syncMode = (int) sync;
p.settings.syncMaster = syncMaster ? 1 : 0;
@ -411,7 +413,7 @@ bool LibreVNADriver::setSA(const DeviceDriver::SASettings &s, std::function<void
p.spectrumSettings.trackingPower = s.trackingPower * 100;
p.spectrumSettings.trackingGenerator = s.trackingGenerator ? 1 : 0;
p.spectrumSettings.trackingGeneratorPort = s.trackingPort == 2 ? 1 : 0;
p.spectrumSettings.trackingGeneratorPort = s.trackingPort - 1;
p.spectrumSettings.syncMode = (int) sync;
p.spectrumSettings.syncMaster = syncMaster ? 1 : 0;
@ -482,8 +484,10 @@ bool LibreVNADriver::setIdle(std::function<void (bool)> cb)
QStringList LibreVNADriver::availableExtRefInSettings()
{
QStringList ret;
for(auto r : Reference::getReferencesIn()) {
ret.push_back(Reference::TypeToLabel(r));
if(hardwareVersion == 0x01) {
for(auto r : Reference::getReferencesIn()) {
ret.push_back(Reference::TypeToLabel(r));
}
}
return ret;
}
@ -491,8 +495,10 @@ QStringList LibreVNADriver::availableExtRefInSettings()
QStringList LibreVNADriver::availableExtRefOutSettings()
{
QStringList ret;
for(auto r : Reference::getOutFrequencies()) {
ret.push_back(Reference::OutFreqToLabel(r));
if(hardwareVersion == 0x01) {
for(auto r : Reference::getOutFrequencies()) {
ret.push_back(Reference::OutFreqToLabel(r));
}
}
return ret;
}
@ -579,8 +585,7 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
Feature::SA, Feature::SATrackingGenerator, Feature::SATrackingOffset,
Feature::ExtRefIn, Feature::ExtRefOut,
};
auto ports = packet.info.hardware_version == 0xFF ? 1 : 2;
info.Limits.VNA.ports = ports;
info.Limits.VNA.ports = packet.info.num_ports;
info.Limits.VNA.minFreq = packet.info.limits_minFreq;
info.Limits.VNA.maxFreq = harmonicMixing ? packet.info.limits_maxFreqHarmonic : packet.info.limits_maxFreq;
info.Limits.VNA.maxPoints = packet.info.limits_maxPoints;
@ -589,13 +594,13 @@ void LibreVNADriver::handleReceivedPacket(const Protocol::PacketInfo &packet)
info.Limits.VNA.mindBm = (double) packet.info.limits_cdbm_min / 100;
info.Limits.VNA.maxdBm = (double) packet.info.limits_cdbm_max / 100;
info.Limits.Generator.ports = ports;
info.Limits.Generator.ports = packet.info.num_ports;
info.Limits.Generator.minFreq = packet.info.limits_minFreq;
info.Limits.Generator.maxFreq = packet.info.limits_maxFreq;
info.Limits.Generator.mindBm = (double) packet.info.limits_cdbm_min / 100;
info.Limits.Generator.maxdBm = (double) packet.info.limits_cdbm_max / 100;
info.Limits.SA.ports = ports;
info.Limits.SA.ports = packet.info.num_ports;
info.Limits.SA.minFreq = packet.info.limits_minFreq;
info.Limits.SA.maxFreq = packet.info.limits_maxFreq;
info.Limits.SA.minRBW = packet.info.limits_minRBW;

View File

@ -1,5 +1,5 @@
2F62501ED4689FB349E356AB974DBE57=EF826FD321FB312AEADE4DB74B81458C
2F62501ED4689FB349E356AB974DBE57=6F84FD31C089E822CF61FFCABCD0B7D1
66BE74F758C12D739921AEA421D593D3=2
8DF89ED150041C4CBC7CB9A9CAA90856=EF826FD321FB312AEADE4DB74B81458C
8DF89ED150041C4CBC7CB9A9CAA90856=6F84FD31C089E822CF61FFCABCD0B7D1
DC22A860405A8BF2F2C095E5B6529F12=A01929E06A3F8E0B7C263320E5AF494F
eclipse.preferences.version=1

View File

@ -10,7 +10,7 @@ using namespace PacketConstants;
namespace Protocol {
static constexpr uint16_t Version = 12;
static constexpr uint16_t Version = 13;
#pragma pack(push, 1)
@ -158,21 +158,27 @@ using SweepSettings = struct _sweepSettings {
uint16_t points;
uint32_t if_bandwidth;
int16_t cdbm_excitation_start; // in 1/100 dbm
uint16_t standby:1;
uint16_t syncMaster:1;
uint16_t suppressPeaks:1;
uint16_t fixedPowerSetting:1; // if set the attenuator and source PLL power will not be changed across the sweep
uint16_t logSweep:1;
uint16_t stages:3;
uint16_t port1Stage:3;
uint16_t port2Stage:3;
uint8_t standby:1;
uint8_t syncMaster:1;
uint8_t suppressPeaks:1;
uint8_t fixedPowerSetting:1; // if set the attenuator and source PLL power will not be changed across the sweep
uint8_t logSweep:1;
/*
* 0: no synchronization
* 1: USB synchronization
* 2: External reference synchronization
* 3: Trigger synchronization (not supported yet by hardware)
*/
uint16_t syncMode:2;
uint8_t syncMode:2;
uint8_t unused1:1;
uint16_t stages:3;
uint16_t port1Stage:3;
uint16_t port2Stage:3;
uint16_t port3Stage:3;
uint16_t port4Stage:3;
uint16_t unused2:1;
int16_t cdbm_excitation_stop; // in 1/100 dbm
};
@ -185,8 +191,9 @@ using ReferenceSettings = struct _referenceSettings {
using GeneratorSettings = struct _generatorSettings {
uint64_t frequency;
int16_t cdbm_level;
uint8_t activePort :2;
uint8_t activePort :3;
uint8_t applyAmplitudeCorrection :1;
uint8_t unused :4;
};
using DeviceInfo = struct _deviceInfo {
@ -207,6 +214,7 @@ using DeviceInfo = struct _deviceInfo {
uint32_t limits_maxRBW;
uint8_t limits_maxAmplitudePoints;
uint64_t limits_maxFreqHarmonic;
uint8_t num_ports;
};
using DeviceStatus = struct _deviceStatus {
@ -307,11 +315,11 @@ using ManualControl = struct _manualControl {
uint8_t LOexternal :1;
uint64_t LOFrequency;
// Acquisition
uint8_t PortEN :1;
uint8_t RefEN :1;
uint8_t WindowType :2;
uint8_t PortGain :4;
uint8_t RefGain :4;
uint16_t PortEN :1;
uint16_t RefEN :1;
uint16_t WindowType :2;
uint16_t PortGain :4;
uint16_t RefGain :4;
uint16_t Samples;
} VFF;
};
@ -329,11 +337,11 @@ using SpectrumAnalyzerSettings = struct _spectrumAnalyzerSettings {
uint8_t applyReceiverCorrection :1;
uint8_t trackingGenerator :1;
uint8_t applySourceCorrection :1;
uint8_t trackingGeneratorPort :1; // 0 for port1, 1 for port2
uint8_t trackingGeneratorPort :2; // port count starts at zero
/*
* 0: no synchronization
* 1: USB synchronization
* 2: External reference synchronization
* 1: Protocol synchronization (via SetTrigger and ClearTrigger packets)
* 2: Reserved
* 3: Trigger synchronization (not supported yet by hardware)
*/
uint8_t syncMode :2;
@ -345,6 +353,8 @@ using SpectrumAnalyzerSettings = struct _spectrumAnalyzerSettings {
using SpectrumAnalyzerResult = struct _spectrumAnalyzerResult {
float port1;
float port2;
float port3;
float port4;
union {
struct {
// for non-zero span
@ -370,6 +380,8 @@ using AmplitudeCorrectionPoint = struct _amplitudecorrectionpoint {
uint32_t freq;
int16_t port1;
int16_t port2;
int16_t port3;
int16_t port4;
};
using FrequencyCorrection = struct _frequencycorrection {
@ -387,7 +399,8 @@ using DeviceConfig = struct _deviceconfig {
uint32_t ip;
uint32_t mask;
uint32_t gw;
uint16_t dhcp :1;
uint8_t dhcp :1;
uint8_t unused :7;
uint16_t autogain :1;
uint16_t portGain :4;
uint16_t refGain :4;

View File

@ -83,6 +83,7 @@ static constexpr Protocol::DeviceInfo Info = {
.limits_maxRBW = (uint32_t) (DefaultADCSamplerate * 2.23f / MinSamples),
.limits_maxAmplitudePoints = Cal::maxPoints,
.limits_maxFreqHarmonic = 18000000000,
.num_ports = 2,
};
enum class Mode {