SoapySDR Python bindings , Pothos blocks and LimeSDR configuration registers

1,690 views
Skip to first unread message

Ioannis Kassotakis

unread,
Jul 29, 2017, 9:51:25 AM7/29/17
to Pothos Users
Hi,
I am trying to use SoapySDR functions with Python code or through Pothos Blocks with rtlsdr,limeSDR and USRP2.

1)First, trying the provided SoapySDR Python example (see below) either with rtlSDR or limeSDR, it seems that SoapySDR.Device cannot be recognized. However, both rtlSDR and limeSDR can be found with SoapySDR Utility and work OK with Pothos. Any idea what is wrong?


2) Second, is there a manual with examples on how to create a Pothos block with Python code?

3) Apart from the universal (SDR independent) commands available in SoapySDR class and accessible via Pothos SDR Source/sink arguments, is there a way to set the individual limeSDR registers either in Python code using the Soapy library or via a Pothos block? If yes, any examples?

Thanks!

Josh Blum

unread,
Jul 30, 2017, 2:00:46 AM7/30/17
to pothos...@googlegroups.com


On 07/29/2017 08:51 AM, Ioannis Kassotakis wrote:
> Hi,
> I am trying to use SoapySDR functions with Python code or through Pothos
> Blocks with rtlsdr,limeSDR and USRP2.
>
> 1)First, trying the provided SoapySDR Python example (see below) either
> with rtlSDR or limeSDR, it seems that SoapySDR.Device cannot be recognized.
> However, both rtlSDR and limeSDR can be found with SoapySDR Utility and
> work OK with Pothos. Any idea what is wrong?
>
> <https://lh3.googleusercontent.com/-W8D3jEKT7vk/WXyRANl4oUI/AAAAAAAAASU/veHVpEj4ZtIR60JnBNwhfllJEcfMTWjSwCLcBGAs/s1600/Capture.JPG>
The supported versions of python from PothosSDR installer are python 3.6
and 2.7. I see version 3.5, this error could just be the result of a
mismatch. Just a guess.

>
> 2) Second, is there a manual with examples on how to create a Pothos block
> with Python code?

This should help. Basically the cmake project installs the python code
and build a small project to load it:
https://github.com/pothosware/pothos-python/wiki#a-simple-example

There is also an example using a .conf file to skip the compile step.
The python toolkit will search certain locations for conf files and load
the blocks:
https://github.com/pothosware/pothos-demos/blob/master/jit_python_block/README.md

>
> 3) Apart from the universal (SDR independent) commands available in
> SoapySDR class and accessible via Pothos SDR Source/sink arguments, is
> there a way to set the individual limeSDR registers either in Python code
> using the Soapy library or via a Pothos block? If yes, any examples?
>
> Thanks!
>

So there is an API in SoapySDR to talk to spi directly:
https://github.com/pothosware/SoapySDR/blob/master/include/SoapySDR/Device.hpp#L1239

And it is filled in for the limesdr:
https://github.com/myriadrf/LimeSuite/blob/master/SoapyLMS7/Settings.cpp

So that should be accessible via python. The Pothos SDR source/sink
blocks dont actually export the function, but you should be able to use
both the Pothos SDR blocks and the SoapySDR Device both in the same
python process if that helps. The underlying device handle will be
shared between all of the instances, so this should be safe to do.

-josh

Ioannis Kassotakis

unread,
Jul 31, 2017, 2:58:17 AM7/31/17
to Pothos Users
Thanks Josh,

Changing to Python 3.6 along with the respective Numpy version made the example work with rtlsdr.

However, when trying the provided TX Generator example with limesdr, I got errors (see below).
The source of the problems seems to be not the example but the limeSDR.py where the a statement has wrong arguments, which is strange.
Any idea?


Josh Blum

unread,
Jul 31, 2017, 9:51:07 AM7/31/17
to pothos...@googlegroups.com


