limeOEM RFTest failure after recent changes

Hey everyone,

I was running limeOEM --test to troubleshoot something on a setup and noticed it fails after some recent changes in the LimeSuiteNG, namely those ones:

  • d427248828 gr-limesuiteng: add advanced options to set individual LMS7002M Rx gains
  • 17a6e05780a lms7002m: make IAMP gain search more stable.

The first commit made a change in LMS7002ChannelConfigure which moved LPF configuration prior to the gain control as the LPF configuration modifies Rx PGA. The second commit modified the way how IAMP is calculated. Combination of those leads to the following test failure:

  === RF ===
    ->Configure LMS
    ->Init Done
    === TX_2->LNA_L ChA ===
    === TX_2->LNA_L ChA - FAILED (RF FAILED, expected(-8.00 dbFS @ 5.000MHz), got(-30.81 dbFS @5.003MHz)) ===
    === TX_2->LNA_L ChB ===
    === TX_2->LNA_L ChB - FAILED (RF FAILED, expected(-8.00 dbFS @ 5.000MHz), got(-32.41 dbFS @5.003MHz)) ===
    === TX_2->LNA_W ChA ===
    === TX_2->LNA_W ChA - FAILED (RF FAILED, expected(-8.00 dbFS @ 5.000MHz), got(-30.49 dbFS @5.003MHz)) ===
    === TX_2->LNA_W ChB ===
    === TX_2->LNA_W ChB - FAILED (RF FAILED, expected(-8.00 dbFS @ 5.000MHz), got(-28.14 dbFS @5.003MHz)) ===
    === TX_1->LNA_H ChA ===
    === TX_1->LNA_H ChA - FAILED (RF FAILED, expected(-8.00 dbFS @ 5.000MHz), got(-26.35 dbFS @5.003MHz)) ===
    === TX_1->LNA_H ChB ===
    === TX_1->LNA_H ChB - FAILED (RF FAILED, expected(-15.00 dbFS @ 5.000MHz), got(-32.44 dbFS @5.003MHz)) ===
  === RF - FAILED ===

To help investigation what I did is made a small local change which reverts parts of the those commits to dump the registers configuration. The path is

diff --git a/src/boards/LMS7002M_SDRDevice.cpp b/src/boards/LMS7002M_SDRDevice.cpp
index d72148ee..056626a9 100644
--- a/src/boards/LMS7002M_SDRDevice.cpp
+++ b/src/boards/LMS7002M_SDRDevice.cpp
@@ -1238,13 +1238,6 @@ OpStatus LMS7002M_SDRDevice::LMS7002ChannelConfigure(LMS7002M& chip, const Chann
     chip.EnableChannel(TRXDir::Tx, channelIndex, ch.tx.enabled);
     chip.SetBandTRF(ch.tx.path);

-    // Rx LPF configuration modifies Rx PGA
-    status = chip.SetRxLPF(ch.rx.lpf);
-    if (status != OpStatus::Success)
-        return status;
-    status = chip.SetTxLPF(ch.tx.lpf);
-    if (status != OpStatus::Success)
-        return status;

     for (const auto& gain : ch.rx.gain)
     {
@@ -1255,6 +1248,15 @@ OpStatus LMS7002M_SDRDevice::LMS7002ChannelConfigure(LMS7002M& chip, const Chann
     {
         SetGain(0, TRXDir::Tx, channelIndex, gain.first, gain.second);
     }
+
+    // Rx LPF configuration modifies Rx PGA
+    status = chip.SetRxLPF(ch.rx.lpf);
+    if (status != OpStatus::Success)
+        return status;
+    status = chip.SetTxLPF(ch.tx.lpf);
+    if (status != OpStatus::Success)
+        return status;
+
     return status;
 }

diff --git a/src/chips/LMS7002M/gainCalibrations.cpp b/src/chips/LMS7002M/gainCalibrations.cpp
index 3a79c9b1..a046697e 100644
--- a/src/chips/LMS7002M/gainCalibrations.cpp
+++ b/src/chips/LMS7002M/gainCalibrations.cpp
@@ -160,8 +160,12 @@ OpStatus LMS7002M::CalibrateTxGain()
             Modify_SPI_Reg_bits(LMS7002MCSR::CG_IAMP_TBB, cg_iamp);
             const uint32_t rssi = GetRSSI();
             lime::debug("CG_IAMP_TBB(%i) RSSI:0x%08X  approx. %+2.2f dBFS", cg_iamp, rssi, chip_rssi_to_dbfs(rssi));
-            if (rssi >= 0xB000) // ~ -3dBFS
+            if (rssi < previousRSSI)
+            {
+                // drop in RSSI indicates oversaturation
+                --cg_iamp;
                 break;
+            }
             previousRSSI = rssi;
         }
     }

And the difference in the registers state:

diff -u test_fail.ini test_pass.ini
--- test_fail.ini	2025-06-30 00:18:24.976627699 +0200
+++ test_pass.ini	2025-06-30 00:19:49.428757739 +0200
@@ -454,8 +454,8 @@
 //ICT_LPFH_F_TBB : 12
 //ICT_LPFLAD_F_TBB : 12
 //ICT_LPFLAD_PT_TBB : 12
-0x0108=0x090C
-//CG_IAMP_TBB : 2
+0x0108=0x3D0C
+//CG_IAMP_TBB : 15
 //ICT_IAMP_FRP_TBB : 8
 //ICT_IAMP_GG_FRP_TBB : 12
 0x0109=0x61C1
@@ -1320,7 +1320,7 @@
 0x0105=0x0015
 0x0106=0x318C
 0x0107=0x318C
-0x0108=0x090C
+0x0108=0x3D0C
 0x0109=0x61C1
 0x010A=0x3F00
 0x010B=0x0001
@@ -1848,7 +1848,7 @@
 0x05A6=0x0000
 0x05A7=0x0000
 0x0600=0x0F00
-0x0601=0x0003
+0x0601=0x003F
 0x0602=0x2000
 0x0603=0x0000
 0x0604=0xFFFF

Surely the diff from above is for investigation purposes only. Maybe procedure of test has changed, which would also be good to know as running this test kind of helps doing quick sanity check of a new setup, wiring, etc. I am not really sure what the proper fix for this would be: maybe change the gain configuration in the RFTest. I’ll let you guys to scratch heads, or point out to a user mistake :slight_smile:

Versions of software/gateware I use:
LimeSuiteNG: 2be1e53147e2d5fc1743cc0865e5df548b899fd8
LimeSDR-XTRX_GW: daacd92d2b3c4828a6df69a31a7c833917725469

Have a great day!