Skip to content

Commit

Permalink
LMS7002M fix IAMP gain calibration if chip is configured to use exter…
Browse files Browse the repository at this point in the history
…nal ADC/DAC
  • Loading branch information
rjonaitis committed Sep 20, 2024
1 parent 6161f01 commit fbb1b74
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/chips/LMS7002M/gainCalibrations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace std::literals::string_literals;
OpStatus LMS7002M::CalibrateTxGainSetup()
{
OpStatus status;
int ch = Get_SPI_Reg_bits(LMS7002MCSR::MAC);
int mac = Get_SPI_Reg_bits(LMS7002MCSR::MAC);

uint16_t value = SPI_read(0x0020);
if ((value & 3) == 1)
Expand All @@ -32,6 +32,7 @@ OpStatus LMS7002M::CalibrateTxGainSetup()
//TBB
Modify_SPI_Reg_bits(LMS7002MCSR::CG_IAMP_TBB, 1);
Modify_SPI_Reg_bits(LMS7002MCSR::LOOPB_TBB, 3);
Modify_SPI_Reg_bits(LMS7002MCSR::TSTIN_TBB, 0);

//RFE
Modify_SPI_Reg_bits(LMS7002MCSR::EN_G_RFE, 0);
Expand All @@ -44,14 +45,23 @@ OpStatus LMS7002M::CalibrateTxGainSetup()
Modify_SPI_Reg_bits(LMS7002MCSR::G_PGA_RBB, 12);
Modify_SPI_Reg_bits(LMS7002MCSR::RCC_CTL_PGA_RBB, 23);

Modify_SPI_Reg_bits(LMS7002MCSR::OSW_PGA_RBB, 0);

//TRF
Modify_SPI_Reg_bits(LMS7002MCSR::EN_G_TRF, 0);

//AFE
const int isel_dac_afe = Get_SPI_Reg_bits(LMS7002MCSR::ISEL_DAC_AFE);
SetDefaults(MemorySection::AFE);
Modify_SPI_Reg_bits(LMS7002MCSR::ISEL_DAC_AFE, isel_dac_afe);
if (ch == 2)
Modify_SPI_Reg_bits(LMS7002MCSR::PD_AFE, 0);
Modify_SPI_Reg_bits(LMS7002MCSR::EN_G_AFE, 1);
if (mac == 1)
{
Modify_SPI_Reg_bits(LMS7002MCSR::PD_RX_AFE1, 0);
Modify_SPI_Reg_bits(LMS7002MCSR::PD_TX_AFE1, 0);
}
else if (mac == 2)
{
Modify_SPI_Reg_bits(LMS7002MCSR::PD_RX_AFE2, 0);
Modify_SPI_Reg_bits(LMS7002MCSR::PD_TX_AFE2, 0);
Expand Down Expand Up @@ -82,7 +92,7 @@ OpStatus LMS7002M::CalibrateTxGainSetup()
Modify_SPI_Reg_bits(LMS7002MCSR::MAC, 1);
Modify_SPI_Reg_bits(LMS7002MCSR::PD_VCO, 1);

Modify_SPI_Reg_bits(LMS7002MCSR::MAC, ch);
Modify_SPI_Reg_bits(LMS7002MCSR::MAC, mac);

//TxTSP
const int isinc = Get_SPI_Reg_bits(LMS7002MCSR::ISINC_BYP_TXTSP);
Expand Down

0 comments on commit fbb1b74

Please sign in to comment.