mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-04 22:17:31 +00:00
Merge branch 'master' of github.com:jankae/LibreVNA
This commit is contained in:
commit
6aef3fe0ac
15 changed files with 86 additions and 372 deletions
2
Software/PC_Application/.gitignore
vendored
2
Software/PC_Application/.gitignore
vendored
|
|
@ -75,6 +75,8 @@ Application
|
|||
/build-*
|
||||
/LibreVNA-GUI/LibreVNA-GUI
|
||||
/LibreVNA-Test/LibreVNA-Test
|
||||
/LibreVNA-GUI/users*appdatalocaltemp*
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -619,7 +619,7 @@ void Through::edit(std::function<void(void)> finishedCallback)
|
|||
|
||||
QObject::connect(ui->touchstoneImport, &TouchstoneImport::statusChanged, ui->updateFile, &QPushButton::setEnabled);
|
||||
|
||||
ui->touchstoneImport->setPorts(1);
|
||||
ui->touchstoneImport->setPorts(2);
|
||||
if(touchstone) {
|
||||
ui->measurement->setChecked(true);
|
||||
ui->touchstoneImport->setFile(touchstone->getFilename());
|
||||
|
|
@ -628,7 +628,7 @@ void Through::edit(std::function<void(void)> finishedCallback)
|
|||
}
|
||||
|
||||
QObject::connect(ui->updateFile, &QPushButton::clicked, [=](){
|
||||
setMeasurement(ui->touchstoneImport->getTouchstone(), ui->touchstoneImport->getPorts()[0]);
|
||||
setMeasurement(ui->touchstoneImport->getTouchstone(), ui->touchstoneImport->getPorts()[0], ui->touchstoneImport->getPorts()[1]);
|
||||
updateMeasurementLabel();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public:
|
|||
void assignInput(TraceMath *input);
|
||||
|
||||
DataType getDataType() const;
|
||||
std::vector<Data>& rData() { return data;}
|
||||
virtual std::vector<Data>& rData() { return data;}
|
||||
Status getStatus() const;
|
||||
QString getStatusDescription() const;
|
||||
virtual Type getType() = 0;
|
||||
|
|
|
|||
|
|
@ -1490,6 +1490,15 @@ unsigned int Trace::numSamples()
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<Trace::Data> &Trace::rData()
|
||||
{
|
||||
if(deembeddingActive && deembeddingAvailable()) {
|
||||
return deembeddingData;
|
||||
} else {
|
||||
return TraceMath::rData();
|
||||
}
|
||||
}
|
||||
|
||||
double Trace::getUnwrappedPhase(unsigned int index)
|
||||
{
|
||||
if(index >= size()) {
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ public:
|
|||
virtual Data getSample(unsigned int index) override;
|
||||
virtual Data getInterpolatedSample(double x) override;
|
||||
virtual unsigned int numSamples() override;
|
||||
virtual std::vector<Data>& rData() override;
|
||||
|
||||
double getUnwrappedPhase(unsigned int index);
|
||||
// returns a (possibly interpolated sample) at a specified frequency/time/power
|
||||
|
|
|
|||
|
|
@ -1,362 +0,0 @@
|
|||
{
|
||||
"Modes": [
|
||||
{
|
||||
"name": "Vector Network Analyzer",
|
||||
"settings": {
|
||||
"de-embedding": null,
|
||||
"de-embedding_enabled": false,
|
||||
"markers": null,
|
||||
"sweep": {
|
||||
"IFBW": 10000.0,
|
||||
"frequency": {
|
||||
"log": false,
|
||||
"power": -10.0,
|
||||
"start": 1000000.0,
|
||||
"stop": 6000000000.0
|
||||
},
|
||||
"points": 1001,
|
||||
"power": {
|
||||
"frequency": 1000000000.0,
|
||||
"start": -30.0,
|
||||
"stop": -10.0
|
||||
},
|
||||
"single": false,
|
||||
"type": "Frequency"
|
||||
},
|
||||
"tiles": {
|
||||
"orientation": "vertical",
|
||||
"sizes": [
|
||||
343,
|
||||
343
|
||||
],
|
||||
"split": true,
|
||||
"tile1": {
|
||||
"orientation": "horizontal",
|
||||
"sizes": [
|
||||
773,
|
||||
772
|
||||
],
|
||||
"split": true,
|
||||
"tile1": {
|
||||
"plot": "smithchart",
|
||||
"plotsettings": {
|
||||
"Z0": 50.0,
|
||||
"constantLines": null,
|
||||
"cursorFormat": "real + imag",
|
||||
"edge_reflection": 1.0,
|
||||
"frequency_override": false,
|
||||
"limit_to_edge": true,
|
||||
"limit_to_span": true,
|
||||
"offset_axis_x": 0.0,
|
||||
"offset_axis_y": 0.0,
|
||||
"override_max": 6000000000.0,
|
||||
"override_min": 0.0,
|
||||
"traces": [
|
||||
3896420666
|
||||
]
|
||||
},
|
||||
"split": false
|
||||
},
|
||||
"tile2": {
|
||||
"plot": "XY-plot",
|
||||
"plotsettings": {
|
||||
"XAxis": {
|
||||
"div": 500000000.0,
|
||||
"log": false,
|
||||
"max": 6000000000.0,
|
||||
"min": 1000000.0,
|
||||
"mode": "Use Span",
|
||||
"type": "Frequency"
|
||||
},
|
||||
"YPrimary": {
|
||||
"autorange": false,
|
||||
"div": 10.0,
|
||||
"log": false,
|
||||
"max": 20.0,
|
||||
"min": -120.0,
|
||||
"traces": [
|
||||
4241508620
|
||||
],
|
||||
"type": "Magnitude"
|
||||
},
|
||||
"YSecondary": {
|
||||
"autorange": false,
|
||||
"div": 30.0,
|
||||
"log": false,
|
||||
"max": 180.0,
|
||||
"min": -180.0,
|
||||
"traces": [
|
||||
4241508620
|
||||
],
|
||||
"type": "Phase"
|
||||
},
|
||||
"limitLines": null
|
||||
},
|
||||
"split": false
|
||||
}
|
||||
},
|
||||
"tile2": {
|
||||
"orientation": "horizontal",
|
||||
"sizes": [
|
||||
773,
|
||||
772
|
||||
],
|
||||
"split": true,
|
||||
"tile1": {
|
||||
"plot": "XY-plot",
|
||||
"plotsettings": {
|
||||
"XAxis": {
|
||||
"div": 1e-07,
|
||||
"log": false,
|
||||
"max": 9.999166736105324e-07,
|
||||
"min": 0.0,
|
||||
"mode": "Fit Traces",
|
||||
"type": "Time"
|
||||
},
|
||||
"YPrimary": {
|
||||
"autorange": true,
|
||||
"div": 20.0,
|
||||
"log": false,
|
||||
"max": 2.1792987877018692,
|
||||
"min": -164.04811006538517,
|
||||
"traces": [
|
||||
4176942550
|
||||
],
|
||||
"type": "Impulse Response (Magnitude)"
|
||||
},
|
||||
"YSecondary": {
|
||||
"autorange": true,
|
||||
"div": 0.0,
|
||||
"log": false,
|
||||
"max": 1.0,
|
||||
"min": -1.0,
|
||||
"traces": null,
|
||||
"type": "Disabled"
|
||||
},
|
||||
"limitLines": null
|
||||
},
|
||||
"split": false
|
||||
},
|
||||
"tile2": {
|
||||
"plot": "smithchart",
|
||||
"plotsettings": {
|
||||
"Z0": 50.0,
|
||||
"constantLines": null,
|
||||
"cursorFormat": "real + imag",
|
||||
"edge_reflection": 1.0,
|
||||
"frequency_override": false,
|
||||
"limit_to_edge": true,
|
||||
"limit_to_span": true,
|
||||
"offset_axis_x": 0.0,
|
||||
"offset_axis_y": 0.0,
|
||||
"override_max": 6000000000.0,
|
||||
"override_min": 0.0,
|
||||
"traces": [
|
||||
1327145634
|
||||
]
|
||||
},
|
||||
"split": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"traces": [
|
||||
{
|
||||
"color": "#ffff00",
|
||||
"deembeddingActive": false,
|
||||
"deembeddingData": null,
|
||||
"hash": 3896420666,
|
||||
"livetype": 0,
|
||||
"math": null,
|
||||
"math_enabled": false,
|
||||
"name": "S11",
|
||||
"parameter": "S11",
|
||||
"paused": false,
|
||||
"reflection": true,
|
||||
"type": "Live",
|
||||
"velocityFactor": 0.66,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"color": "#0000ff",
|
||||
"deembeddingActive": false,
|
||||
"deembeddingData": null,
|
||||
"hash": 4241508620,
|
||||
"livetype": 0,
|
||||
"math": null,
|
||||
"math_enabled": false,
|
||||
"name": "S12",
|
||||
"parameter": "S12",
|
||||
"paused": false,
|
||||
"reflection": false,
|
||||
"type": "Live",
|
||||
"velocityFactor": 0.66,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"color": "#00ff00",
|
||||
"deembeddingActive": false,
|
||||
"deembeddingData": null,
|
||||
"hash": 4176942550,
|
||||
"livetype": 0,
|
||||
"math": [
|
||||
{
|
||||
"enabled": true,
|
||||
"operation": "TDR",
|
||||
"settings": {
|
||||
"automatic_DC": true,
|
||||
"bandpass_mode": false,
|
||||
"step_response": true,
|
||||
"window": {
|
||||
"type": "Hamming"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"math_enabled": true,
|
||||
"name": "S21",
|
||||
"parameter": "S21",
|
||||
"paused": false,
|
||||
"reflection": false,
|
||||
"type": "Live",
|
||||
"velocityFactor": 0.66,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"color": "#ff0000",
|
||||
"deembeddingActive": false,
|
||||
"deembeddingData": null,
|
||||
"hash": 1327145634,
|
||||
"livetype": 0,
|
||||
"math": null,
|
||||
"math_enabled": false,
|
||||
"name": "S22",
|
||||
"parameter": "S22",
|
||||
"paused": false,
|
||||
"reflection": true,
|
||||
"type": "Live",
|
||||
"velocityFactor": 0.66,
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Vector Network Analyzer"
|
||||
},
|
||||
{
|
||||
"name": "Signal Generator",
|
||||
"settings": {
|
||||
"frequency": 1000000000.0,
|
||||
"port": 0,
|
||||
"power": 0.0,
|
||||
"sweep": {
|
||||
"dwell": 1.0,
|
||||
"enabled": false,
|
||||
"span": 0.0,
|
||||
"steps": 100.0
|
||||
}
|
||||
},
|
||||
"type": "Signal Generator"
|
||||
},
|
||||
{
|
||||
"name": "Spectrum Analyzer",
|
||||
"settings": {
|
||||
"markers": null,
|
||||
"sweep": {
|
||||
"acquisition": {
|
||||
"RBW": 100000.0,
|
||||
"detector": "+Peak",
|
||||
"signal ID": false,
|
||||
"window": "Kaiser"
|
||||
},
|
||||
"frequency": {
|
||||
"start": 37000000.0,
|
||||
"stop": 4000000000.0
|
||||
},
|
||||
"single": false,
|
||||
"trackingGenerator": {
|
||||
"enabled": false,
|
||||
"offset": 0.0,
|
||||
"port": 1,
|
||||
"power": -20.0
|
||||
}
|
||||
},
|
||||
"tiles": {
|
||||
"plot": "XY-plot",
|
||||
"plotsettings": {
|
||||
"XAxis": {
|
||||
"div": 200000000.0,
|
||||
"log": false,
|
||||
"max": 4000000000.0,
|
||||
"min": 37000000.0,
|
||||
"mode": "Use Span",
|
||||
"type": "Frequency"
|
||||
},
|
||||
"YPrimary": {
|
||||
"autorange": false,
|
||||
"div": 10.0,
|
||||
"log": false,
|
||||
"max": 0.0,
|
||||
"min": -120.0,
|
||||
"traces": [
|
||||
2411279292,
|
||||
2178442625
|
||||
],
|
||||
"type": "Magnitude"
|
||||
},
|
||||
"YSecondary": {
|
||||
"autorange": true,
|
||||
"div": 0.0,
|
||||
"log": false,
|
||||
"max": 1.0,
|
||||
"min": -1.0,
|
||||
"traces": null,
|
||||
"type": "Disabled"
|
||||
},
|
||||
"limitLines": null
|
||||
},
|
||||
"split": false
|
||||
},
|
||||
"traces": [
|
||||
{
|
||||
"color": "#ffff00",
|
||||
"deembeddingActive": false,
|
||||
"deembeddingData": null,
|
||||
"hash": 2411279292,
|
||||
"livetype": 0,
|
||||
"math": null,
|
||||
"math_enabled": false,
|
||||
"name": "PORT1",
|
||||
"parameter": "PORT1",
|
||||
"paused": false,
|
||||
"reflection": false,
|
||||
"type": "Live",
|
||||
"velocityFactor": 0.66,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"color": "#0000ff",
|
||||
"deembeddingActive": false,
|
||||
"deembeddingData": null,
|
||||
"hash": 2178442625,
|
||||
"livetype": 0,
|
||||
"math": null,
|
||||
"math_enabled": false,
|
||||
"name": "PORT2",
|
||||
"parameter": "PORT2",
|
||||
"paused": false,
|
||||
"reflection": false,
|
||||
"type": "Live",
|
||||
"velocityFactor": 0.66,
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Spectrum Analyzer"
|
||||
}
|
||||
],
|
||||
"Reference": {
|
||||
"Mode": "Internal",
|
||||
"Output": "Off"
|
||||
},
|
||||
"activeMode": "Vector Network Analyzer",
|
||||
"version": "1.5.0-alpha.2-4568be8ff"
|
||||
}
|
||||
|
|
@ -181,6 +181,16 @@ inline void App_Process() {
|
|||
case Protocol::PacketType::StartStatusUpdates: {
|
||||
HW::setStatusUpdateFlag(true);
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
}
|
||||
break;
|
||||
case Protocol::PacketType::InitiateSweep: {
|
||||
if(VNA::GetStandbyMode()) {
|
||||
VNA::InitiateSweep();
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
} else {
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Nack);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case Protocol::PacketType::SetIdle:
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_
|
|||
case PacketType::ClearTrigger:
|
||||
case PacketType::StopStatusUpdates:
|
||||
case PacketType::StartStatusUpdates:
|
||||
case PacketType::InitiateSweep:
|
||||
// no payload
|
||||
break;
|
||||
case PacketType::VNADatapoint: payload_size = packet.VNAdatapoint->requiredBufferSize(); break;
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ using SweepSettings = struct _sweepSettings {
|
|||
uint16_t points;
|
||||
uint32_t if_bandwidth;
|
||||
int16_t cdbm_excitation_start; // in 1/100 dbm
|
||||
uint16_t unused:1;
|
||||
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
|
||||
|
|
@ -366,6 +366,7 @@ enum class PacketType : uint8_t {
|
|||
ClearTrigger = 29,
|
||||
StopStatusUpdates = 30,
|
||||
StartStatusUpdates = 31,
|
||||
InitiateSweep = 32
|
||||
};
|
||||
|
||||
using PacketInfo = struct _packetinfo {
|
||||
|
|
|
|||
|
|
@ -250,6 +250,8 @@ void HW::SetIdle() {
|
|||
FPGA::Enable(FPGA::Periphery::RefMixer, false);
|
||||
FPGA::Enable(FPGA::Periphery::PortSwitch, false);
|
||||
activeMode = Mode::Idle;
|
||||
VNA::SetWaitingInStandby(false);
|
||||
|
||||
}
|
||||
|
||||
HW::AmplitudeSettings HW::GetAmplitudeSettings(int16_t cdbm, uint64_t freq, bool applyCorrections, bool port2) {
|
||||
|
|
@ -303,7 +305,7 @@ bool HW::TimedOut() {
|
|||
auto bufISR = lastISR;
|
||||
uint64_t now = Delay::get_us();
|
||||
uint64_t timeSinceLast = now - bufISR;
|
||||
if(activeMode != Mode::Idle && activeMode != Mode::Generator && timeSinceLast > timeout) {
|
||||
if(activeMode != Mode::Idle && activeMode != Mode::Generator && !VNA::IsWaitingInStandby() && timeSinceLast > timeout) {
|
||||
LOG_WARN("Timed out, last ISR was at %lu%06lu, now %lu%06lu"
|
||||
, (uint32_t) (bufISR / 1000000), (uint32_t)(bufISR%1000000)
|
||||
, (uint32_t) (now / 1000000), (uint32_t)(now%1000000));
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ static uint32_t last_LO2;
|
|||
static double logMultiplier, logFrequency;
|
||||
static Protocol::VNADatapoint<32> data;
|
||||
static bool active = false;
|
||||
static bool waitingInStandby = false;
|
||||
static Si5351C::DriveStrength fixedPowerLowband;
|
||||
static bool adcShifted;
|
||||
static uint32_t actualBandwidth;
|
||||
|
|
@ -258,12 +259,38 @@ bool VNA::Setup(Protocol::SweepSettings s) {
|
|||
// Enable new data and sweep halt interrupt
|
||||
FPGA::EnableInterrupt(FPGA::Interrupt::NewData);
|
||||
FPGA::EnableInterrupt(FPGA::Interrupt::SweepHalted);
|
||||
// Start the sweep
|
||||
// Start the sweep if not configured for standby
|
||||
firstPoint = true;
|
||||
FPGA::StartSweep();
|
||||
if (settings.standby) {
|
||||
waitingInStandby = true;
|
||||
}
|
||||
else {
|
||||
FPGA::StartSweep();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void VNA::InitiateSweep() {
|
||||
// Invoked by a host via InitiateSweep packet
|
||||
if(waitingInStandby){
|
||||
// make sure that SweepSettings have been configured for standby operation
|
||||
FPGA::StartSweep();
|
||||
waitingInStandby = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool VNA::GetStandbyMode() {
|
||||
return settings.standby;
|
||||
}
|
||||
|
||||
bool VNA::IsWaitingInStandby() {
|
||||
return waitingInStandby;
|
||||
}
|
||||
|
||||
void VNA::SetWaitingInStandby(bool waiting) {
|
||||
waitingInStandby = waiting;
|
||||
}
|
||||
|
||||
static void PassOnData() {
|
||||
Protocol::PacketInfo info;
|
||||
info.type = Protocol::PacketType::VNADatapoint;
|
||||
|
|
@ -330,8 +357,14 @@ void VNA::Work() {
|
|||
Communication::Send(packet);
|
||||
}
|
||||
// do not reset unlevel flag here, as it is calculated only once at the setup of the sweep
|
||||
// Start next sweep
|
||||
FPGA::StartSweep();
|
||||
// Start next sweep if not configured for standby
|
||||
if (settings.standby) {
|
||||
waitingInStandby = true;
|
||||
}
|
||||
else {
|
||||
FPGA::StartSweep();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void VNA::SweepHalted() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
namespace VNA {
|
||||
|
||||
bool Setup(Protocol::SweepSettings s);
|
||||
void InitiateSweep();
|
||||
bool GetStandbyMode();
|
||||
bool IsWaitingInStandby();
|
||||
void SetWaitingInStandby(bool waiting);
|
||||
bool MeasurementDone(const FPGA::SamplingResult &result);
|
||||
void Work();
|
||||
void SweepHalted();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue