Can't connect to my RSP1A (Linux, command line)

Post your feedback here
xoflg
Posts: 5
Joined: Sat Dec 02, 2017 3:42 pm

Can't connect to my RSP1A (Linux, command line)

Post by xoflg » Sat Dec 02, 2017 4:22 pm

Hi,

I got my RSP1A (sn: 1712022793) two weeks ago. I installed SDRplay_RSP_API-Linux-2.11.1.run on my PC (Ubuntu 14.05 but I also tried on a newer version).

Code: Select all

$ lsusb
...
Bus 001 Device 029: ID 1df7:3000
...
However, (this may vary but I always get an error somewhere)

Code: Select all

$ dmesg
...
[ 3180.584339] usb 1-1.4: new high-speed USB device number 26 using ehci-pci
[ 3180.688761] usb 1-1.4: device descriptor read/all, error -71
[ 3180.764333] usb 1-1.4: new high-speed USB device number 27 using ehci-pci
[ 3180.868749] usb 1-1.4: device descriptor read/all, error -71
[ 3180.944330] usb 1-1.4: new high-speed USB device number 28 using ehci-pci
[ 3180.976746] usb 1-1.4: device descriptor read/8, error -71
[ 3181.108738] usb 1-1.4: device descriptor read/8, error -71
[ 3181.284318] usb 1-1.4: new high-speed USB device number 29 using ehci-pci
[ 3181.515603] usb 1-1.4: New USB device found, idVendor=1df7, idProduct=3000
[ 3181.515608] usb 1-1.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3181.519764] usb 1-1.4: can't set config #1, error -71
I found some code on this community forum called 'rawIQ' which uses the API. It compiles nicely but

Code: Select all

$ ./rawIQ
Parameters:
   GainReduction   = 40dB	[default]
   SampleRate      = 2.048MHz	[default]
   CentreFrequency = 176.640MHz	[default]
   Bandwidth       = 1.536MHz	[default]
   IfFrequency     = 0.000MHz	[default]
mir_sdr_Init: Error 7
mir_sdr_init() is the first call to the API and the error code 7 is (according to SDRplay_SDR_API_Specification.pdf (2.11)) is mir_sdr_HwError.

I also tried SoapySDR (also builds nicely) as suggested somewhere else :

Code: Select all

$ ./SoapySDR/build/apps/SoapySDRUtil --probe=sdrplay
######################################################
## Soapy SDR -- the SDR abstraction library
######################################################

Probe device sdrplay

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=null
  hardware=null

----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 0 Rx, 0 Tx
  Timestamps: NO
Am I missing something? I tried with 2 different USB cables (about 5 feet long...). I ordered a shorter one. Could it be critical?

Any other idea?

Thank you,

xof (xoflg)
Last edited by xoflg on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

Paul
Posts: 355
Joined: Fri Feb 17, 2017 9:52 am
Location: SW UK

Re: Can't connect to my RSP1A (Linux, command line)

Post by Paul » Sat Dec 02, 2017 7:12 pm

I may be being naive, but I see no mention of the Cubic programme that I believe is necessary to run an RSP under Linux.
I chickened out and use windows.

Reason: No reason

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

Re: Can't connect to my RSP1A (Linux, command line)

Post by sdrplay » Sat Dec 02, 2017 10:00 pm

CubicSDR is an end application and, if you are writing your own software, not strictly necessary.

Error code 7 is a hardware error. I would make sure you are using a USB 2.0 port. I would also make sure you've rebooted after installing the API. If you have one, it's worth checking functionality using an external mains powered USB 2.0 hub. This may be useful to pinpoint where the problem is.

It's also a good idea to confirm that it's a Linux issue by trying the RSP on a Windows machine, if you have access to one.

What processor are you using? Also, check that the contents of /etc/udev/rules.d/66-mirics.rules has 3 entries

Best regards,

SDRplay Support

Reason: No reason

xoflg
Posts: 5
Joined: Sat Dec 02, 2017 3:42 pm

Re: Can't connect to my RSP1A (Linux, command line)

