diff --git a/Software/VNA_embedded/Application/Drivers/max2871.cpp b/Software/VNA_embedded/Application/Drivers/max2871.cpp index 54fa29b..b939171 100644 --- a/Software/VNA_embedded/Application/Drivers/max2871.cpp +++ b/Software/VNA_embedded/Application/Drivers/max2871.cpp @@ -134,7 +134,8 @@ void MAX2871::SetCPCurrent(uint8_t mA) { bool MAX2871::SetFrequency(uint64_t f) { if (f < 23500000 || f > MaxFreq) { - LOG_ERR("Frequency must be between 23.5MHz and 6GHz"); + LOG_ERR("Frequency must be between 23.5MHz and 6GHz, requested %lu%06luHz", (uint32_t ) (f / 1000000), + (uint32_t ) (f % 1000000)); return false; } LOG_DEBUG("Setting frequency to %lu%06luHz...", (uint32_t ) (f / 1000000), diff --git a/Software/VNA_embedded/Application/VNA.cpp b/Software/VNA_embedded/Application/VNA.cpp index 59b86c6..4a390a3 100644 --- a/Software/VNA_embedded/Application/VNA.cpp +++ b/Software/VNA_embedded/Application/VNA.cpp @@ -87,24 +87,26 @@ static bool setPLLFrequencies(uint64_t f) { } LOFreq = f + HW::getIF1(); } - if(sourceFreq > 0) { + if(sourceFreq > HW::BandSwitchFrequency) { Source.SetFrequency(sourceFreq); } LO1.SetFrequency(LOFreq); bool needsRefSwitch = false; if(settings.suppressPeaks) { // Integer spurs can cause a small peak. - uint32_t sourceDist = Source.DistanceToIntegerSpur(); - uint32_t LODist = LO1.DistanceToIntegerSpur(); - if((sourceDist > 0) && (sourceDist < 3 * HW::getIF2())) { - LOG_INFO("Source spur at %lu: %lu", (uint32_t) f, sourceDist); - sourceRefIndex = !sourceRefIndex; - Source.SetReference(PLLRefFreqs[sourceRefIndex], false, 1, false); - Source.SetFrequency(sourceFreq); - needsRefSwitch = true; + if(sourceFreq > HW::BandSwitchFrequency) { + uint32_t sourceDist = Source.DistanceToIntegerSpur(); + if((sourceDist > 0) && (sourceDist < 3 * HW::getIF2())) { + LOG_DEBUG("Source spur at %lu: %lu", (uint32_t) f, sourceDist); + sourceRefIndex = !sourceRefIndex; + Source.SetReference(PLLRefFreqs[sourceRefIndex], false, 1, false); + Source.SetFrequency(sourceFreq); + needsRefSwitch = true; + } } + uint32_t LODist = LO1.DistanceToIntegerSpur(); if((LODist > 0) && (LODist < 3 * HW::getIF2())) { - LOG_INFO("LO spur at %lu", (uint32_t) f); + LOG_DEBUG("LO spur at %lu", (uint32_t) f); LO1RefIndex = !LO1RefIndex; LO1.SetReference(PLLRefFreqs[LO1RefIndex], false, 1, false); LO1.SetFrequency(LOFreq);