Wednesday, May 11, 2022

RFNoC, UHD4.0

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
# Title: RFNoC: Radio -> DUC Example
# GNU Radio version: 3.8.2.0

from distutils.version import StrictVersion

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 PyQt5 import Qt
from gnuradio import eng_notation
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
import sys
import signal
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
import ettus
from gnuradio import uhd

from gnuradio import qtgui

class rfnoc_radio_duc(gr.top_block, Qt.QWidget):

def __init__(self):
gr.top_block.__init__(self, "RFNoC: Radio -> DUC Example")
Qt.QWidget.__init__(self)
self.setWindowTitle("RFNoC: Radio -> DUC Example")
qtgui.util.check_set_qss()
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)

self.settings = Qt.QSettings("GNU Radio", "rfnoc_radio_duc")

try:
if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
self.restoreGeometry(self.settings.value("geometry").toByteArray())
else:
self.restoreGeometry(self.settings.value("geometry"))
except:
pass

##################################################
# Variables
##################################################
self.samp_rate_rf = samp_rate_rf = 122.88e6
self.samp_rate = samp_rate = 1e6
self.gain = gain = 0
self.freq = freq = 1e9
self.rfnoc_graph = ettus_rfnoc_graph = ettus.rfnoc_graph(uhd.device_addr(",".join(('', ''))))

##################################################
# Blocks
##################################################
self._samp_rate_rf_tool_bar = Qt.QToolBar(self)
self._samp_rate_rf_tool_bar.addWidget(Qt.QLabel('Sampling Rate (Hz)' + ": "))
self._samp_rate_rf_line_edit = Qt.QLineEdit(str(self.samp_rate_rf))
self._samp_rate_rf_tool_bar.addWidget(self._samp_rate_rf_line_edit)
self._samp_rate_rf_line_edit.returnPressed.connect(
lambda: self.set_samp_rate_rf(eng_notation.str_to_num(str(self._samp_rate_rf_line_edit.text()))))
self.top_grid_layout.addWidget(self._samp_rate_rf_tool_bar)
self._samp_rate_tool_bar = Qt.QToolBar(self)
self._samp_rate_tool_bar.addWidget(Qt.QLabel('Sampling Rate (Hz)' + ": "))
self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate))
self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit)
self._samp_rate_line_edit.returnPressed.connect(
lambda: self.set_samp_rate(eng_notation.str_to_num(str(self._samp_rate_line_edit.text()))))
self.top_grid_layout.addWidget(self._samp_rate_tool_bar)
self._gain_tool_bar = Qt.QToolBar(self)
self._gain_tool_bar.addWidget(Qt.QLabel('Gain (dB)' + ": "))
self._gain_line_edit = Qt.QLineEdit(str(self.gain))
self._gain_tool_bar.addWidget(self._gain_line_edit)
self._gain_line_edit.returnPressed.connect(
lambda: self.set_gain(int(str(self._gain_line_edit.text()))))
self.top_grid_layout.addWidget(self._gain_tool_bar)
self._freq_tool_bar = Qt.QToolBar(self)
self._freq_tool_bar.addWidget(Qt.QLabel('Frequency (Hz)' + ": "))
self._freq_line_edit = Qt.QLineEdit(str(self.freq))
self._freq_tool_bar.addWidget(self._freq_line_edit)
self._freq_line_edit.returnPressed.connect(
lambda: self.set_freq(eng_notation.str_to_num(str(self._freq_line_edit.text()))))
self.top_grid_layout.addWidget(self._freq_tool_bar)
self.ettus_rfnoc_tx_streamer_0_0 = ettus.rfnoc_tx_streamer(
self.rfnoc_graph,
1,
uhd.stream_args(
cpu_format="fc32",
otw_format="sc16",
channels=[],
args='',
),
1
)
self.ettus_rfnoc_tx_radio_0_0 = ettus.rfnoc_tx_radio(
self.rfnoc_graph,
uhd.device_addr(''),
-1,
0)
self.ettus_rfnoc_tx_radio_0_0.set_rate(samp_rate_rf)
self.ettus_rfnoc_tx_radio_0_0.set_antenna('TX/RX', 0)
self.ettus_rfnoc_tx_radio_0_0.set_frequency(freq, 0)
self.ettus_rfnoc_tx_radio_0_0.set_gain(gain, 0)
self.ettus_rfnoc_tx_radio_0_0.set_bandwidth(0, 0)
self.ettus_rfnoc_duc_0_0 = ettus.rfnoc_duc(
self.rfnoc_graph,
1,
uhd.device_addr(''),
-1,
0)
self.ettus_rfnoc_duc_0_0.set_freq(0, 0)
self.ettus_rfnoc_duc_0_0.set_input_rate(samp_rate, 0)
self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex*1)