Post by xoflg » Sun Dec 03, 2017 4:11 pm

Thank you for the answer.

I bought a shorter (3ft) et better USB cable (wiith 'Heavy-Gauge Power Wires') and don't get syslog error messages any more.

Code: Select all

$ dmesg
...
[  423.083445] usb 1-1.4: new high-speed USB device number 4 using ehci-pci
[  423.175990] usb 1-1.4: New USB device found, idVendor=1df7, idProduct=3000
[  423.175994] usb 1-1.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
But 'rawIQ' still gives the error '7'.

My processor is a 'GenuineIntel : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz' (/proc/cpuinfo)
uname -> Linux ubuntu-desktop 3.13.0-105-generic #152-Ubuntu SMP Fri Dec 2 15:37:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
and /etc/udev/rules.d/66-mirics.rules contains 3 rules (for idProduct 2500, 3010, 3000)

I tried to monitor USB activity with 'usbmon'

Code: Select all

$ sudo cat /sys/kernel/debug/usb/usbmon/1u
...
ffff880094ae43c0 737164453 C Ci:1:005:0 0 18 = 12010002 ffffff40 f71d0030 00020000 0001
...
There is a lot of activity when I plug (or unplug) the USB. I just show the line with the idVendor=1df7, idProduct=3000 when I plug it. I am not used to USB debugging, so I can not interpret the many lines that I get. However, when running 'rawIQ', there seems to be no activity on the USB bus. It is 'as if' the kernel answered something that doesn't please the API's 'mir_sdr_Init()'. Something that the kernel already knows. Or mir_sdr_init() is sending something the kernel doesn't accept.

Looking into the API documentation, I found 'mir_sdr_DebugEnable()' which I added to rawIQ.c. It now gives

Code: Select all

$ ./rawIQ 
Parameters:
   GainReduction   = 40dB	[default]
   SampleRate      = 2.048MHz	[default]
   CentreFrequency = 176.640MHz	[default]
   Bandwidth       = 1.536MHz	[default]
   IfFrequency     = 0.000MHz	[default]
