Having issue with installing soapysdr-module-lms7 on wsl Ubuntu

Hello, I am currently using Ubuntu 22.04 and trying to install LimeSuite following:

sudo add-apt-repository -y ppa:myriadrf/drivers
sudo apt-get update
sudo apt-get install limesuite liblimesuite-dev limesuite-udev limesuite-images
sudo apt-get install soapysdr-tools soapysdr-module-lms7

#soapysdr-tools use to be called just soapysdr on older packages
sudo apt-get install soapysdr soapysdr-module-lms7

However, sudo apt-get install soapysdr-tools soapysdr-module-lms7 this line seems to give error:

$ sudo apt-get install soapysdr-module-lms7
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
soapysdr0.7-module-lms7
The following NEW packages will be installed:
soapysdr-module-lms7 soapysdr0.7-module-lms7
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 62.6 kB of archives.
After this operation, 160 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 Index of /myriadrf/drivers/ubuntu jammy/main amd64 soapysdr0.7-module-lms7 amd64 23.11.0-1 [54.8 kB]
Get:2 Index of /myriadrf/drivers/ubuntu jammy/main amd64 soapysdr-module-lms7 all 23.11.0-1 [7788 B]
Fetched 62.6 kB in 0s (332 kB/s)
Selecting previously unselected package soapysdr0.7-module-lms7:amd64.
(Reading database … 51564 files and directories currently installed.)
Preparing to unpack …/soapysdr0.7-module-lms7_23.11.0-1_amd64.deb …
Unpacking soapysdr0.7-module-lms7:amd64 (23.11.0-1) …
dpkg: error processing archive /var/cache/apt/archives/soapysdr0.7-module-lms7_23.11.0-1_amd64.deb (–unpack):
trying to overwrite ‘/usr/lib/x86_64-linux-gnu/SoapySDR/modules0.8/libLMS7Support.so’, which is also in package soapysdr0.8-module-lms7:amd64 20.10.0+dfsg-5
Selecting previously unselected package soapysdr-module-lms7.
Preparing to unpack …/soapysdr-module-lms7_23.11.0-1_all.deb …
Unpacking soapysdr-module-lms7 (23.11.0-1) …
Errors were encountered while processing:
/var/cache/apt/archives/soapysdr0.7-module-lms7_23.11.0-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

is there anyway i can fix this issue?

Thanks

Looks like packaging issue, the soapysdr0.7-module-lms7 actually installs into soapysdr0.8. So two separate packages have the same file.

You can try to first remove apt-get remove soapysdr0.8-module-lms7 package first, and then install apt-get install soapysdr-module-lms7

Thank you very much it worked well.

Now I am using LimeSDR-USB to transmit and receive signals in real-time. I have written a script to generate a transmission signal and use the LimeSDR device for both transmission and reception. However, when running the code, I encounter the [ERROR] USB transfer stalled error.
I installed usbipd for sdr to be recognised on wsl2 Ubuntu.

I am unsure whether the error is caused by a problem with the code or if there is an issue with the USB connection itself, so I am attaching the code here for review.

import SoapySDR
import numpy as np
import threading
import time
from SoapySDR import SOAPY_SDR_RX, SOAPY_SDR_TX, SOAPY_SDR_CF32

Initialize SDR device

sdr = SoapySDR.Device(dict(driver=“lime”))

Common settings

sample_rate = 1e6
center_freq = 2.4e9
tx_gain = 30
rx_gain = 30

Configure TX

sdr.setSampleRate(SOAPY_SDR_TX, 0, sample_rate)
sdr.setFrequency(SOAPY_SDR_TX, 0, center_freq)
sdr.setGain(SOAPY_SDR_TX, 0, tx_gain)

Configure RX

sdr.setSampleRate(SOAPY_SDR_RX, 0, sample_rate)
sdr.setFrequency(SOAPY_SDR_RX, 0, center_freq)
sdr.setGain(SOAPY_SDR_RX, 0, rx_gain)

Setup streams

tx_stream = sdr.setupStream(SOAPY_SDR_TX, SOAPY_SDR_CF32, [0])
rx_stream = sdr.setupStream(SOAPY_SDR_RX, SOAPY_SDR_CF32, [0])

Activate streams

sdr.activateStream(tx_stream)
sdr.activateStream(rx_stream)

TX function

def transmit():
t = np.arange(1024) / sample_rate
tx_signal = 0.5 * np.exp(2j * np.pi * 100e3 * t).astype(np.complex64)
while True:
sdr.writeStream(tx_stream, [tx_signal], len(tx_signal))
time.sleep(0.1)

RX function

def receive():
rx_buffer = np.zeros(1024, np.complex64)
while True:
sr = sdr.readStream(rx_stream, [rx_buffer], len(rx_buffer))
if sr.ret > 0:
process_received_data(rx_buffer[:sr.ret])

Placeholder for processing received data

def process_received_data(data):
pass

Start TX and RX threads

tx_thread = threading.Thread(target=transmit)
rx_thread = threading.Thread(target=receive)
tx_thread.start()
rx_thread.start()

Run for a specified duration

time.sleep(10)

Cleanup

