From c193da8a255410dc05ae384b3a271a4794e40343 Mon Sep 17 00:00:00 2001 From: Ricardas Jonaitis Date: Fri, 20 Sep 2024 10:59:50 +0300 Subject: [PATCH] LMS7002M: don't calibrate CG_IAMP value when setting Tx LPF if custom configuration was loaded --- src/chips/LMS7002M/LMS7002M.cpp | 14 ++++++++++++-- src/include/limesuiteng/LMS7002M.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/chips/LMS7002M/LMS7002M.cpp b/src/chips/LMS7002M/LMS7002M.cpp index 29566a0b..a9a53a15 100644 --- a/src/chips/LMS7002M/LMS7002M.cpp +++ b/src/chips/LMS7002M/LMS7002M.cpp @@ -271,6 +271,7 @@ LMS7002M::LMS7002M(std::shared_ptr port) , controlPort(port) , mC_impl(nullptr) , skipExternalDataInterfaceUpdate(false) + , customConfigFileIsLoaded(false) { struct lms7002m_hooks hooks { }; @@ -395,7 +396,7 @@ OpStatus LMS7002M::ResetChip() status = SPI_write_batch(addrs.data(), values.data(), addrs.size(), true); status = Modify_SPI_Reg_bits(LMS7002MCSR::MIMO_SISO, 0); //enable B channel after reset - + customConfigFileIsLoaded = false; return status; } @@ -585,6 +586,7 @@ OpStatus LMS7002M::LoadConfigLegacyFile(const std::string& filename) } } } + customConfigFileIsLoaded = true; return OpStatus::Success; } @@ -689,7 +691,7 @@ OpStatus LMS7002M::LoadConfig(const std::string& filename, bool tuneDynamicValue } ResetLogicRegisters(); - + customConfigFileIsLoaded = true; if (tuneDynamicValues) { Modify_SPI_Reg_bits(LMS7002MCSR::MAC, 2); @@ -2092,6 +2094,14 @@ OpStatus LMS7002M::SetTxLPF(double rfBandwidth_Hz) OpStatus status = ResultToStatus(result); if (status != OpStatus::Success) return status; + + // do not calibrate tx gain if custom config file is loaded to maintain custom values + if (customConfigFileIsLoaded) + { + lime::warning("Custom .ini configuration file is loaded, SetTxLPF will not calibrate CG_IAMP_TBB"); + return status; + } + return CalibrateTxGain(); } diff --git a/src/include/limesuiteng/LMS7002M.h b/src/include/limesuiteng/LMS7002M.h index 891c3bda..96823354 100644 --- a/src/include/limesuiteng/LMS7002M.h +++ b/src/include/limesuiteng/LMS7002M.h @@ -931,6 +931,7 @@ class LIME_API LMS7002M lms7002m_context* mC_impl; bool skipExternalDataInterfaceUpdate; + bool customConfigFileIsLoaded; }; } // namespace lime #endif