mir_sdr_Init: starting hardware initialization
mir_sdr_Init: gR=40dB fs=2.048MHz rf=176.640MHz bw=1.536MHz if=0.000MHz
DownConvert: Enable=0 DecM=1 OutScale=0 (fs=2.048000 bw=1536 if=0)
initState: numActivePackets=4
mir_sdr_usb_USB DLL: Revision 0.1.1
Opened device with idVendor = 0x1df7 idProduct = 0x3000 fwVersion = 0x0200 busNum = 001 portNum = 004
Error: libusb_get_string_descriptor_ascii() -2
mir_sdr_usb_Init: Timeout expired/failed to establish connection with the device
mir_sdr_2500_Init: mir_sdr_usb_Init() failed
mir_sdr_Init: mir_sdr_2500_Init() Error 1
mir_sdr_Init: Error 7
It seems that It is 'libusb_get_string_descriptor_ascii()' that fails. Could also be the timeout stuff but as there is no USB activity, It is doubtfull. I don't remember exactly what is 'usb string descriptor'... I am running out of time right now, I will pursue the investigation next week-end. Maybe I'll give a try to the unsupported reverse-engineered 'open source' driver (just to see how it looks like and what the RSP1A answers; don't shoot at me ;-) ).

By the way, shouldn't there be some firmware to upload to the device? (I saw something like that with an other mirics product)

Thank you
Last edited by xoflg on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

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

Re: Can't connect to my RSP1A (Linux, command line)

Post by sdrplay » Sun Dec 03, 2017 9:26 pm

Error code 7 is a hardware error. I would make sure you are using a USB 2.0 port. I would also make sure you've rebooted after installing the API. If you have one, it's worth checking functionality using an external mains powered USB 2.0 hub. This may be useful to pinpoint where the problem is.

Reason: No reason

xoflg
Posts: 5
Joined: Sat Dec 02, 2017 3:42 pm

Re: Can't connect to my RSP1A (Linux, command line)

Post by xoflg » Sat Dec 09, 2017 8:08 pm

I did.

I am using an USB 2.0 port, I rebooted and I checked with a powered USB 2.0 (Dlink DUB H7). Same error code 7. (I have no Windows PC)

Code: Select all

$ lsusb
...
Bus 001 Device 004: ID 1df7:3000
...
A Chinese 'CHARGER Doctor' indicates that the device does not draw much current (something like 0.06A, like an Arduino nano clone)

I don't know what you mean by 'hardware error'. It doesn't seem to be 'no suitable device found' as lsusb indicates that there is a Mirics device on the bus. I don't know what this '3000' device is, however...

With no device connected I get :

Code: Select all

$ ./rawIQ 
Parameters:
   GainReduction   = 40dB	[default]
   SampleRate      = 2.048MHz	[default]
   CentreFrequency = 176.640MHz	[default]
   Bandwidth       = 1.536MHz	[default]
   IfFrequency     = 0.000MHz	[default]
mir_sdr_Init: starting hardware initialization
mir_sdr_Init: gR=40dB fs=2.048MHz rf=176.640MHz bw=1.536MHz if=0.000MHz
DownConvert: Enable=0 DecM=1 OutScale=0 (fs=2.048000 bw=1536 if=0)
initState: numActivePackets=4
mir_sdr_usb_USB DLL: Revision 0.1.1
mir_sdr_usb_Init: Timeout expired/failed to establish connection with the device
mir_sdr_2500_Init: mir_sdr_usb_Init() failed
mir_sdr_Init: mir_sdr_2500_Init() Error 1
mir_sdr_Init: Error 7
That is correct. The message is not 'no suitable device found' but the same 'Error 7'.

When I connect the RSP1A, I get a different answer :

Code: Select all

$ ./rawIQ 
Parameters:
   GainReduction   = 40dB	[default]
   SampleRate      = 2.048MHz	[default]
   CentreFrequency = 176.640MHz	[default]
   Bandwidth       = 1.536MHz	[default]
   IfFrequency     = 0.000MHz	[default]
mir_sdr_Init: starting hardware initialization
mir_sdr_Init: gR=40dB fs=2.048MHz rf=176.640MHz bw=1.536MHz if=0.000MHz
DownConvert: Enable=0 DecM=1 OutScale=0 (fs=2.048000 bw=1536 if=0)
initState: numActivePackets=4
mir_sdr_usb_USB DLL: Revision 0.1.1
Opened device with idVendor = 0x1df7 idProduct = 0x3000 fwVersion = 0x0200 busNum = 001 portNum = 004
Error: libusb_get_string_descriptor_ascii() -2
mir_sdr_usb_Init: Timeout expired/failed to establish connection with the device
mir_sdr_2500_Init: mir_sdr_usb_Init() failed
mir_sdr_Init: mir_sdr_2500_Init() Error 1
mir_sdr_Init: Error 7
It is the same 'hardware error' at the end but the device has been opened and it's firmware version is 0x0200. I don't know why mir_sdr_2500_Init() fails as I seem to have a '3000' device. Maybe they are similar enough to share the same routine(?). Who knows? I have not been able to find any documentation on a '3000' device. And I don't understand why it needs to libusb_get_string_descriptor_ascii(). (I don't need it and my system did not know that '1d7f:3000' is a SDRPlay RSP1A. In fact, I don't know (yet) where this string is supposed to come from (a system file (I think, /var/lib/usbutils/usb.ids where adding something for 1df7:3000 did not help) or from within the device (I doubt)). Finally, -2 seems to be LIBUSB_ERROR_INVALID_PARAM which looks like a programming error (?).


xof
Last edited by xoflg on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

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

Re: Can't connect to my RSP1A (Linux, command line)

Post by sdrplay » Sun Dec 10, 2017 7:35 am

3000 means that it's a RSP1A

I noticed that in the posts you made above, that you haven't built or installed SoapySDRPlay. This is required for SoapySDR to be able to communicate with the RSP. Once you've built and installed it and then run SoapySDRUtil --info, you should see that sdrplay is now available as a device. Then I would suggest trying SoapySDRUtil --find=sdrplay and also SoapySDRUtil --probe=sdrplay - if you've got everything right in the rawIQ code then you should see the same result, but it's worth confirming what SoapySDRPlay finds.

Can you also confirm if this is a 32bit or 64bit machine?

The firmware version shouldn't be 200, it will start as 200 but after initialisation it should be either 206 or 207 I believe. This all points to libusb being the issue. Can you also confirm whether you have the stock version of libusb or whether you have a specific verison from http://libusb.info ?

Best regards,

SDRplay Support

Reason: No reason

xoflg
Posts: 5
Joined: Sat Dec 02, 2017 3:42 pm

Re: Can't connect to my RSP1A (Linux, command line)

Post by xoflg » Sun Dec 10, 2017 2:25 pm

Thank you for the answer.

I did build and install SoapySDRPlay but I wasn't aware it was mandatory.

I have 64bit machines. I use libusb-1.0 (on my newest system LIBUSB_API_VERSION = 0x1000104).

When I installed SoapySDR, I saw :

Code: Select all

SoapySDR/build$ sudo make install
...
-- Installing: /usr/local/include/SoapySDR/Constants.h
-- Installing: /usr/local/include/SoapySDR/Device.h 
-- Installing: /usr/local/lib/libSoapySDR.so.0.6.1 
-- Installing: /usr/local/lib/libSoapySDR.so.0.6   
-- Installing: /usr/local/lib/libSoapySDR.so
-- Installing: /usr/local/lib/pkgconfig/SoapySDR.pc
-- Installing: /usr/local/bin/SoapySDRUtil
...
However, when I run

Code: Select all

$ SoapySDRUtil --info
######################################################
## Soapy SDR -- the SDR abstraction library
######################################################

Lib Version: v0.6.1-gba9ad2d2
API Version: v0.6.0
ABI Version: v0.6
Install root: /usr/local
Search path: /usr/local/lib/SoapySDR/modules0.6
No modules found!
Loading modules... done
Available factories...null, 
I have no /usr/local/lib/SoapySDR directory. I however have some SoapySDR stuff in /usr/local/lib.

Code: Select all

$ find /usr/local/lib/ |grep -i soapy
/usr/local/lib/libSoapySDR.so
/usr/local/lib/libSoapySDR.so.0.6.1
/usr/local/lib/python3/dist-packages/SoapySDR.py
/usr/local/lib/python3/dist-packages/_SoapySDR.so
/usr/local/lib/pkgconfig/SoapySDR.pc
/usr/local/lib/python2.7/dist-packages/SoapySDR.py
/usr/local/lib/python2.7/dist-packages/_SoapySDR.so
/usr/local/lib/libSoapySDR.so.0.6
If there is some firmware to load into the RSP1A, I don't know its name, where it is supposed to be located and where I can get it. As I understand it SoapySDR is something generic 'vendor independent'... The vendor dependent stuff seems to be located in another 'SoapyRemote' branch...(?) So I also 'git clone' the SoapyRemote stuff, built, installed it. And got the missing directories.

Code: Select all

$ sudo systemctl start SoapySDRServer
$ SoapySDRUtil --info
######################################################
## Soapy SDR -- the SDR abstraction library
######################################################

Lib Version: v0.6.1-gebd6ce31
API Version: v0.6.0
ABI Version: v0.6
Install root: /usr/local
Search path: /usr/local/lib/SoapySDR/modules0.6
Module found: /usr/local/lib/SoapySDR/modules0.6/libremoteSupport.so
Loading modules... done
Available factories...null, remote, 
It now does find some 'module' (whatever it is). But there is no firmware download, it stays '0x0200' and I still get the 7 'hardware error' :

Code: Select all

$ ./rawIQ 
Parameters:
   GainReduction   = 40dB	[default]
   SampleRate      = 2.048MHz	[default]
   CentreFrequency = 176.640MHz	[default]
   Bandwidth       = 1.536MHz	[default]
   IfFrequency     = 0.000MHz	[default]
mir_sdr_Init: starting hardware initialization
mir_sdr_Init: gR=40dB fs=2.048MHz rf=176.640MHz bw=1.536MHz if=0.000MHz
DownConvert: Enable=0 DecM=1 OutScale=0 (fs=2.048000 bw=1536 if=0)
initState: numActivePackets=4
mir_sdr_usb_USB DLL: Revision 0.1.1
Opened device with idVendor = 0x1df7 idProduct = 0x3000 fwVersion = 0x0200 busNum = 001 portNum = 001
Error: libusb_get_string_descriptor_ascii() -2
mir_sdr_usb_Init: Timeout expired/failed to establish connection with the device
mir_sdr_2500_Init: mir_sdr_usb_Init() failed
mir_sdr_Init: mir_sdr_2500_Init() Error 1
mir_sdr_Init: Error 7
As an old school boy, I don't understand why everything gets so complicated. Years ago, I just had to place some .fw file in /lib/firmware/ and some mechanism I don't remember the name uploaded the firmware when I plugged the USB device. I could then write a simple program to open the device and exchange commands and data with it. I did not have to install a bunch of software which, were they documented, would fill an entire library. I suppose I am getting old...

I understand it is a (completely) new product, that the API and Linux branch are not mainstream. I am ready to make some effort. I just hope the solution is not too far away. So, if there is a firmware > 0x0200, where is it? and how do I upload it? I am not sure I'll be able to progress before next week-end. I have busy weeks.

Thank you,

xof
----------
'SoapySDRUtil --find=sdrplay' and 'SoapySDRUtil --probe=sdrplay' don't find any device but, it is funny, the SoapySDRServer on my other machine reacts).
Last edited by xoflg on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

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

Re: Can't connect to my RSP1A (Linux, command line)

Post by sdrplay » Sun Dec 10, 2017 5:56 pm

I think there's a couple of things going on here. I don't believe the SoapySDR issue is related to the error you are seeing with the rawIQ program, but I don't understand how the SoapySDRPlay library isn't there. If you have git cloned SoapySDR and SoapySDRPlay and built/installed SoapySDR first and then SoapySDRPlay afterwards, the SDRplay library should be there (unless there was an error in the SoapySDRPlay build?)

The firmware is a runtime load through the API - it's a seamless process, but the fact that it's not happening is an indication that the issue is related to libusb.

I'm not sure what version that libusb version number refers to. Unfortunately it only gets incremented when there is a major API change, so multiple libusb releases could have the same version number. The RSP API will not currently work with libusb greater than 1.0.19

Best regards,

SDRplay Support

Reason: No reason

xoflg
Posts: 5
Joined: Sat Dec 02, 2017 3:42 pm

Re: Can't connect to my RSP1A (Linux, command line)

Post by xoflg » Sun Dec 17, 2017 3:23 pm

Hi,

I checked the libusb-1.0 version with 'apt-cache show libusb-1.0:

Code: Select all

Ubuntu 14.04.5 LTS$ apt-cache show libusb-1.0 |grep Version
Version: 2:1.0.17-1ubuntu2
...
and

Code: Select all

Ubuntu 16.04.3 LTS$ $ apt-cache show libusb-1.0 |grep Version
Version: 2:1.0.20-1
...
You wrote that I needed the Soapy stuff; I had no problem to install it and run it. As I can not find any 'mir_sdr' string in it, I doubt it was of any use.

I just realized that the mir_sdr_Init() of the rawIQ is 'no longer supported' (3.3 API specs). So I copied (with some difficulty) the sample code embedded in the API specs .pdf file. The result is the same : error 7 and firmware version 0x0200.

Could you please provide me a sample of 'C' code (like 'rawIQ.c) and recommend me a Linux 'live CD' where I can install the API (possibly by running 'SDRplay_RSP_API-Linux-2.11.1.run (*)), compile and run the program?

Next week, I'll have more time.


xof
-------------
(*) Linux users don't like to blindly run unknown programs on their machines.
All this reminds me the origin of Richard Stallman's crusade.
Last edited by xoflg on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

Post Reply