On 07/31/2017 01:58 AM, Ioannis Kassotakis wrote:
> Thanks Josh,
>
> Changing to Python 3.6 along with the respective Numpy version made the
> example work with rtlsdr.
>
> However, when trying the provided TX Generator example with limesdr, I got
> errors (see below).
> The source of the problems seems to be not the example but the limeSDR.py
> where the a statement has wrong arguments, which is strange.
> Any idea?
>
>
> <https://lh3.googleusercontent.com/-yHCLRtN8Fek/WX7UQZtCRTI/AAAAAAAAASg/D6Gns63g8FsK8UY_Llo3NyiuyxFXAz_tgCLcBGAs/s1600/Capture.JPG>

The argument is supposed to be a dictionary or a string with markup. So
you would pass
* Device('driver=lime')
* Device(dict(driver='lime'))
* Device({'driver':'lime'})

Actually that actually seems like a good API addition for the python
wrapper to support the dictionary arguments to **kwargs -josh

>
>
> On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:
>> Hi,
>> I am trying to use SoapySDR functions with Python code or through Pothos
>> Blocks with rtlsdr,limeSDR and USRP2.
>>
>> 1)First, trying the provided SoapySDR Python example (see below) either
>> with rtlSDR or limeSDR, it seems that SoapySDR.Device cannot be recognized.
>> However, both rtlSDR and limeSDR can be found with SoapySDR Utility and
>> work OK with Pothos. Any idea what is wrong?
>>
>>
>> <https://lh3.googleusercontent.com/-W8D3jEKT7vk/WXyRANl4oUI/AAAAAAAAASU/veHVpEj4ZtIR60JnBNwhfllJEcfMTWjSwCLcBGAs/s1600/Capture.JPG>

Ioannis Kassotakis

unread,
Jul 31, 2017, 1:31:11 PM7/31/17
to Pothos Users
Josh,
it seems that there is also a problem loading the lime library : LMS7Support.dll  due to a Linux/windows path mismatch  (/ vs \ ).
Is that right? Can it be fixed somehow?
 See below:



On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:

Josh Blum

unread,
Aug 6, 2017, 4:55:51 PM8/6/17
to pothos...@googlegroups.com


On 07/31/2017 12:31 PM, Ioannis Kassotakis wrote:
> Josh,
> it seems that there is also a problem loading the lime library :
> LMS7Support.dll due to a Linux/windows path mismatch (/ vs \ ).
> Is that right? Can it be fixed somehow?
> See below:
>
> <https://lh3.googleusercontent.com/-jn5BnJOfbfo/WX9pIUImk9I/AAAAAAAAASw/LOI49CrVdDEACt-v2uHsysToWibKqzWSgCLcBGAs/s1600/Capture.JPG>

The mixed path comes from the parametrized install root mixed with the
code that walks the tree looking for dlls and uses the native windows
slash. Its actually not an issue for LoadLibrary though; mixed paths are
fine.

I'm not completely sure about the error, but I have noticed that windows
can give file not found errors when it also cant find a dependency dll,
so it can be a bit ambiguous. My guess is that the dlls from c:\Program
Files\PothosSDR\bin may not be in the %PATH%

A few things that I can think of, its useful for development and command
line apps to make sure the path is modified by the install:
https://i.imgur.com/pC9uKY6.png

Check if you can run SoapySDRUtil --info and see "lime" as one of the
loaded factories.

It might also help to see if this runs (substitute your python
executable here):
C:\Python36\python.exe -c "import SoapySDR; d =
SoapySDR.Device('driver=lime')"

-josh

>
>
> On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:
>> Hi,
>> I am trying to use SoapySDR functions with Python code or through Pothos
>> Blocks with rtlsdr,limeSDR and USRP2.
>>
>> 1)First, trying the provided SoapySDR Python example (see below) either
>> with rtlSDR or limeSDR, it seems that SoapySDR.Device cannot be recognized.
>> However, both rtlSDR and limeSDR can be found with SoapySDR Utility and
>> work OK with Pothos. Any idea what is wrong?
>>
>>
>> <https://lh3.googleusercontent.com/-W8D3jEKT7vk/WXyRANl4oUI/AAAAAAAAASU/veHVpEj4ZtIR60JnBNwhfllJEcfMTWjSwCLcBGAs/s1600/Capture.JPG>

Ioannis Kassotakis

