Linux API 3.01 driver stops streaming when the sample rate is changed at around 2.685Ms/s

Add useful snippets of code or links to entire SDR projects.
Post Reply
fventuri
Posts: 37
Joined: Sun Dec 25, 2016 4:24 pm

Linux API 3.01 driver stops streaming when the sample rate is changed at around 2.685Ms/s

Post by fventuri » Sat Mar 02, 2019 7:11 pm

While running some tests on the SoapySDRPlay3 driver using the Linux API version 3.01 with my RSP2 (using tuner A, of course), I noticed something curious: whenever in CubicSDR I changed the sample rate from say 2Ms/s to 3Ms/s, after issuing the call to 'sdrplay_api_Update()', the streaming stopped completely, in other words the 'StreamACallback()' callback function was no longer being called.

In order to better reproduce and troubleshoot this issue, I took the code for the sample API application provided with the 3.01 API specification and removed all the code related to the RSPduo mode (since it is not the case here) and after a few runs, I was able to consistently reproduce the problem when changing the sample rate from any fs1 to any fs2 where fs1<=2685312 and fs2>=2685313.

I am not really sure if it is just my RSP2 (or something else specific to my setup) that is causing the problem, so I thought I would post this note and attach the source code for the C program I used to check this problem, to see if someone else has the same issue.

If it is not just me, I'll then open a support case with SDRplay.

Franco
Attachments
change_samplerate.zip
(2.23 KiB) Downloaded 199 times

Reason: No reason

ON5HB
Posts: 140
Joined: Sat Dec 29, 2018 1:07 pm

Re: Linux API 3.01 driver stops streaming when the sample rate is changed at around 2.685Ms/s

Post by ON5HB » Mon Mar 04, 2019 6:10 pm

There is no issue as it's not meant for end-users and also not stated as to be used by non-developers.

I develop myself and removed it, as it doesn't work for my project.

Reason: No reason

sdrplay
Posts: 978
Joined: Wed Jan 07, 2015 7:58 am

Re: Linux API 3.01 driver stops streaming when the sample rate is changed at around 2.685Ms/s

Post by sdrplay » Tue Mar 05, 2019 6:59 am

Thank you for the feedback Franco - could you report what version of LibUSB you have on your machine? I saw issues like this with LibUSB > 1.0.19 in the API 2.x and so we statically linked LibUSB to avoid that. I was hoping not to have to do that with the API 3.x, but if others see this as well then we may have to. I'll try out the example you've posted on my own system.

The API 3.x is in open beta for Linux so we do need more people to try it to understand if it can be rolled out across all platforms.

Best regards,

SDRplay Support

Reason: No reason

fventuri
Posts: 37
Joined: Sun Dec 25, 2016 4:24 pm

Re: Linux API 3.01 driver stops streaming when the sample rate is changed at around 2.685Ms/s

Post by fventuri » Tue Mar 05, 2019 10:45 pm

Looks like I'm on 1.0.22:

Code: Select all

$ ldd /usr/local/bin/sdrplay_apiService 
	linux-vdso.so.1 (0x00007ffcbfdad000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fce66e8e000)
	librt.so.1 => /lib64/librt.so.1 (0x00007fce66e84000)
	libusb-1.0.so.0 => /lib64/libusb-1.0.so.0 (0x00007fce66e68000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fce66cd0000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fce66b4c000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fce66986000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fce66969000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fce66ee0000)
	libudev.so.1 => /lib64/libudev.so.1 (0x00007fce66940000)
	libmount.so.1 => /lib64/libmount.so.1 (0x00007fce668e3000)
	libblkid.so.1 => /lib64/libblkid.so.1 (0x00007fce66890000)
	libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fce66887000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fce6685a000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fce667d2000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fce667cc000)

$ dnf whatprovides /usr/lib64/libusb-1.0.so.0
Last metadata expiration check: 0:15:06 ago on Tue 05 Mar 2019 05:27:10 PM EST.
libusbx-1.0.22-1.fc29.x86_64 : Library for accessing USB devices
Repo        : @System
Matched from:
Filename    : /usr/lib64/libusb-1.0.so.0

libusbx-1.0.22-1.fc29.x86_64 : Library for accessing USB devices
Repo        : fedora
Matched from:
Filename    : /usr/lib64/libusb-1.0.so.0
Franco

Reason: No reason

sdrplay
Posts: 978
Joined: Wed Jan 07, 2015 7:58 am

Re: Linux API 3.01 driver stops streaming when the sample rate is changed at around 2.685Ms/s

Post by sdrplay » Wed Mar 06, 2019 9:00 am

Hello Franco,

Thanks for that - if you are able to try 1.0.19, I would be interested in the result. I will try it myself, but it might be a while before I can get to it.

Best regards,

SDRplay Support

Reason: No reason

fventuri
Posts: 37
Joined: Sun Dec 25, 2016 4:24 pm

Re: Linux API 3.01 driver stops streaming when the sample rate is changed at around 2.685Ms/s

Post by fventuri » Thu Mar 07, 2019 1:18 am

I ran the test as you suggested and downgraded libusb to version 1.0.19 - sure enough using libusb-1.0.19 the problem went away:

Code: Select all

$ rpm -q libusbx
libusbx-1.0.19-2.fc22.x86_64

$ ./change_samplerate 2000000 3000000
fs1: 2000000.000000
fs2: 3000000.000000

MaxDevs=6 NumDevs=1
Dev0: SerNo=********** hwVer=2 tuner=0x01
chosenDevice = 0
callbacks at sample rate = fs1
    nStreamACallbacks=3840
    nStreamBCallbacks=0
    nEventCallbacks=0
callbacks at sample rate = fs2
    nStreamACallbacks=5998
    nStreamBCallbacks=0
    nEventCallbacks=0

$ ./change_samplerate 
fs1: 2685312.000000
fs2: 2685313.000000

MaxDevs=6 NumDevs=1
Dev0: SerNo=********** hwVer=2 tuner=0x01
chosenDevice = 0
callbacks at sample rate = fs1
    nStreamACallbacks=3936
    nStreamBCallbacks=0
    nEventCallbacks=0
callbacks at sample rate = fs2
    nStreamACallbacks=5375
    nStreamBCallbacks=0
    nEventCallbacks=0
Franco

Reason: No reason

Post Reply