LimeSDR-mini I/Q problem

I use C++ to control the LimeSDR-mini.
So, one of my test is set high TX and RX Gain.
rx_buffer[2 * j] and rx_buffer[2 * j + 1] is the I/Q value.

But when I calculate the Magnitudes, it’s construct a square.
And I find, I or Q seems has a threshold equal 1.

What happened to the LimeSDR-mini or just my wrong setting?
But when I decrease it, it’s seems good.

What’s more, when the gain, increase, the I/Q value construct a circle, it’s become very unstable. it’s seems like the DC offset. is their any way to deal with this problems. because now, I am trying to use LimeSDR-mini as a VNA, send the signal through the antenna to sensor and use TDD mode to receive the signal. is their any fast way to scan controlled by C++?

Sincerely,

You can use DC corrector to reduce LO leak but I would sugest to avoid “center of the screen”, at least 30-40kHz. Use software complex oscillator to transport desired signal to left or right half of the screen. It is also possible to reduce LO leakage bump with software but it is only for estetic reasons. Don’t forget to perform receive and transmit calibration!
With correct sample rate choice you can have very linear part of the RF spectrum for transmit and receive function.

Thank you so much.
So here:
LMS_Calibrate(device, LMS_CH_TX.0.10e6,0);
LMS_Calibrate(device, LMS_CH_RX.0.10e6,0);
if the right for receive and transmit calibration?
About sample rate, my frequency is 250MHz, the sample rate I set is 1e6, is it suit? I found that when I increase the sample rate, the signal that on the Spectrum analyzer which shift to right, which makes me worry to increase it.

About corrector, I saw it on LimeSuite GUi, but I have no idea about on which C++ library, can you give me some ideas.

So sorry to ask some many questions.
Thank you so much

DC corrector

Sample rate depend on your signal width. For example: if signal is 10kHz width sample rate can be low as 192kHz, complex oscillator for mixing 48kHz and final signal is on the 1/4 on the right from middle of the screen (DC offset free region). RX LPF set to minimum (1.5MHz), TX LPF 10MHz. For even better results you can play with FIR filters (RX and TX).
About C++ library: find on github LimeSuite source header with all LMS API functions. No need for documentation because prameter names are self explained.