# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# GNU Radio version: 3.7.13.5
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
from gnuradio import analog
from gnuradio import audio
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
from gnuradio import wxgui
from gnuradio.eng_option import eng_option
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import forms
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import sdrplay
import wx
class top_block(grc_wxgui.top_block_gui):
def __init__(self):
grc_wxgui.top_block_gui.__init__(self, title="Top Block")
_icon_path = "C:\Program Files\GNURadio-3.7\share\icons\hicolor\scalable/apps\gnuradio-grc.png"
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
##################################################
# Variables
##################################################
self.volume = volume = 0.5
self.transition = transition = 1e6
self.samp_rate = samp_rate = 2e6
self.quadrature = quadrature = 500e3
self.freq = freq = 89.1e6
self.cutoff = cutoff = 100e3
self.audio_dec = audio_dec = 10
##################################################
# Blocks
##################################################
_volume_sizer = wx.BoxSizer(wx.VERTICAL)
self._volume_text_box = forms.text_box(
parent=self.GetWin(),
sizer=_volume_sizer,
value=self.volume,
callback=self.set_volume,
label='Volume',
converter=forms.float_converter(),
proportion=0,
)
self._volume_slider = forms.slider(
parent=self.GetWin(),
sizer=_volume_sizer,
value=self.volume,
callback=self.set_volume,
minimum=0,
maximum=1,
num_steps=100,
style=wx.SL_HORIZONTAL,
cast=float,
proportion=1,
)
self.Add(_volume_sizer)
self._freq_text_box = forms.text_box(
parent=self.GetWin(),
value=self.freq,
callback=self.set_freq,
label='Frequency',
converter=forms.float_converter(),
)
self.Add(self._freq_text_box)
self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
self.GetWin(),
baseband_freq=0,
y_per_div=10,
y_divs=10,
ref_level=0,
ref_scale=2.0,
sample_rate=samp_rate,
fft_size=1024,
fft_rate=15,
average=False,
avg_alpha=None,
title='FFT Plot',
peak_hold=False,
)
self.Add(self.wxgui_fftsink2_0.win)
self.sdrplay_rspduo_source_0 = sdrplay.rspduo_source(freq, 1536, True, 40, True, True,
False, 0, 1, samp_rate, False, False, 0, False,
'0', 'T1_50ohm')
self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
interpolation=48,
decimation=50,
taps=None,
fractional_bw=None,
)
self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
interpolation=1,
decimation=4,
taps=None,
fractional_bw=None,
)
self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
1, samp_rate, cutoff, transition, firdes.WIN_HAMMING, 6.76))
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((volume, ))
self.audio_sink_0 = audio.sink(48000, '', True)
self.analog_wfm_rcv_0 = analog.wfm_rcv(
quad_rate=quadrature,
audio_decimation=audio_dec,
)
##################################################
# Connections
##################################################
self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0_0, 0))
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_multiply_const_vxx_0, 0))
self.connect((self.sdrplay_rspduo_source_0, 0), (self.rational_resampler_xxx_0, 0))
self.connect((self.sdrplay_rspduo_source_0, 0), (self.wxgui_fftsink2_0, 0))
def get_volume(self):
return self.volume
def set_volume(self, volume):
self.volume = volume
self._volume_slider.set_value(self.volume)
self._volume_text_box.set_value(self.volume)
self.blocks_multiply_const_vxx_0.set_k((self.volume, ))
def get_transition(self):
return self.transition
def set_transition(self, transition):
self.transition = transition
self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, self.transition, firdes.WIN_HAMMING, 6.76))
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, self.transition, firdes.WIN_HAMMING, 6.76))
def get_quadrature(self):
return self.quadrature
def set_quadrature(self, quadrature):
self.quadrature = quadrature
def get_freq(self):
return self.freq
def set_freq(self, freq):
self.freq = freq
self._freq_text_box.set_value(self.freq)
self.sdrplay_rspduo_source_0.set_rf_freq(self.freq)
def get_cutoff(self):
return self.cutoff
def set_cutoff(self, cutoff):
self.cutoff = cutoff
self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, self.transition, firdes.WIN_HAMMING, 6.76))
def get_audio_dec(self):
return self.audio_dec
def set_audio_dec(self, audio_dec):
self.audio_dec = audio_dec
def main(top_block_cls=top_block, options=None):
tb = top_block_cls()
tb.Start(True)
tb.Wait()
if __name__ == '__main__':
main()
Generating: 'C:\\Users\\claud\\Desktop\\G-Link_code\\GnuRadio_3.7.13.5_SDRplay_Windows\\top_block.py'
Executing: C:\Program Files\GNURadio-3.7\gr-python27\python.exe -u C:\Users\claud\Desktop\G-Link_code\GnuRadio_3.7.13.5_SDRplay_Windows\top_block.py
Failed to open SDRplay device
Traceback (most recent call last):
File "C:\Users\claud\Desktop\G-Link_code\GnuRadio_3.7.13.5_SDRplay_Windows\top_block.py", line 203, in <module>
main()
File "C:\Users\claud\Desktop\G-Link_code\GnuRadio_3.7.13.5_SDRplay_Windows\top_block.py", line 197, in main
tb = top_block_cls()
File "C:\Users\claud\Desktop\G-Link_code\GnuRadio_3.7.13.5_SDRplay_Windows\top_block.py", line 107, in __init__
'0', 'T1_50ohm')
File "C:\Program Files\GNURadio-3.7\lib\site-packages\sdrplay\sdrplay_swig.py", line 1661, in make
return _sdrplay_swig.rspduo_source_make(rf_freq, bw, agc_enabled, if_atten_db, dc_offset_mode, iq_balance_mode, debug_enabled, if_type, lo_mode, sample_rate, bcast_notch, dab_notch, lna_atten_step, bias_t, device_serial, antenna)
RuntimeError: Failed to open SDRplay device
Good morning everyone,
I state that I am new to GNUradio, but I need to re-install in WIN10 a .grc program written by a colleague a couple of years ago, which uses the RSPduo SDR.
The hardware is fully functional, also tested with SDRplay's SDRuno native SW, but when I install it on the new PC with GNUradio, I always get an HW unreachable error.
GNUradio is in version 3.7.13.5_win64 which is the one suggested by SDRplay, I installed the API ver. 3.11 (SDRplay_RSP_API_Windows-3.11.exe), but when I try to run the program, I get a "Failed to open SDRPlay device" error.
I then tried the sdrplay_test.grc test program, which is a simple FM receiver accompanying HW, but I still get the same error.
I really need someone who can help me. If there is a volunteer, I attach the sdrplay_test file, the generated python file and the error message.
Thanks in advance for any suggestions and help you can give me.
Claudio
No comments:
Post a Comment