diff --git a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp index e600c59..7f54ed6 100644 --- a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp +++ b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp @@ -331,15 +331,19 @@ void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) { } } -void FPGA::StartSweep() { +void FPGA::StopSweep() { Low(AUX3); +} + +void FPGA::StartSweep() { + StopSweep(); Delay::us(1); High(AUX3); } void FPGA::AbortSweep() { // abort any FPGA operation by pulling sweep pin low - Low(AUX3); + StopSweep(); // data transfer of a datapoint might still be active, abort HAL_SPI_DMAStop(&FPGA_SPI); busy_reading = false; diff --git a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp index dff1af1..25a34b4 100644 --- a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp +++ b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp @@ -135,6 +135,7 @@ uint16_t GetStatus(); void OverwriteHardware(uint8_t attenuation, LowpassFilter filter, bool lowband, bool port1_enabled, bool port2_enabled); void DisableHardwareOverwrite(); +void StopSweep(); void StartSweep(); void AbortSweep(); diff --git a/Software/VNA_embedded/Application/VNA.cpp b/Software/VNA_embedded/Application/VNA.cpp index de540b0..c270852 100644 --- a/Software/VNA_embedded/Application/VNA.cpp +++ b/Software/VNA_embedded/Application/VNA.cpp @@ -411,6 +411,10 @@ void VNA::Work() { if(Trigger::GetMode() != Trigger::Mode::ExtRef) { HW::Ref::update(); } + // Stop the sweep. The source may not have been active for the last phase but the PLL + // must be enabled for reading the temperature. Stopping the sweep implicitly enables + // the source PLL + FPGA::StopSweep(); // Compile info packet Protocol::PacketInfo packet; packet.type = Protocol::PacketType::DeviceStatus;