[SOLVED] LimeSDR mini losing frequencies over time

Hi all,

I am trying to do a full sweep from 300MHz to 3GHz with my limeSDR mini, with an external cable connected from TX to RX.
I am using the SoapySDR API in Python.
I have noticed that, over time, I am loosing a lot of frequency points in my sweep. See pictures.
My guess is it is due to the heat. But even when the Lime is cooled down, my sweep still misses some frequencies. I can see on a spectrum analyzer that most of the lost frequencies are correctly generated, so it must be coming from the RX side.
Do you have any idea why ?
Which registers should I read to check if everything is fine ?
By setting the TX and RX PLL at the same frequency, the TDD mode should be enabled automatically, right ?
Note that I am not changing anything else (clicking default on LimeSuite before running my python script).

My code does the following:

import SoapySDR
from SoapySDR import * # SOAPY_SDR_ constants
import numpy as np
import matplotlib.pyplot as plt

freq_list = np.arange(300e6, 3e9, 10e6)
samp_rate = 20e6
tx_gain = 25
tx_bw= 5e6
rx_gain = 22
rx_bw= 5e6

# Create device instance
args = dict(driver="lime")
sdr = SoapySDR.Device(args)

# set sample rate
sdr.setSampleRate(SOAPY_SDR_TX, 0, samp_rate)
sdr.setSampleRate(SOAPY_SDR_RX, 0, samp_rate)

# set antenna
sdr.setAntenna(SOAPY_SDR_TX, 0, 'BAND2')  # <2GHz
sdr.setAntenna(SOAPY_SDR_RX, 0, 'LNAW')

# set overall gain
sdr.setGain(SOAPY_SDR_TX, 0, tx_gain)  # Set TX gain
sdr.setGain(SOAPY_SDR_RX, 0, rx_gain)  # Set RX gain

# Set same RX and TX freq to have same PLL. Use of NCO to offset and be able to measure.
sdr.setFrequency(SOAPY_SDR_TX, 0, "RF", freq_list[0])
sleep(1)
sdr.setFrequency(SOAPY_SDR_RX, 0, "RF", freq_list[0])
sdr.setFrequency(SOAPY_SDR_TX, 0, "BB", 1e6)

sleep(1)

# set bw
sdr.setBandwidth(SOAPY_SDR_TX, 0, tx_bw)  # TX BW
sdr.setBandwidth(SOAPY_SDR_TX, 0, rx_bw)  # RX BW

# Set parameters to SDR and specify data format of complex floats 32-bits (CF32)
rxStream = sdr.setupStream(SOAPY_SDR_RX, SOAPY_SDR_CF32, [0])
sleep(1)
sdr.activateStream(rxStream, SOAPY_SDR_END_BURST)
# Create a re-usable buffer for rx samples
buff = np.array([0]*1024, np.complex64)

# Receive
sr = sdr.readStream(rxStream, [buff], len(buff))
sleep(0.5)
fig, ax = plt.subplots(figsize=(15, 10))
freq_axis = np.fft.fftfreq(len(buff), d=1/samp_rate)
fft = np.abs(np.fft.fft(buff)
plt.plot(freq_axis+freq_list[0]+1e6, fft)
plt.grid(True)
plt.ion()

ant_changed =0
indexes = np.arange(len(freq_list)-1)+1
for i in indexes:
    if freq_list[i] > 2e9 and ant_changed == 0:
        ant_changed = 1
        sdr.setAntenna(SOAPY_SDR_RX, 0, 'LNAH')
        sdr.setAntenna(SOAPY_SDR_TX, 0, 'BAND1') 
        print 'Antenna changed'

    print("current freq:{} MHz".format(freq_list[i]/1e6))
    # Set same RX and TX freq to have same PLL. Use of NCO to offset and be able to measure.
    sdr.setFrequency(SOAPY_SDR_TX, 0, "RF", freq_list[i])
    sleep(1)
    sdr.setFrequency(SOAPY_SDR_RX, 0, "RF", freq_list[i])
    sdr.setFrequency(SOAPY_SDR_TX, 0, "BB", 1e6)
    sleep(1)

    sr = sdr.readStream(rxStream, [buff], len(buff))
    sleep(0.5)
    fft = np.abs(np.fft.fft(buff))
    plt.plot(freq_axis+freq_list[i]+1e6, fft)
plt.show()

Thank you in advance for your help.

first one is when hot, second when cold.


Hi,

I don’t understand how your script works. It looks to be only activating the RX module, but what about the TX?

Additional things i noticed:

  1. Why are you using sample rate of 20MHz when you need bandwidth of only 5MHz?
  2. You are using same PLL frequency for the TX and RX module, there have been issues related to this.
  3. After sr = sdr.readStream(rxStream, [buff], len(buff)), check that sr.ret == len(buff). If not, you lost samples and should probably try again.

Hi @gasparka,
Thanks for the reply.

It looks to be only activating the RX module, but what about the TX?

It’s true. I don’t activate txstream. Last time I tried I ran into warning “popping from TX, samples popped 0/1024”. Should I setup and activate txstream ?

  1. Why are you using sample rate of 20MHz when you need bandwidth of only 5MHz?

Good notice. I just forgot to change it when I did a bandwith change.

  1. You are using same PLL frequency for the TX and RX module, there have been issues related to this.

What king of issues ? Does it mean it can’t be used that way ?

  1. After sr = sdr.readStream(rxStream, [buff], len(buff)) , check that sr.ret == len(buff) . If not, you lost samples and should probably try again

I tried. Didn’t change much. But I will add it to my script anyway.

Thank you for your time!

There is a TDD mode for when Tx and Rx frequencies are the same.

Solved

It was because of heat, as I was guessing.
Adding heat sinks fixed the problem.

Picturez and thermal paste