Heavy distortions on TX

Hi,
I don’t see CalibrateTxGain being used in SoapyLMS so I think there is no equivalent. Also I don’t see setting for changing Frontend gain in SoapyLMS. I think TX gain in SoapyLMS could be set by using ‘Tune gain’ to set frontend gain and then adjusting only TXPAD gain to control output signal level. @joshblum what do you think? If you agree I could make this change to SoapyLMS.

Another problem is that setting low frontend gain causes,obviously, output signal to be lower,
For example, with default gain=37, I get around -1 dBm output signal.
With “proper” gain=4, I get around -20 dB signal.
So, right now, there is trade-off between output power and signal quality.

Sure I’m happy to change anything. So in short, something like this:

diff --git a/SoapyLMS7/Settings.cpp b/SoapyLMS7/Settings.cpp
index ee016de..53d2a6c 100644
--- a/SoapyLMS7/Settings.cpp
+++ b/SoapyLMS7/Settings.cpp
@@ -443,6 +443,7 @@ void SoapyLMS7::setGain(const int direction, const size_t channel, const std::st
 
     else if (direction == SOAPY_SDR_TX and name == "PAD")
     {
+        rfic->CalibrateTxGain(0, nullptr);
         rfic->SetTRFPAD_dB(value);
     }

@IgnasJ In general, I have noticed a lot of implementation details moving into the higher layer LMS7_Device, rather than the LMS7002M class. Should the pad implementation in LMS7_Device::SetGain be moved to LMS7002M::SetTRFPAD_dB? Or should SoapyLMS switch over to using LMS7_Device class nowadays? What do you think about that?

Yes, it could be as simple as that. But I think it would be good to also add ability to set ‘frontend gain’ over the recommended value (set by CalibrateTxGain) once TXPAD gain is maxed out.

LMS7_Device was added to implement higher level functionality that is exposed through LimeSuite.h. LMS7_Device::SetGain sets combined TX/RX gain, so it not entirely correct to move TX part to LMS7002M::SetTRFPAD_dB as it also sets frontend gain (IAMP_TBB), not PAD gain (TXPAD_TRF) only.
If functionality provided by LMS7_Device class suits Soapy needs then I think is would be good to switch to using LMS7_Device. This way fixes/improvements to both SoapySDR and LMS API (from LimeSuite.h) could be made by modifications in a single place.

When the new version of API with correct calibration procedure will be available?

Ok, so all of the distortions are caused by frontend amplifier.
Any of values, except of 0 (off) and 1 (minimal gain) give acceptable results.
Every other gain results in some level of distortions.
Any ideas what causes it to distort signal at any level of gain?