implement sweep standby configuration
This commit is contained in:
parent
e35766c7b8
commit
08fa3fa0a0
@ -183,6 +183,11 @@ inline void App_Process() {
|
|||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Protocol::PacketType::InitiateSweep: {
|
||||||
|
VNA::InitiateSweep();
|
||||||
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Protocol::PacketType::SetIdle:
|
case Protocol::PacketType::SetIdle:
|
||||||
HW::SetMode(HW::Mode::Idle);
|
HW::SetMode(HW::Mode::Idle);
|
||||||
sweepActive = false;
|
sweepActive = false;
|
||||||
@ -314,7 +319,7 @@ inline void App_Process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(HW::TimedOut()) {
|
if(!VNA::GetStandbyMode() && HW::TimedOut()) {
|
||||||
HW::SetMode(HW::Mode::Idle);
|
HW::SetMode(HW::Mode::Idle);
|
||||||
// insert the last received packet (restarts the timed out operation)
|
// insert the last received packet (restarts the timed out operation)
|
||||||
Communication::BlockNextAck();
|
Communication::BlockNextAck();
|
||||||
|
@ -125,6 +125,7 @@ uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_
|
|||||||
case PacketType::ClearTrigger:
|
case PacketType::ClearTrigger:
|
||||||
case PacketType::StopStatusUpdates:
|
case PacketType::StopStatusUpdates:
|
||||||
case PacketType::StartStatusUpdates:
|
case PacketType::StartStatusUpdates:
|
||||||
|
case PacketType::InitiateSweep:
|
||||||
// no payload
|
// no payload
|
||||||
break;
|
break;
|
||||||
case PacketType::VNADatapoint: payload_size = packet.VNAdatapoint->requiredBufferSize(); break;
|
case PacketType::VNADatapoint: payload_size = packet.VNAdatapoint->requiredBufferSize(); break;
|
||||||
|
@ -159,7 +159,7 @@ using SweepSettings = struct _sweepSettings {
|
|||||||
uint16_t points;
|
uint16_t points;
|
||||||
uint32_t if_bandwidth;
|
uint32_t if_bandwidth;
|
||||||
int16_t cdbm_excitation_start; // in 1/100 dbm
|
int16_t cdbm_excitation_start; // in 1/100 dbm
|
||||||
uint16_t unused:1;
|
uint16_t standby:1;
|
||||||
uint16_t syncMaster:1;
|
uint16_t syncMaster:1;
|
||||||
uint16_t suppressPeaks: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 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,
|
ClearTrigger = 29,
|
||||||
StopStatusUpdates = 30,
|
StopStatusUpdates = 30,
|
||||||
StartStatusUpdates = 31,
|
StartStatusUpdates = 31,
|
||||||
|
InitiateSweep = 32
|
||||||
};
|
};
|
||||||
|
|
||||||
using PacketInfo = struct _packetinfo {
|
using PacketInfo = struct _packetinfo {
|
||||||
|
@ -258,12 +258,26 @@ bool VNA::Setup(Protocol::SweepSettings s) {
|
|||||||
// Enable new data and sweep halt interrupt
|
// Enable new data and sweep halt interrupt
|
||||||
FPGA::EnableInterrupt(FPGA::Interrupt::NewData);
|
FPGA::EnableInterrupt(FPGA::Interrupt::NewData);
|
||||||
FPGA::EnableInterrupt(FPGA::Interrupt::SweepHalted);
|
FPGA::EnableInterrupt(FPGA::Interrupt::SweepHalted);
|
||||||
// Start the sweep
|
// Start the sweep if not configured for standby
|
||||||
firstPoint = true;
|
firstPoint = true;
|
||||||
FPGA::StartSweep();
|
if(!settings.standby){
|
||||||
|
FPGA::StartSweep();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VNA::InitiateSweep() {
|
||||||
|
// Invoked by a host via InitiateSweep packet
|
||||||
|
if(settings.standby){
|
||||||
|
// make sure that SweepSettings have been configured for standby operation
|
||||||
|
FPGA::StartSweep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VNA::GetStandbyMode() {
|
||||||
|
return settings.standby;
|
||||||
|
}
|
||||||
|
|
||||||
static void PassOnData() {
|
static void PassOnData() {
|
||||||
Protocol::PacketInfo info;
|
Protocol::PacketInfo info;
|
||||||
info.type = Protocol::PacketType::VNADatapoint;
|
info.type = Protocol::PacketType::VNADatapoint;
|
||||||
@ -330,8 +344,11 @@ void VNA::Work() {
|
|||||||
Communication::Send(packet);
|
Communication::Send(packet);
|
||||||
}
|
}
|
||||||
// do not reset unlevel flag here, as it is calculated only once at the setup of the sweep
|
// do not reset unlevel flag here, as it is calculated only once at the setup of the sweep
|
||||||
// Start next sweep
|
// Start next sweep if not configured for standby
|
||||||
FPGA::StartSweep();
|
if (!settings.standby){
|
||||||
|
FPGA::StartSweep();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNA::SweepHalted() {
|
void VNA::SweepHalted() {
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
namespace VNA {
|
namespace VNA {
|
||||||
|
|
||||||
bool Setup(Protocol::SweepSettings s);
|
bool Setup(Protocol::SweepSettings s);
|
||||||
|
void InitiateSweep();
|
||||||
|
bool GetStandbyMode();
|
||||||
bool MeasurementDone(const FPGA::SamplingResult &result);
|
bool MeasurementDone(const FPGA::SamplingResult &result);
|
||||||
void Work();
|
void Work();
|
||||||
void SweepHalted();
|
void SweepHalted();
|
||||||
|
Loading…
Reference in New Issue
Block a user