unread,
Aug 9, 2017, 10:48:54 AM8/9/17
to Pothos Users
Hi Josh,
thanks for the advice.
I checked the path and indeed  "c:\ProgramFiles\PothosSDR\bin"  has always been at the system path.
The SoapySDRUtil always finds lime without problems and the --info switch  shows that lime factory is loaded.
Trying the python command that you proposed gives the errors shown below. It seems that something is not loaded correctly...
It seems as if the lime driver cannot load although according to all indications , it is there !!?? 



On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:

Ioannis Kassotakis

unread,
Aug 9, 2017, 11:10:22 AM8/9/17
to Pothos Users
Josh,
I also tried comparing the loading of the rtlsdr and lime drivers:
It seems that with lime I get the same error that I get when I try to load the rtlsdr driver with the rtlsdr stick unplugged!
See below, first with rtlsdr unpluged --> error, then plugged --> rtlsdr found, then with limesdr plugged --> error !!

Josh Blum

unread,
Aug 10, 2017, 2:31:20 PM8/10/17
to pothos...@googlegroups.com


On 08/09/2017 10:10 AM, Ioannis Kassotakis wrote:
> Josh,
> I also tried comparing the loading of the rtlsdr and lime drivers:
> It seems that with lime I get the same error that I get when I try to load
> the rtlsdr driver with the rtlsdr stick unplugged!
> See below, first with rtlsdr unpluged --> error, then plugged --> rtlsdr
> found, then with limesdr plugged --> error !!
>
> <https://lh3.googleusercontent.com/-oX61k74UBKY/WYsl0US45fI/AAAAAAAAATc/cWvEH_K0vygR38q8-1sXVW6cD0OvJWKiwCLcBGAs/s1600/error2.JPG>

I dont see the LoadLibrary error message?
Did that get fixed, or is the program just hiding that particular output?

Can you also confirm:

- What is the python 3.6 version (python.exe --version). I will double
check my vm later to see if I'm on the latest release.

- Can you see the LimeSDR in the device manager and is the driver
loaded? http://wiki.myriadrf.org/Lime_Suite#USB_driver

- In case I forgot to ask, does LimeUtil --find see the limesdr?

-josh

>
>
> On Wednesday, August 9, 2017 at 5:48:54 PM UTC+3, Ioannis Kassotakis wrote:
>> Hi Josh,
>> thanks for the advice.
>> I checked the path and indeed "c:\ProgramFiles\PothosSDR\bin" has
>> always been at the system path.
>> The SoapySDRUtil always finds lime without problems and the --info switch
>> shows that lime factory is loaded.
>> Trying the python command that you proposed gives the errors shown below.
>> It seems that something is not loaded correctly...
>> It seems as if the lime driver cannot load although according to all
>> indications , it is there !!??
>>
>>
>> <https://lh3.googleusercontent.com/--wlbTyQVdHI/WYsgWiFhwRI/AAAAAAAAATM/AxP92MuL9O8UmA6JWZAav3mFvOwkobviQCLcBGAs/s1600/error1.JPG>
>>
>>
>> On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:
>>> Hi,
>>> I am trying to use SoapySDR functions with Python code or through Pothos
>>> Blocks with rtlsdr,limeSDR and USRP2.
>>>
>>> 1)First, trying the provided SoapySDR Python example (see below) either
>>> with rtlSDR or limeSDR, it seems that SoapySDR.Device cannot be recognized.
>>> However, both rtlSDR and limeSDR can be found with SoapySDR Utility and
>>> work OK with Pothos. Any idea what is wrong?
>>>
>>>
>>> <https://lh3.googleusercontent.com/-W8D3jEKT7vk/WXyRANl4oUI/AAAAAAAAASU/veHVpEj4ZtIR60JnBNwhfllJEcfMTWjSwCLcBGAs/s1600/Capture.JPG>

Ioannis Kassotakis

unread,
Aug 10, 2017, 4:02:47 PM8/10/17
to Pothos Users
Josh,
The Win10 Device Manager sees the limeSDR and the SoapySDRUtil finds it. The Limesuite GUI finds it as well.
LimeSDR is working properly with SDR Console v3 and with a simple Pothos Topology as a Source.
The python exe that I am using is 3.6.2-amd64, and as I have noted previously  the path to the libraries is set.