##################################################
# Connections
##################################################
self.rfnoc_graph.connect(self.ettus_rfnoc_duc_0_0.get_unique_id(), 0, self.ettus_rfnoc_tx_radio_0_0.get_unique_id(), 0, False)
self.rfnoc_graph.connect(self.ettus_rfnoc_tx_streamer_0_0.get_unique_id(), 0, self.ettus_rfnoc_duc_0_0.get_unique_id(), 0, False)
self.connect((self.blocks_null_source_0, 0), (self.ettus_rfnoc_tx_streamer_0_0, 0))


def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "rfnoc_radio_duc")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()

def get_samp_rate_rf(self):
return self.samp_rate_rf

def set_samp_rate_rf(self, samp_rate_rf):
self.samp_rate_rf = samp_rate_rf
Qt.QMetaObject.invokeMethod(self._samp_rate_rf_line_edit, "setText", Qt.Q_ARG("QString", eng_notation.num_to_str(self.samp_rate_rf)))
self.ettus_rfnoc_tx_radio_0_0.set_rate(self.samp_rate_rf)

def get_samp_rate(self):
return self.samp_rate

def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
Qt.QMetaObject.invokeMethod(self._samp_rate_line_edit, "setText", Qt.Q_ARG("QString", eng_notation.num_to_str(self.samp_rate)))
self.ettus_rfnoc_duc_0_0.set_input_rate(self.samp_rate, 0)

def get_gain(self):
return self.gain

def set_gain(self, gain):
self.gain = gain
Qt.QMetaObject.invokeMethod(self._gain_line_edit, "setText", Qt.Q_ARG("QString", str(self.gain)))
self.ettus_rfnoc_tx_radio_0_0.set_gain(self.gain, 0)

def get_freq(self):
return self.freq

def set_freq(self, freq):
self.freq = freq
Qt.QMetaObject.invokeMethod(self._freq_line_edit, "setText", Qt.Q_ARG("QString", eng_notation.num_to_str(self.freq)))
self.ettus_rfnoc_tx_radio_0_0.set_frequency(self.freq, 0)

def get_ettus_rfnoc_graph(self):
return self.ettus_rfnoc_graph

def set_ettus_rfnoc_graph(self, ettus_rfnoc_graph):
self.ettus_rfnoc_graph = ettus_rfnoc_graph

def main(top_block_cls=rfnoc_radio_duc, options=None):

if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)

tb = top_block_cls()

tb.start()

tb.show()

def sig_handler(sig=None, frame=None):
Qt.QApplication.quit()

signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)

timer = Qt.QTimer()
timer.start(500)
timer.timeout.connect(lambda: None)

def quitting():
tb.stop()
tb.wait()

qapp.aboutToQuit.connect(quitting)
qapp.exec_()

if __name__ == '__main__':
main()

Dear Community,


I try to set up a basic flowgraph in GRC consisting out of a null source, a tx streamer and DUC and a TX radio. 


I use UHD4.0 and GR3.8.2.


However, I get the following error message:


RuntimeError: RuntimeError: Error during RPC call to `init'. Error message: RuntimeError: Receiver profile out of range RF bandwidth.


I tried different settings for sample rate, etc. but still I get that error. I attached the used flowgraph.




The second question is with regards to the default fpga images. When I download the images I get the following error:


[ERROR] Downloaded SHA256 does not match manifest for https://files.ettus.com/binaries/cache/e3xx/uhd-2cba65b/e3xx_e310_sg1_fpga_default-g2cba65b.zip!
01137 kB / 01137 kB (100%) e3xx_e310_sg3_fpga_default-g2cba65b.zip
[ERROR] Downloaded SHA256 does not match manifest for https://files.ettus.com/binaries/cache/e3xx/uhd-2cba65b/e3xx_e310_sg3_fpga_default-g2cba65b.zip!
10183 kB / 10183 kB (100%) e3xx_e320_fpga_default-g2cba65b.zip
[ERROR] Downloaded SHA256 does not match manifest for https://files.ettus.com/binaries/cache/e3xx/uhd-2cba65b/e3xx_e320_fpga_default-g2cba65b.zip!
20729 kB / 20729 kB (100%) n3xx_n310_fpga_default-g2cba65b.zip
[ERROR] Downloaded SHA256 does not match manifest for https://files.ettus.com/binaries/cache/n3xx/uhd-2cba65b/n3xx_n310_fpga_default-g2cba65b.zip!
14345 kB / 14345 kB (100%) n3xx_n300_fpga_default-g2cba65b.zip
[ERROR] Downloaded SHA256 does not match manifest for https://files.ettus.com/binaries/cache/n3xx/uhd-2cba65b/n3xx_n300_fpga_default-g2cba65b.zip!
27285 kB / 27285 kB (100%) n3xx_n320_fpga_default-g2cba65b.zip
[ERROR] Downloaded SHA256 does not match manifest for https://files.ettus.com/binaries/cache/n3xx/uhd-2cba65b/n3xx_n320_fpga_default-g2cba65b.zip!

What can I do to solve that problem?



Any help would be more than welcome!


Thanks,


BR,


Anton 

No comments:

Post a Comment