Merge pull request #182 from andredunford/sweep_standby
implement sweep standby operation
This commit is contained in:
commit
d022f944c5
Binary file not shown.
@ -250,6 +250,7 @@ The following packet types are available:
|
|||||||
29 & ClearTrigger & D$\leftrightarrow$H & Updates the trigger status for synchronization over USB & None\\
|
29 & ClearTrigger & D$\leftrightarrow$H & Updates the trigger status for synchronization over USB & None\\
|
||||||
30 & StopStatusUpdates & H$\rightarrow$D & Stops the automatic transmission of device status packets & None\\
|
30 & StopStatusUpdates & H$\rightarrow$D & Stops the automatic transmission of device status packets & None\\
|
||||||
31 & StartStatusUpdates & H$\rightarrow$D & Starts the automatic transmission of device status packets & None\\
|
31 & StartStatusUpdates & H$\rightarrow$D & Starts the automatic transmission of device status packets & None\\
|
||||||
|
32 & InitiateSweep & H$\rightarrow$D & Initiates a single sweep when configured for standby operation & None\\
|
||||||
\end{longtable}
|
\end{longtable}
|
||||||
\end{ThreePartTable}
|
\end{ThreePartTable}
|
||||||
An Ack is transmitted by the device for every received command after it has been handled successfully. If additional responses are triggered by the command, they are transmitted after this Ack.
|
An Ack is transmitted by the device for every received command after it has been handled successfully. If additional responses are triggered by the command, they are transmitted after this Ack.
|
||||||
@ -299,7 +300,7 @@ The packet contains the following fields:
|
|||||||
\rwbits{12}{1}{FP}
|
\rwbits{12}{1}{FP}
|
||||||
\rwbits{13}{1}{SP}
|
\rwbits{13}{1}{SP}
|
||||||
\rwbits{14}{1}{SM}
|
\rwbits{14}{1}{SM}
|
||||||
\robits{15}{1}{}
|
\rwbits{15}{1}{SO}
|
||||||
\end{tikzpicture}
|
\end{tikzpicture}
|
||||||
\end{center}
|
\end{center}
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
@ -337,6 +338,15 @@ Setting & Behavior\\
|
|||||||
\end{tabularx}
|
\end{tabularx}
|
||||||
\end{center}
|
\end{center}
|
||||||
\item \textbf{SM:} Sync Master. Must be set to 1 at exactly one device when multiple devices are synchronized. Set to 0 when synchronization is disabled.
|
\item \textbf{SM:} Sync Master. Must be set to 1 at exactly one device when multiple devices are synchronized. Set to 0 when synchronization is disabled.
|
||||||
|
\item \textbf{SO:} Standby Operation. Indicates whether the VNA will begin sweep immediately, or wait in the configured state to be triggered manually by InitiateSweep packets. Standy operation allows for lower latency of intermittent single sweeps.
|
||||||
|
\begin{center}
|
||||||
|
\begin{tabularx}{\textwidth}{ c|X }
|
||||||
|
Setting & Behavior\\
|
||||||
|
\hline
|
||||||
|
0 & VNA will begin sweep immediately and timeout to idle mode 1000ms after sweep is completed or 100ms after entering the halted state. \\
|
||||||
|
1 & VNA will wait in a configured state for InitiateSweep packets. The host application is responsible for putting the VNA into idle mode with a SetIdle packet.\\
|
||||||
|
\end{tabularx}
|
||||||
|
\end{center}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\subsection{ManualStatusV1}
|
\subsection{ManualStatusV1}
|
||||||
@ -1018,4 +1028,7 @@ This packet instructs the device to stop sending automatically scheduled DeviceS
|
|||||||
\subsection{StartStatusUpdates}
|
\subsection{StartStatusUpdates}
|
||||||
This packet instructs the device to start sending automatically scheduled DeviceStatusV1 packets. This restores default update behaviour if a StopStatusUpdates packet has previously been sent.
|
This packet instructs the device to start sending automatically scheduled DeviceStatusV1 packets. This restores default update behaviour if a StopStatusUpdates packet has previously been sent.
|
||||||
|
|
||||||
|
\subsection{InitiateSweep}
|
||||||
|
This packet instructs the device to initiate a new single sweep when the VNA is configured for standby operation. This triggering method can be used for fast intermittent single sweeps with minimum latency. If the SweepSettings are not configured for standby operation, this packet will result in a Nack response.
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
@ -181,6 +181,16 @@ inline void App_Process() {
|
|||||||
case Protocol::PacketType::StartStatusUpdates: {
|
case Protocol::PacketType::StartStatusUpdates: {
|
||||||
HW::setStatusUpdateFlag(true);
|
HW::setStatusUpdateFlag(true);
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
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;
|
break;
|
||||||
case Protocol::PacketType::SetIdle:
|
case Protocol::PacketType::SetIdle:
|
||||||
|
@ -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 {
|
||||||
|
@ -250,6 +250,8 @@ void HW::SetIdle() {
|
|||||||
FPGA::Enable(FPGA::Periphery::RefMixer, false);
|
FPGA::Enable(FPGA::Periphery::RefMixer, false);
|
||||||
FPGA::Enable(FPGA::Periphery::PortSwitch, false);
|
FPGA::Enable(FPGA::Periphery::PortSwitch, false);
|
||||||
activeMode = Mode::Idle;
|
activeMode = Mode::Idle;
|
||||||
|
VNA::SetWaitingInStandby(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HW::AmplitudeSettings HW::GetAmplitudeSettings(int16_t cdbm, uint64_t freq, bool applyCorrections, bool port2) {
|
HW::AmplitudeSettings HW::GetAmplitudeSettings(int16_t cdbm, uint64_t freq, bool applyCorrections, bool port2) {
|
||||||
@ -303,7 +305,7 @@ bool HW::TimedOut() {
|
|||||||
auto bufISR = lastISR;
|
auto bufISR = lastISR;
|
||||||
uint64_t now = Delay::get_us();
|
uint64_t now = Delay::get_us();
|
||||||
uint64_t timeSinceLast = now - bufISR;
|
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"
|
LOG_WARN("Timed out, last ISR was at %lu%06lu, now %lu%06lu"
|
||||||
, (uint32_t) (bufISR / 1000000), (uint32_t)(bufISR%1000000)
|
, (uint32_t) (bufISR / 1000000), (uint32_t)(bufISR%1000000)
|
||||||
, (uint32_t) (now / 1000000), (uint32_t)(now%1000000));
|
, (uint32_t) (now / 1000000), (uint32_t)(now%1000000));
|
||||||
|
@ -27,6 +27,7 @@ static uint32_t last_LO2;
|
|||||||
static double logMultiplier, logFrequency;
|
static double logMultiplier, logFrequency;
|
||||||
static Protocol::VNADatapoint<32> data;
|
static Protocol::VNADatapoint<32> data;
|
||||||
static bool active = false;
|
static bool active = false;
|
||||||
|
static bool waitingInStandby = false;
|
||||||
static Si5351C::DriveStrength fixedPowerLowband;
|
static Si5351C::DriveStrength fixedPowerLowband;
|
||||||
static bool adcShifted;
|
static bool adcShifted;
|
||||||
static uint32_t actualBandwidth;
|
static uint32_t actualBandwidth;
|
||||||
@ -258,12 +259,38 @@ 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) {
|
||||||
|
waitingInStandby = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
FPGA::StartSweep();
|
||||||
|
}
|
||||||
return true;
|
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() {
|
static void PassOnData() {
|
||||||
Protocol::PacketInfo info;
|
Protocol::PacketInfo info;
|
||||||
info.type = Protocol::PacketType::VNADatapoint;
|
info.type = Protocol::PacketType::VNADatapoint;
|
||||||
@ -330,8 +357,14 @@ 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) {
|
||||||
|
waitingInStandby = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
FPGA::StartSweep();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNA::SweepHalted() {
|
void VNA::SweepHalted() {
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
namespace VNA {
|
namespace VNA {
|
||||||
|
|
||||||
bool Setup(Protocol::SweepSettings s);
|
bool Setup(Protocol::SweepSettings s);
|
||||||
|
void InitiateSweep();
|
||||||
|
bool GetStandbyMode();
|
||||||
|
bool IsWaitingInStandby();
|
||||||
|
void SetWaitingInStandby(bool waiting);
|
||||||
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