sdr.deactivateStream(tx_stream)
sdr.deactivateStream(rx_stream)
sdr.closeStream(tx_stream)
sdr.closeStream(rx_stream

Any help on how to fix this error would be greatly appreciated!

You are running USB through WSL2 virtualization layer, and the transaction stall is happening at the USB protocol level. So the problem is caused not by your code, but by the WSL2 or usbipd. I’ve never encountered a stalled transcation when using native drivers, so unfortunately I cannot help you with virtualization issues.

things to check:
after error, without unplugging the device, does it still work if you run the software again?
Does Windows report any issues with the usb device in windows device manager?
Is your LimeSDR-USB powered only by the USB port (2.0, 3.0?), or are you using external power? LimeSDR-USB can draw quite a lot of power from the usb port, some systems might not be able to provide that much causing a device brownout (device still visible by system, but fails to communicate, needs unplug/reinsert to start working again)

I assume that you have done the -

usbipd list
usbipd bind --busid 1-23
usbipd attach --wsl --busid 1-23

that is appropriate for your device.

I have Ubuntu-24.04 install on WSL2 and I can use the SoapySDR routines from C with no problem to transmit and receive with the LimeSDR v2.0. I tied your routine with python3, but the best that I can get is “_SoaySDR” not found and I could not get pip3 to install “time” or “threading”

does it still work if you run the software again?

  • Yes it does but it gives same error every time.

Does Windows report any issues with the usb device in windows device manager?
-It doesn’t report any issues in windows device manager.

Is your LimeSDR-USB powered only by the USB port (2.0, 3.0?), or are you using external power?
-It is only powered by USB port.

On the other hand, when I run the code in windows environment, [ERROR] USB transfer stalled error. no longer appears. Therefore, I am now considering working in Windows.
However, instead of previous error, another errors written below occur:

[INFO] Make connection: ‘LimeSDR-USB [USB 3.0] 90706024F2436’
[INFO] Reference clock 30.72 MHz
[INFO] Device name: LimeSDR-USB
[INFO] Reference: 30.72 MHz
[INFO] LMS7002M register cache: Disabled
[INFO] Filter calibrated. Filter order-4th, filter bandwidth set to 5 MHz.Real pole 1st order filter set to 2.5 MHz. Preemphasis filter not active
[INFO] TX LPF configured
[INFO] RX LPF configured
[ERROR] Tx Calibration: MCU error 5 (Loopback signal weak: not connected/insufficient gain?)
[ERROR] Rx calibration: MCU error 5 (Loopback signal weak: not connected/insufficient gain?)

It seems those errors occur due to my ignorance in setting up the SDR. Can you guide me any website or tutorial so that i can follow steps and test with python code to check whether my SDR works or not?

thank you very much

sadly I have no experience of C :frowning: so i think i should stick with python.
but thank you very much!

I tried to run your example on Ubuntu 22.04 - it just hung and would not stop. Your program has no way to stop and join the threads. When I added that, it worked OK. -

import SoapySDR
import numpy as np
import threading
import time
from SoapySDR import SOAPY_SDR_RX, SOAPY_SDR_TX, SOAPY_SDR_CF32
sdr = SoapySDR.Device(dict(driver='lime'))
sample_rate = 1e6
center_freq = 2.4e9
tx_gain = 30
rx_gain = 30
sample_rate = 1e6
center_freq = 2.4e9
tx_gain = 30
rx_gain = 30
sdr.setSampleRate(SOAPY_SDR_TX, 0, sample_rate)
sdr.setFrequency(SOAPY_SDR_TX, 0, center_freq)
sdr.setGain(SOAPY_SDR_TX, 0, tx_gain)
sdr.setSampleRate(SOAPY_SDR_RX, 0, sample_rate)
sdr.setFrequency(SOAPY_SDR_RX, 0, center_freq)
sdr.setGain(SOAPY_SDR_RX, 0, rx_gain)
tx_stream = sdr.setupStream(SOAPY_SDR_TX, SOAPY_SDR_CF32, [0])
rx_stream = sdr.setupStream(SOAPY_SDR_RX, SOAPY_SDR_CF32, [0])
sdr.activateStream(tx_stream)
sdr.activateStream(rx_stream)

do_run=True;

def transmit():
	t = np.arange(1024) / sample_rate
	tx_signal = 0.5 * np.exp(2j * np.pi * 100e3 * t).astype(np.complex64)
	while True:
		sdr.writeStream(tx_stream, [tx_signal], len(tx_signal))
		if do_run == False:
			break;

def receive():
	rx_buffer = np.zeros(1024, np.complex64)
	while True:
		sr = sdr.readStream(rx_stream, [rx_buffer], len(rx_buffer))
		if sr.ret > 0:
			process_received_data(rx_buffer[:sr.ret])
		if do_run == False:
			break;


def process_received_data(data):
	pass
	
	


tx_thread = threading.Thread(target=transmit)
rx_thread = threading.Thread(target=receive)
tx_thread.start()
rx_thread.start()

print("Start")

time.sleep(10)

do_run = False

tx_thread.join()

rx_thread.join()

print("Stop")


sdr.closeStream(tx_stream)
sdr.closeStream(rx_stream)

sdr.deactivateStream(tx_stream)
sdr.deactivateStream(rx_stream)