SDRPlay RSP1A application in Python (Win10)

498 views
Skip to first unread message

Jos F.M. VanderList

unread,
Mar 18, 2021, 10:51:50 AM3/18/21
to Pothos Users

Hello,
I am a radio amateur mostly experimenting with analog RF electronics, so certainly not an experienced programmer.
I have made a so-called Automatic Noise Figure Meter using a SDRPlay RSP1A as its receiver and I have used Python 3.7.9 (in Windows 10) to program the user interface and the required calculations.
The application is in D:\Python37\ANFM\ANFM_v01.py
In the same directory are SoapySDR.py, SoapySDR.dll, _SoapySDR.pyd and mir_sdr_api.dll.
And there is D:\Python37\Lib\SoapySDR\modules0.8\sdrPlaySupport.dll
The Soapy files are copied from a temporary PothosSDR installation (2019 version).
In this setup the program works, but I would like to make it an executable using the auto-py-to-exe program. That, unfortunately does not work. The RSP1A can no longer be found.
I noticed that the location of the sdrPlaySupport.dll is critical. It must be in the directory stated above or otherwise the RSP1A can not be found by the software. I think that this may be the problem that causes the problem with auto-py-to-exe. Therefore, I would like to put sdrPlaySupport.dll in the application directory but I have found no way to have the software find the dll if it is not in \Lib\SoapySDR\modules0.8.
Any ideas?
Best Regards,
Jos

righthal...@gmail.com

unread,
Mar 18, 2021, 11:35:13 PM3/18/21
to Pothos Users
I am doing something similar to run an exe. I have the exe, SoapySDR.dll, and mir_sdr_api.dll in what you would call the folder -

D:\Python37\bin

and the exe finds the sdrPlaySupport.dll in -


D:\Python37\Lib\SoapySDR\modules0.8\sdrPlaySupport.dll

it works for me and program runs fine.

Jos F.M. VanderList

unread,
Mar 19, 2021, 5:31:03 AM3/19/21
to Pothos Users
Good morning,
Thank you for your response. I am going to give your suggestion a try.
Best Regards,
Jos

Jos F.M. VanderList

unread,
Mar 19, 2021, 5:47:21 PM3/19/21
to Pothos Users
Good evening,
Unfortunately, the suggestion did not work out. Whatever I did, the only way to make the Python application find the sdrPlaySupport.dll is when it is in the \lib\modules0.8\ directory. It seems that there must be a fixed relation between the directories where my python application is and the directory where the sdrplaySupport.dll is. This is probably because I took the Python binding files for SoapySDR from the Pothos distribution. I'll have to live with it.
Best Regards,
Jos

righthal...@gmail.com

unread,
Mar 19, 2021, 10:57:08 PM3/19/21
to Pothos Users
Normally, the environment variable SOAPY_SDR_ROOT is set  to  "C:\Program Files\PothosSDR"
and everything works Ok when things are in "C:\Program Files\PothosSDR". What do you have SOAPY_SDR_ROOT set to ?

Jos F.M. VanderList

unread,
Mar 20, 2021, 5:58:20 AM3/20/21
to Pothos Users
Good morning,
I did not have a SOAPY_SDR_ROOT environment variable, since I have not installed the Pothos package. I only temporarily installed Pothos and took the SoapySDR files for Python from it. Then removed Pothos since I have no other use for it.
I did try to set the SOAPY_SDR_ROOT environment variable to several directories, but it did not help. The only thing I could achieve was that the RSP1A was not recognized at all. That could only be remedied by removing the SOAPY_SDR_ROOT environment variable and restarting the PC.
Best Regards,
Jos

righthal...@gmail.com

unread,
Mar 20, 2021, 11:16:06 AM3/20/21
to Pothos Users
If I were you, I would install "PothosSDR-2020.12.28-vc14-x64.exe" from "https://downloads.myriadrf.org/builds/PothosSDR/" (I have not tested newer versions - so I do not know if they work) and build my exe into "C:\Program Files\PothosSDR\bin" - if it does not work from there it will not work anywhere. The install will set SOAPY_SDR_ROOT correctly and you will get SoapySDRUtil.exe so you can test the module locations as you change SOAPY_SDR_ROOT. See if 

SoapySDRUtil --find

finds your RSP1A.




Jos F.M. VanderList

unread,
Mar 20, 2021, 5:50:31 PM3/20/21
to Pothos Users
Good evening,
Well, your last suggestion worked!
I built the exe (using auto-py-to-exe) with the source Python files in C:\Program Files\PothosSDR\bin.
I had to set the output directory to some directory outside \Program Files because this is protected.
At first the program did not find the RSP1A but I was able to use Process Monitor to detect which files were missing
and to find that I had to put the \lib\SoapySDR\modules0.8 directory alongside the generated output directory.
After doing that the exe worked and the RSP1A was detected without problems.
Thank you for all your help!
Best Regards,
Jos
Reply all
Reply to author
Forward
0 new messages