From 2c72d27cc52868e0305fbe5dcd6256f2edde3afc Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 20 Apr 2020 11:46:48 +0200 Subject: [PATCH] Adding Gnuradio Flow Diagram --- rpi_interface.grc | 731 +++++++++++++++++++++++++++++++++++++++++++++ rpitx_interface.py | 94 ++++++ 2 files changed, 825 insertions(+) create mode 100644 rpi_interface.grc create mode 100644 rpitx_interface.py diff --git a/rpi_interface.grc b/rpi_interface.grc new file mode 100644 index 0000000..090ce48 --- /dev/null +++ b/rpi_interface.grc @@ -0,0 +1,731 @@ + + + + Sun Apr 19 13:32:56 2020 + + options + + author + zs6cmo + + + window_size + + + + category + [GRC Hier Blocks] + + + comment + + + + description + Interface for SVXlink + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + no_gui + + + hier_block_src_path + .: + + + id + rpitx_interface + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + run + + + run + True + + + sizing_mode + fixed + + + thread_safe_setters + + + + title + SVxlink .... X Interface + + + placement + (0,0) + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 160) + + + _rotation + 0 + + + id + tx_audo_level + + + value + 400 + + + + analog_nbfm_tx + + audio_rate + 48 + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (448, 180) + + + _rotation + 0 + + + id + analog_nbfm_tx_0 + + + max_dev + 10 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + fh + -1.0 + + + quad_rate + 96 + + + tau + 75 + + + + blks2_tcp_sink + + addr + 127.0.0.1 + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (744, 324) + + + _rotation + 0 + + + id + blks2_tcp_sink_0 + + + type + complex + + + server + False + + + port + 8011 + + + vlen + 1 + + + + blocks_deinterleave + + alias + + + + blocksize + 1 + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (240, 200) + + + _rotation + 0 + + + id + blocks_deinterleave_0 + + + type + short + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_streams + 2 + + + vlen + 1 + + + + blocks_multiply_const_vxx + + alias + + + + comment + + + + const + 400 + + + affinity + + + + _enabled + True + + + _coordinate + (528, 52) + + + _rotation + 0 + + + id + blocks_multiply_const_vxx_0 + + + type + float + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_multiply_const_vxx + + alias + + + + comment + + + + const + 1 + + + affinity + + + + _enabled + True + + + _coordinate + (472, 340) + + + _rotation + 0 + + + id + blocks_multiply_const_vxx_1 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_null_sink + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (272, 344) + + + _rotation + 0 + + + id + blocks_null_sink_0 + + + type + short + + + num_inputs + 1 + + + vlen + 1 + + + + blocks_short_to_float + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (328, 52) + + + _rotation + 0 + + + id + blocks_short_to_float_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + scale + 32767 + + + vlen + 1 + + + + blocks_udp_source + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (16, 276) + + + _rotation + 0 + + + id + blocks_udp_source_0 + + + ipaddr + 127.0.0.1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + eof + True + + + type + short + + + psize + 4096 + + + port + 1235 + + + vlen + 1 + + + + low_pass_filter + + beta + 6.76 + + + alias + + + + comment + + + + affinity + + + + cutoff_freq + 6 + + + decim + 1 + + + _enabled + True + + + type + fir_filter_fff + + + _coordinate + (760, 4) + + + _rotation + 0 + + + gain + 2 + + + id + low_pass_filter_0 + + + interp + 1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + samp_rate + 48 + + + width + 250 + + + win + firdes.WIN_HAMMING + + + + rational_resampler_xxx + + alias + + + + comment + + + + affinity + + + + decim + 2 + + + _enabled + True + + + fbw + 0 + + + _coordinate + (744, 188) + + + _rotation + 0 + + + id + rational_resampler_xxx_0 + + + interp + 1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + taps + + + + type + ccc + + + + analog_nbfm_tx_0 + rational_resampler_xxx_0 + 0 + 0 + + + blocks_deinterleave_0 + blocks_short_to_float_0 + 0 + 0 + + + blocks_deinterleave_0 + blocks_null_sink_0 + 1 + 0 + + + blocks_multiply_const_vxx_0 + low_pass_filter_0 + 0 + 0 + + + blocks_multiply_const_vxx_1 + blks2_tcp_sink_0 + 0 + 0 + + + blocks_short_to_float_0 + blocks_multiply_const_vxx_0 + 0 + 0 + + + blocks_udp_source_0 + blocks_deinterleave_0 + 0 + 0 + + + low_pass_filter_0 + analog_nbfm_tx_0 + 0 + 0 + + + rational_resampler_xxx_0 + blocks_multiply_const_vxx_1 + 0 + 0 + + diff --git a/rpitx_interface.py b/rpitx_interface.py new file mode 100644 index 0000000..e69a897 --- /dev/null +++ b/rpitx_interface.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- +################################################## +# GNU Radio Python Flow Graph +# Title: SVxlink .... X Interface +# Author: zs6cmo +# Description: Interface for SVXlink +# Generated: Mon Apr 20 11:41:48 2020 +################################################## + + +from gnuradio import analog +from gnuradio import blocks +from gnuradio import eng_notation +from gnuradio import filter +from gnuradio import gr +from gnuradio.eng_option import eng_option +from gnuradio.filter import firdes +from grc_gnuradio import blks2 as grc_blks2 +from optparse import OptionParser + + +class rpitx_interface(gr.top_block): + + def __init__(self): + gr.top_block.__init__(self, "SVxlink .... X Interface") + + ################################################## + # Variables + ################################################## + self.tx_audo_level = tx_audo_level = 400 + + ################################################## + # Blocks + ################################################## + self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( + interpolation=1, + decimation=2, + taps=None, + fractional_bw=None, + ) + self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass( + 2, 48, 6, 250, firdes.WIN_HAMMING, 6.76)) + self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short*1, '127.0.0.1', 1235, 4096, True) + self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767) + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_short*1) + self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1, )) + self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((400, )) + self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_short*1, 1) + self.blks2_tcp_sink_0 = grc_blks2.tcp_sink( + itemsize=gr.sizeof_gr_complex*1, + addr='127.0.0.1', + port=8011, + server=False, + ) + self.analog_nbfm_tx_0 = analog.nbfm_tx( + audio_rate=48, + quad_rate=96, + tau=75, + max_dev=10, + fh=-1.0, + ) + + + + ################################################## + # Connections + ################################################## + self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) + self.connect((self.blocks_deinterleave_0, 1), (self.blocks_null_sink_0, 0)) + self.connect((self.blocks_deinterleave_0, 0), (self.blocks_short_to_float_0, 0)) + self.connect((self.blocks_multiply_const_vxx_0, 0), (self.low_pass_filter_0, 0)) + self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blks2_tcp_sink_0, 0)) + self.connect((self.blocks_short_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0)) + self.connect((self.blocks_udp_source_0, 0), (self.blocks_deinterleave_0, 0)) + self.connect((self.low_pass_filter_0, 0), (self.analog_nbfm_tx_0, 0)) + self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_1, 0)) + + def get_tx_audo_level(self): + return self.tx_audo_level + + def set_tx_audo_level(self, tx_audo_level): + self.tx_audo_level = tx_audo_level + + +def main(top_block_cls=rpitx_interface, options=None): + + tb = top_block_cls() + tb.start() + tb.wait() + + +if __name__ == '__main__': + main()