Skip to content

Commit

Permalink
LMS7002M: don't calibrate CG_IAMP value when setting Tx LPF if custom…
Browse files Browse the repository at this point in the history
… configuration was loaded
  • Loading branch information
rjonaitis committed Sep 20, 2024
1 parent fbb1b74 commit c193da8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/chips/LMS7002M/LMS7002M.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ LMS7002M::LMS7002M(std::shared_ptr<ISPI> port)
, controlPort(port)
, mC_impl(nullptr)
, skipExternalDataInterfaceUpdate(false)
, customConfigFileIsLoaded(false)
{
struct lms7002m_hooks hooks {
};
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -585,6 +586,7 @@ OpStatus LMS7002M::LoadConfigLegacyFile(const std::string& filename)
}
}
}
customConfigFileIsLoaded = true;
return OpStatus::Success;
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}

Expand Down
1 change: 1 addition & 0 deletions src/include/limesuiteng/LMS7002M.h
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ class LIME_API LMS7002M

lms7002m_context* mC_impl;
bool skipExternalDataInterfaceUpdate;
bool customConfigFileIsLoaded;
};
} // namespace lime
#endif

0 comments on commit c193da8

Please sign in to comment.