SoapySDR icon indicating copy to clipboard operation
SoapySDR copied to clipboard

SoapySDR Python only connects to channel 0.

Open jberwald opened this issue 6 months ago • 6 comments

Hello,

Thanks for the great SoapySDR library.

I'm having an issue when connecting to Cariboulite SDR using SoapySDR. I'm pretty sure the issue is contained within SoapySDR's Python interface: I can see both of Cariboulite's channels (S1G and HiF) and use them both from SDR++ and CubicSDR. But when writing Python scripts, I am limited to using only the S1G channel. For instance, getAntenna only ever returns the S1G channel. Here is an example:

import SoapySDR        # main package
from SoapySDR import * # constants
import numpy           # buffers
import sys             # exit on error
import pprint          # pretty printer

mydriver    = "Cariboulite"      # Ref: "SoapySDRUtil --find"
mydirection = SOAPY_SDR_RX  # Interested in receiver info
mychannel   = 0             #  or 1 
stream_format = SOAPY_SDR_CS16

pp = pprint.PrettyPrinter()

print('\nDevices:')
devices = SoapySDR.Device.enumerate()
for result in devices: 
    pp.pprint(dict(result))

The above code returns the expected channels, so I know that SoapySDR can see them:

{'channel': 'S1G',
 'device_id': '0',
 'driver': 'Cariboulite',
 'label': 'CaribouLite S1G[28fc7a78]',
 'name': 'CaribouLite RPI Hat',
 'serial': '28fc7a78',
 'uuid': 'c8c3d8e6-f596-462b-a92b-d9678ec92d38',
 'vendor': 'CaribouLabs LTD',
 'version': '0x0001'}

{'channel': 'HiF',
 'device_id': '1',
 'driver': 'Cariboulite',
 'label': 'CaribouLite HiF[28fc7a79]',
 'name': 'CaribouLite RPI Hat',
 'serial': '28fc7a79',
 'uuid': 'c8c3d8e6-f596-462b-a92b-d9678ec92d38',
 'vendor': 'CaribouLabs LTD',
 'version': '0x0001'}

Unfortunately, when I call getAntenna to start trying to collect a signal I am only able to get the S1G channel:

print('\nAntennas:')
for channel in range(len(devices)):
    ants = sdr.listAntennas(mydirection, channel)

    for result in ants: pp.pprint(result)

# activate the antenna
print('\nANT:')
ant = sdr.getAntenna(mydirection, 1)
print(ant)

print('\nSetup Stream:')
rxStream = sdr.setupStream(SOAPY_SDR_RX, stream_format)
print('\nActivate Stream:')
sdr.activateStream(rxStream) #start streaming

gives

Antennas:
'TX/RX Sub1GHz'
'TX/RX Sub1GHz'

ANT:
TX/RX Sub1GHz

Setup Stream:

Activate Stream:

[ERROR] SoapySDR::Device::enumerate(sdrplay) sdrplay_api_Open() failed
[INFO] setupStream: dir= RX, format= CS16

I'm pretty sure the sdrplay error isn't an issue here. As mentioned above, I know that through SDR++ and CubicSDR running with SoapySDR I can access the HiF antenna.

Any hints as to how I can access the channel listed as device_id: 1? Thanks for any help.

jberwald avatar Aug 26 '24 16:08 jberwald