It should have been working with the TX example and I am confused why it appears that it cannot find and load the driver.....


On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:

Josh Blum

unread,
Aug 10, 2017, 9:42:51 PM8/10/17
to pothos...@googlegroups.com


On 08/10/2017 03:02 PM, Ioannis Kassotakis wrote:
> Josh,
> The Win10 Device Manager sees the limeSDR and the SoapySDRUtil finds it.
> The Limesuite GUI finds it as well.
> LimeSDR is working properly with SDR Console v3 and with a simple Pothos
> Topology as a Source.
> The python exe that I am using is 3.6.2-amd64, and as I have noted
> previously the path to the libraries is set.

I saw the error, when it worked with command line apps, and failed in
python. Very suspicious... Its a stretch, but the PothosSDR installer
builds against python 3.6.1 amd64, and I wonder if there is an ABI
incompatibility between 3.6.1 and 3.6.2. I should update the next
installer for 3.6.2, but in the meantime can you try 3.6.1-amd64?

-josh

>
> It should have been working with the TX example and I am confused why it
> appears that it cannot find and load the driver.....
>
>
> On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:
>> Hi,
>> I am trying to use SoapySDR functions with Python code or through Pothos
>> Blocks with rtlsdr,limeSDR and USRP2.
>>
>> 1)First, trying the provided SoapySDR Python example (see below) either
>> with rtlSDR or limeSDR, it seems that SoapySDR.Device cannot be recognized.
>> However, both rtlSDR and limeSDR can be found with SoapySDR Utility and
>> work OK with Pothos. Any idea what is wrong?
>>
>>
>> <https://lh3.googleusercontent.com/-W8D3jEKT7vk/WXyRANl4oUI/AAAAAAAAASU/veHVpEj4ZtIR60JnBNwhfllJEcfMTWjSwCLcBGAs/s1600/Capture.JPG>

Ioannis Kassotakis

unread,
Aug 13, 2017, 1:07:36 PM8/13/17
to Pothos Users
Josh,
unfortunately I cannot install 3.6.1 without removing 3.6.2 (I get an error from the installer) and I do not want to do that because I have several other applications depending on it.
 I will try installing 3.6.1 later this week at my older computer just to check if python version gives the error.
Thanks!


On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:

Josh Blum

unread,
Aug 13, 2017, 5:28:17 PM8/13/17
to pothos...@googlegroups.com


On 08/13/2017 12:07 PM, Ioannis Kassotakis wrote:
> Josh,
> unfortunately I cannot install 3.6.1 without removing 3.6.2 (I get an error
> from the installer) and I do not want to do that because I have several
> other applications depending on it.
> I will try installing 3.6.1 later this week at my older computer just to
> check if python version gives the error.
> Thanks!
Good news then. I uploaded a new installer that was built against python
3.6.2:

http://downloads.myriadrf.org/builds/PothosSDR/PothosSDR-2017.08.13-vc14-x64.exe

I don't understand the crash, but it seemed to be related to python, so
I hope that this addresses the problem. -josh

>
> On Saturday, July 29, 2017 at 4:51:25 PM UTC+3, Ioannis Kassotakis wrote:
>> Hi,
>> I am trying to use SoapySDR functions with Python code or through Pothos
>> Blocks with rtlsdr,limeSDR and USRP2.
>>
>> 1)First, trying the provided SoapySDR Python example (see below) either
>> with rtlSDR or limeSDR, it seems that SoapySDR.Device cannot be recognized.
>> However, both rtlSDR and limeSDR can be found with SoapySDR Utility and
>> work OK with Pothos. Any idea what is wrong?
>>
>>
>> <https://lh3.googleusercontent.com/-W8D3jEKT7vk/WXyRANl4oUI/AAAAAAAAASU/veHVpEj4ZtIR60JnBNwhfllJEcfMTWjSwCLcBGAs/s1600/Capture.JPG>
Reply all
Reply to author
Forward
0 new messages