diff options
18 files changed, 3 insertions, 1426 deletions
diff --git a/gnuradio-examples/python/digital/limbo/README b/gnuradio-examples/python/digital/limbo/README deleted file mode 100644 index fe48f4358..000000000 --- a/gnuradio-examples/python/digital/limbo/README +++ /dev/null @@ -1,12 +0,0 @@ -Files in here are in various states of disrepair and/or have been -superceded by revised code in the directory above. - -They're here until we figure out what to do with them. - - -* gmsk_test.py: stand-alone program that exercises the GMSK packet tx -and rx code. The two halves are connected with a simulated noisy -channel. It's easy to add extra instrumentation to log various internal -states. We used a variant of this code to get this working in the -first place. - diff --git a/gnuradio-examples/python/digital/limbo/benchmark_gmsk_rx.py b/gnuradio-examples/python/digital/limbo/benchmark_gmsk_rx.py deleted file mode 100755 index 16f11e05e..000000000 --- a/gnuradio-examples/python/digital/limbo/benchmark_gmsk_rx.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, blks -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random -import struct - -# from current dir -from receive_path import receive_path -import fusb_options - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - - -class my_graph(gr.flow_graph): - - def __init__(self, demod_class, rx_subdev_spec, - bitrate, decim_rate, spb, - rx_callback, options, demod_kwargs): - gr.flow_graph.__init__(self) - self.rxpath = receive_path(self, demod_class, rx_subdev_spec, - bitrate, decim_rate, spb, - rx_callback, options, demod_kwargs) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - print "ok = %r pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - parser = OptionParser (option_class=eng_option) - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B") - parser.add_option("-f", "--freq", type="eng_float", default=423.1e6, - help="set Rx frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("-r", "--bitrate", type="eng_float", default=None, - help="specify bitrate. spb and interp will be derived.") - parser.add_option("-g", "--rx-gain", type="eng_float", default=27, - help="set rx gain") - parser.add_option("-S", "--spb", type="int", default=None, - help="set samples/baud [default=%default]") - parser.add_option("-d", "--decim", type="intx", default=None, - help="set fpga decim rate to DECIM [default=%default]") - fusb_options.add_options(parser) - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.freq < 1e6: - options.freq *= 1e6 - - demod_kwargs = { } # placeholder - - # build the graph - fg = my_graph(blks.gmsk_demod, - options.rx_subdev_spec, options.bitrate, - options.decim, options.spb, rx_callback, - options, demod_kwargs) - - print "bitrate: %sb/sec" % (eng_notation.num_to_str(fg.rxpath.bitrate()),) - print "spb: %3d" % (fg.rxpath.spb(),) - print "decim: %3d" % (fg.rxpath.decim(),) - - ok = fg.rxpath.set_freq(options.freq) - if not ok: - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.freq),) - raise SystemExit - - fg.rxpath.set_gain(options.rx_gain) - print "Rx gain_range: ", fg.rxpath.subdev.gain_range(), " using", fg.rxpath.gain - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - fg.start() # start flow graph - fg.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/limbo/benchmark_gmsk_tx.py b/gnuradio-examples/python/digital/limbo/benchmark_gmsk_tx.py deleted file mode 100755 index 662e9e544..000000000 --- a/gnuradio-examples/python/digital/limbo/benchmark_gmsk_tx.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, blks -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random -import time -import struct -import sys - -# from current dir -from transmit_path import transmit_path -import fusb_options - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - -class my_graph(gr.flow_graph): - - def __init__(self, options, mod_kwargs): - gr.flow_graph.__init__(self) - self.txpath = transmit_path(self, options, mod_kwargs) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return fg.txpath.send_pkt(payload, eof) - - def rx_callback(ok, payload): - print "ok = %r, payload = '%s'" % (ok, payload) - - parser = OptionParser (option_class=eng_option) - parser.add_option("-T", "--tx-subdev-spec", type="subdev", default=None, - help="select USRP Tx side A or B") - parser.add_option("-f", "--freq", type="eng_float", default=423.1e6, - help="set Tx and Rx frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("-r", "--bitrate", type="eng_float", default=None, - help="specify bitrate. spb and interp will be derived.") - parser.add_option("-S", "--spb", type="int", default=2, - help="set samples/baud [default=%default]") - parser.add_option("-i", "--interp", type="intx", default=None, - help="set fpga interpolation rate to INTERP [default=%default]") - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("", "--bt", type="float", default=0.3, - help="set bandwidth-time product [default=%default]") - parser.add_option("-g", "--gain", type="eng_float", default=100.0, - help="transmitter gain [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - fusb_options.add_options(parser) - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.freq < 1e6: - options.freq *= 1e6 - - pkt_size = int(options.size) - - # Add gmsk_mod modulator class to options list - options.modulation = getattr(blks, "gmsk_mod") - - # Add GMSK modulator's properties - mod_kwargs = { - 'spb': options.spb, - 'bt' : options.bt, - 'verbose' : False, - 'debug' : False, - } - - # build the graph - fg = my_graph(options, mod_kwargs) - - print "bitrate: %sbps" % (eng_notation.num_to_str(fg.txpath.bitrate()),) - print "spb: %3d" % (fg.txpath.spb(),) - print "interp: %3d" % (fg.txpath.interp(),) - - ok = fg.txpath.set_freq(options.freq) - if not ok: - print "Failed to set Tx frequency to %s" % (eng_notation.num_to_str(options.freq),) - raise SystemExit - else: - print "Transmitting on frequency %s" % (eng_notation.num_to_str(options.freq)) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - else: - print "Started realtime scheduling" - - fg.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - - while n < nbytes: - send_pkt(struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff)) - n += pkt_size - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - fg.wait() # wait for it to finish - fg.txpath.set_auto_tr(False) - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/limbo/benchmark_mpsk_rx.py b/gnuradio-examples/python/digital/limbo/benchmark_mpsk_rx.py deleted file mode 100755 index a16842d4f..000000000 --- a/gnuradio-examples/python/digital/limbo/benchmark_mpsk_rx.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, blks -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random -import struct - -# from current dir -from bpsk import bpsk_demod -from dbpsk import dbpsk_demod -from dqpsk import dqpsk_demod -from receive_path import receive_path -import fusb_options - -if 1: - import os - print os.getpid() - raw_input('Attach and press enter') - - -class my_graph(gr.flow_graph): - - def __init__(self, demod_class, rx_subdev_spec, - bitrate, decim_rate, spb, - rx_callback, options, demod_kwargs): - gr.flow_graph.__init__(self) - self.rxpath = receive_path(self, demod_class, rx_subdev_spec, - bitrate, decim_rate, spb, - rx_callback, options, demod_kwargs) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - print "ok = %r pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - parser = OptionParser (option_class=eng_option) - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B") - parser.add_option("-f", "--freq", type="eng_float", default=423.1e6, - help="set Rx frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("-r", "--bitrate", type="eng_float", default=None, - help="specify bitrate. spb and interp will be derived.") - parser.add_option("-S", "--spb", type="int", default=None, - help="set samples/baud [default=%default]") - parser.add_option("-d", "--decim", type="intx", default=None, - help="set fpga decim rate to DECIM [default=%default]") - parser.add_option("-m", "--modulation", type="string", default='dbpsk', - help="modulation type (bpsk, dbpsk, dqpsk) [default=%default]") - parser.add_option("", "--excess-bw", type="float", default=0.3, - help="set RRC excess bandwith factor [default=%default]") - parser.add_option("-g", "--gain", type="eng_float", default=27, - help="set rx gain") - parser.add_option("","--log", action="store_true", default=False, - help="enable diagnostic logging") - fusb_options.add_options(parser) - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.freq < 1e6: - options.freq *= 1e6 - - demod_kwargs = { - 'excess_bw' : options.excess_bw, - } - - #FIXME: Needs to be worked in to overall structure; this will be fixed - # once static class definitions for modulations are defined - if(options.modulation=='bpsk'): - modulation=bpsk_demod - elif(options.modulation=='dbpsk'): - modulation=dbpsk_demod - else: - modulation=dqpsk_demod - - # build the graph - fg = my_graph(modulation, - options.rx_subdev_spec, options.bitrate, - options.decim, options.spb, - rx_callback, options, demod_kwargs) - - print "bitrate: %sb/sec" % (eng_notation.num_to_str(fg.rxpath.bitrate()),) - print "spb: %3d" % (fg.rxpath.spb(),) - print "decim: %3d" % (fg.rxpath.decim(),) - - ok = fg.rxpath.set_freq(options.freq) - if not ok: - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.freq),) - raise SystemExit - - fg.rxpath.set_gain(options.gain) - print "Rx gain_range: ", fg.rxpath.subdev.gain_range(), " using", fg.rxpath.gain - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - fg.start() # start flow graph - fg.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/limbo/benchmark_mpsk_tx.py b/gnuradio-examples/python/digital/limbo/benchmark_mpsk_tx.py deleted file mode 100755 index 9e1d98f1d..000000000 --- a/gnuradio-examples/python/digital/limbo/benchmark_mpsk_tx.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005, 2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, blks -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, time, struct, sys - -# from current dir -from transmit_path import transmit_path -import fusb_options - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - - -class my_graph(gr.flow_graph): - - def __init__(self, options, mod_kwargs): - gr.flow_graph.__init__(self) - self.txpath = transmit_path(self, options, mod_kwargs) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return fg.txpath.send_pkt(payload, eof) - - def rx_callback(ok, payload): - print "ok = %r, payload = '%s'" % (ok, payload) - - parser = OptionParser (option_class=eng_option) - parser.add_option("-T", "--tx-subdev-spec", type="subdev", default=None, - help="select USRP Tx side A or B") - parser.add_option("-f", "--freq", type="eng_float", default=423.1e6, - help="set Tx and Rx frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("-r", "--bitrate", type="eng_float", default=None, - help="specify bitrate. spb and interp will be derived.") - parser.add_option("-S", "--spb", type="int", default=2, - help="set samples/baud [default=%default]") - parser.add_option("-i", "--interp", type="intx", default=None, - help="set fpga interpolation rate to INTERP [default=%default]") - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-g", "--gain", type="eng_float", default=100.0, - help="transmitter gain [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - - parser.add_option("-m", "--modulation", type="string", default='dbpsk', - help="modulation type (bpsk, dbpsk, dqpsk) [default=%default]") - parser.add_option("", "--excess-bw", type="float", default=0.3, - help="set RRC excess bandwith factor [default=%default]") - parser.add_option("", "--no-gray-code", action="store_false", default=True, - help="Don't use gray coding on modulated bits [default=%default]") - - fusb_options.add_options(parser) - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.freq < 1e6: - options.freq *= 1e6 - - pkt_size = int(options.size) - - # Add PSK modulator class to options list - options.modulation = getattr(blks, options.modulation + "_mod") - - # Add PSK modulator's properties - mod_kwargs = { - 'spb' : options.spb, - 'excess_bw' : options.excess_bw, - 'gray_code' : options.no_gray_code, - 'verbose' : False, - 'debug' : False, - } - - # build the graph - fg = my_graph(options, mod_kwargs) - - print "bitrate: %sb/sec" % (eng_notation.num_to_str(fg.txpath.bitrate()),) - print "spb: %3d" % (fg.txpath.spb(),) - print "interp: %3d" % (fg.txpath.interp(),) - - ok = fg.txpath.set_freq(options.freq) - if not ok: - print "Failed to set Tx frequency to %s" % (eng_notation.num_to_str(options.freq),) - raise SystemExit - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - fg.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - - while n < nbytes: - send_pkt(struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff)) - n += pkt_size - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - fg.wait() # wait for it to finish - fg.txpath.set_auto_tr(False) - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/limbo/gmsk_test.py b/gnuradio-examples/python/digital/limbo/gmsk_test.py deleted file mode 100755 index 7ae69a0a9..000000000 --- a/gnuradio-examples/python/digital/limbo/gmsk_test.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, blks -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import random -import struct - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - - -class my_graph(gr.flow_graph): - - def __init__(self, rx_callback, spb, bt, SNR, freq_error): - gr.flow_graph.__init__(self) - - fg = self - - # Tuning Parameters - gain_mu = 0.002*spb - omega = spb*(1+freq_error) - - # transmitter - self.packet_transmitter = blks.gmsk2_mod_pkts(fg, spb=spb, bt=bt) - - # add some noise - add = gr.add_cc() - noise = gr.noise_source_c(gr.GR_GAUSSIAN, pow(10.0,-SNR/20.0)) - - # channel filter - rx_filt_taps = gr.firdes.low_pass(1,spb,0.8,0.1,gr.firdes.WIN_HANN) - rx_filt = gr.fir_filter_ccf(1,rx_filt_taps) - - # receiver - self.packet_receiver = blks.gmsk2_demod_pkts(fg, callback=rx_callback, - spb=spb, gain_mu=gain_mu, - freq_error=freq_error, omega=omega) - - fg.connect (self.packet_transmitter, (add,0)) - fg.connect (noise, (add,1)) - fg.connect(add, rx_filt, self.packet_receiver) - - -class stats(object): - def __init__(self): - self.npkts = 0 - self.nright = 0 - -def main(): - st = stats() - - def send_pkt(payload='', eof=False): - fg.packet_transmitter.send_pkt(payload, eof) - - def rx_callback(ok, payload): - st.npkts += 1 - if ok: - st.nright += 1 - if len(payload) <= 16: - print "ok = %5r payload = '%s' %d/%d" % (ok, payload, st.nright, st.npkts) - else: - (pktno,) = struct.unpack('!H', payload[0:2]) - print "ok = %5r pktno = %4d len(payload) = %4d %d/%d" % (ok, pktno, len(payload), - st.nright, st.npkts) - - - parser = OptionParser (option_class=eng_option) - parser.add_option("-M", "--megabytes", type="eng_float", default=1, - help="set megabytes to transmit [default=%default]") - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("","--spb", type=int, default=4, - help="set samples per baud to SPB [default=%default]") - parser.add_option("", "--bt", type="eng_float", default=0.3, - help="set bandwidth time product for Gaussian filter [default=%default]") - parser.add_option("", "--snr", type="eng_float", default=20, - help="set SNR in dB for simulation [default=%default]") - parser.add_option("", "--freq-error", type="eng_float", default=0, - help="set frequency error for simulation [default=%default]") - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - pkt_size = int(options.size) - - fg = my_graph(rx_callback, options.spb, options.bt, options.snr, options.freq_error) - fg.start() - - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - - send_pkt('Hello World') - - # generate and send packets - while n < nbytes: - send_pkt(struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff)) - n += pkt_size - pktno += 1 - - send_pkt('Goodbye World') - send_pkt(eof=True) # tell modulator we're not sending any more pkts - - fg.wait() - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/limbo/mpsk_test.py b/gnuradio-examples/python/digital/limbo/mpsk_test.py deleted file mode 100755 index 1f257d9c5..000000000 --- a/gnuradio-examples/python/digital/limbo/mpsk_test.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, blks -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import random -import struct -from mpsk_pkt import * -import cmath - -class my_graph(gr.flow_graph): - - def __init__(self, rx_callback, spb, excess_bw, SNR, freq_error, arity): - gr.flow_graph.__init__(self) - - fg = self - - # Tuning Parameters - gain_mu = 0.05/spb - - # transmitter - self.packet_transmitter = \ - mpsk_mod_pkts(fg, spb=spb, excess_bw=excess_bw, diff=True, arity=arity) - - # ---------------------------------------------------------------- - # Channel model - # ---------------------------------------------------------------- - - awgn = gr.noise_source_c(gr.GR_GAUSSIAN, pow(10.0,-SNR/20.0)) - add = gr.add_cc() # add some noise - fg.connect(awgn, (add,1)) - radians = 17*pi/180 - phase_rotate = gr.multiply_const_cc(cmath.exp(radians * 1j)) - - # ---------------------------------------------------------------- - - # channel filter - rx_filt_taps = gr.firdes.low_pass(1,spb,0.8,0.1,gr.firdes.WIN_HANN) - #rx_filt_taps = (1,) - rx_filt = gr.fir_filter_ccf(1,rx_filt_taps) - - # receiver - self.packet_receiver = \ - mpsk_demod_pkts(fg, callback=rx_callback, - excess_bw=excess_bw, arity=arity, diff=True, - costas_alpha=.005, gain_mu=gain_mu, spb=spb) - - fg.connect (self.packet_transmitter, (add,0)) - fg.connect(add, phase_rotate, rx_filt, self.packet_receiver) - - -class stats(object): - def __init__(self): - self.npkts = 0 - self.nright = 0 - -def main(): - st = stats() - - def send_pkt(payload='', eof=False): - fg.packet_transmitter.send_pkt(payload, eof) - - def rx_callback(ok, payload): - st.npkts += 1 - if ok: - st.nright += 1 - if len(payload) <= 16: - print "ok = %5r payload = '%s' %d/%d" % (ok, payload, st.nright, st.npkts) - else: - (pktno,) = struct.unpack('!H', payload[0:2]) - print "ok = %5r pktno = %4d len(payload) = %4d %d/%d" % (ok, pktno, len(payload), - st.nright, st.npkts) - - - parser = OptionParser (option_class=eng_option) - parser.add_option("-M", "--megabytes", type="eng_float", default=1, - help="set megabytes to transmit [default=%default]") - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("","--spb", type=int, default=4, - help="set samples per baud to SPB [default=%default]") - parser.add_option("", "--excess-bw", type="eng_float", default=0.4, - help="set excess bandwidth for RRC filter [default=%default]") - parser.add_option("", "--snr", type="eng_float", default=40, - help="set SNR in dB for simulation [default=%default]") - parser.add_option("", "--m-arity", type=int, default=4, - help="PSK arity [default=%default]") - parser.add_option("", "--freq-error", type="eng_float", default=0, - help="set frequency error for simulation [default=%default]") - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - pkt_size = int(options.size) - - fg = my_graph(rx_callback, options.spb, options.excess_bw, options.snr, - options.freq_error, options.m_arity) - fg.start() - - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - - send_pkt('Hello World') - - # generate and send packets - while n < nbytes: - send_pkt(struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff)) - n += pkt_size - pktno += 1 - - send_pkt('Goodbye World') - send_pkt(eof=True) # tell modulator we're not sending any more pkts - - fg.wait() - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/limbo/qpsk_tester.py b/gnuradio-examples/python/digital/limbo/qpsk_tester.py deleted file mode 100644 index ea7bae2eb..000000000 --- a/gnuradio-examples/python/digital/limbo/qpsk_tester.py +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python - -import random -from gnuradio import gr - -default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' - -def string_to_1_0_list(s): - r = [] - for ch in s: - x = ord(ch) - for i in range(8): - t = (x >> i) & 0x1 - r.append(t) - - return r - -def to_1_0_string(L): - return ''.join(map(lambda x: chr(x + ord('0')), L)) - -code = string_to_1_0_list(default_access_code) -access_code = to_1_0_string(code) - -use_agc = 0 -use_rrc_tx = 1 -use_rrc_rx = 1 -use_sync_loop = 1 -use_clock_sync = 1 - -def main(): - fg = gr.flow_graph() - -# data = (1,2,3,4,5,6,7,8,9) - random.seed() - data = [random.randint(1,100) for i in range(20000)] - data[0] = 0 # you know, for the diff encoding stuff - bytes_src = gr.vector_source_b(data,False) - - k = 2 - spb = 50 - ntaps = 11*spb - excess_bw = 0.9 - threshold = 12 - constellation = (1+0j, 0+1j, -1+0j, 0-1j) - - bytes2chunks = gr.packed_to_unpacked_bb(k, gr.GR_MSB_FIRST) - diffenc = gr.diff_encoder_bb(4) - chunks2symbols = gr.chunks_to_symbols_bc(constellation) - - if use_rrc_tx: - rrc_taps_tx = gr.firdes.root_raised_cosine(spb, spb, 1.0, \ - excess_bw, ntaps) - rrc_tx = gr.interp_fir_filter_ccf(spb, rrc_taps_tx) - else: - rrc_tx = gr.interp_fir_filter_ccf(1, (1,)) - -################### CHANNEL MODEL ############################# - - phase_rotate = gr.multiply_const_cc(1-0.36j) - channel = gr.add_cc() - awgn = gr.noise_source_c(gr.GR_GAUSSIAN, 0.5) - fg.connect(awgn, (channel,1)) - -################### CHANNEL MODEL ############################# - - if use_agc: - agc = gr.agc_cc(1e-4, 1, 1) - else: - agc = gr.multiply_const_cc(1) - - # Downconverter - if use_sync_loop: - costas_alpha=0.005 - beta = costas_alpha*costas_alpha*0.25 - sync_loop = gr.costas_loop_cc(costas_alpha, beta, 0.05, -0.05, 0) - else: - sync_loop = gr.multiply_const_cc(1) - - if use_rrc_rx: - rrc_taps_rx = gr.firdes.root_raised_cosine(1, spb, 1.0, \ - excess_bw, ntaps) - rrc_rx = gr.fir_filter_ccf(1, rrc_taps_rx) - else: - rrc_rx = gr.fir_filter_ccf(1, (1,)) - - # Sampler - if use_clock_sync: - mu = 0.05 - omega = spb - gain_mu = 0.05 - gain_omega = 0.25*gain_mu*gain_mu - omega_rel_limit = 0.5 - clock_sync = gr.clock_recovery_mm_cc(omega, gain_omega, mu, \ - gain_mu, omega_rel_limit) - #clock_sync.set_verbose(True); - else: - clock_sync = gr.fir_filter_ccf(1, (1,)) - - diff_phasor = gr.diff_phasor_cc() - slicer = gr.constellation_decoder_cb((constellation), (0,1,2,3)) - unpack = gr.unpack_k_bits_bb(k) - access = gr.correlate_access_code_bb(access_code,threshold) - - sink = gr.file_sink(gr.sizeof_char, 'output.dat') - - fg.connect(bytes_src, bytes2chunks, diffenc, chunks2symbols, rrc_tx) - fg.connect(rrc_tx, phase_rotate, channel, agc) - fg.connect(agc, sync_loop, rrc_rx, clock_sync, diff_phasor, slicer, sink) - - test = gr.file_sink(gr.sizeof_gr_complex, 'test.dat') - fg.connect(rrc_rx, test) - - fg.connect(chunks2symbols, gr.file_sink(gr.sizeof_gr_complex, 'rrc_tx.dat')) # into TX RRC - fg.connect(channel, gr.file_sink(gr.sizeof_gr_complex, 'channel.dat')) # Out of TX RRC - fg.connect(rrc_rx, gr.file_sink(gr.sizeof_gr_complex, 'rrc_rx.dat')) # Out of RX RRC -> clock_sync - fg.connect(clock_sync, gr.file_sink(gr.sizeof_gr_complex, 'clock_sync.dat')) # Out of M&M sync loop - fg.connect(bytes2chunks, gr.file_sink(gr.sizeof_char, 'source.dat')) - - fg.start() - fg.wait() - -if __name__ == "__main__": - main() - - - - diff --git a/gnuradio-examples/python/digital/limbo/qpsk_usrp_tester.py b/gnuradio-examples/python/digital/limbo/qpsk_usrp_tester.py deleted file mode 100644 index bf7698a2b..000000000 --- a/gnuradio-examples/python/digital/limbo/qpsk_usrp_tester.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python - -import random -from gnuradio import gr, gru, usrp - -default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' - -def string_to_1_0_list(s): - r = [] - for ch in s: - x = ord(ch) - for i in range(8): - t = (x >> i) & 0x1 - r.append(t) - - return r - -def to_1_0_string(L): - return ''.join(map(lambda x: chr(x + ord('0')), L)) - -code = string_to_1_0_list(default_access_code) - -access_code = to_1_0_string(code) - -def main(): - - fg = gr.flow_graph() - f_rf = 5e6 - fs = 400e3 - sr = 100e3 - alpha = 0.5 - M = 4 - k = int(gru.log2(M)) - - # Source - src = usrp.source_c () - adc_rate = src.adc_rate() - usrp_decim = int(adc_rate / fs) - src.set_decim_rate(usrp_decim) - - subdev_spec = usrp.pick_rx_subdevice(src) - subdev = usrp.selected_subdev(src, subdev_spec) - print "Using RX d'board %s" % (subdev.side_and_name(),) - src.set_mux(usrp.determine_rx_mux_value(src, subdev_spec)) - src.tune(0, subdev, f_rf) - - g = subdev.gain_range() - subdev.set_gain(g[1]) - subdev.set_auto_tr(True) - - print "USRP Decimation Rate = %d" % usrp_decim - print "RF Frequency = %d" % f_rf - - agc = gr.multiply_const_cc(0.0025) - - # Downconverter - costas_alpha=0.005 - beta = costas_alpha*costas_alpha*0.25 - sync_loop = gr.costas_loop_cc(costas_alpha, beta, 0.05, -0.05, 0) - - # Stage 2 -# fs2 = 200e3 -# D = int(fs / fs2) -# decimator = gr.keep_one_in_n(gr.sizeof_gr_complex, D) -# print "D = %d\nAfter decimator fs = %f" % (D, fs2) - - # Demodulator - taps = gr.firdes.root_raised_cosine(1, fs, sr, alpha, 45) - rrc = gr.fir_filter_ccf(1, taps) - - # Sampler - mu = 0.01 - omega = 4.3 - gain_mu = 0.05 - gain_omega = 0.25*gain_mu*gain_mu - omega_rel_limit = 0.5 - clock_sync = gr.clock_recovery_mm_cc(omega, gain_omega, mu, - gain_mu, omega_rel_limit) - clock_sync.set_verbose(False) - - diff_phasor = gr.diff_phasor_cc() - - threshold = 12 - constellation = (1+0j, 0+1j, -1+0j, 0-1j) - slicer = gr.constellation_decoder_cb((constellation), (0,1,2,3)) - unpack = gr.unpack_k_bits_bb(k) - access = gr.correlate_access_code_bb(access_code,threshold) - - test = gr.file_sink(gr.sizeof_gr_complex, 'test.dat') - sink = gr.file_sink(gr.sizeof_char, 'output.dat') - - fg.connect(src, agc, sync_loop, rrc, clock_sync) - fg.connect(clock_sync, diff_phasor, slicer, unpack, access, sink) - - fg.connect(slicer, gr.file_sink(gr.sizeof_char, 'chunks.dat')) - fg.connect(unpack, gr.file_sink(gr.sizeof_char, 'unpack.dat')) - fg.connect(clock_sync, gr.file_sink(gr.sizeof_gr_complex, 'phasor.dat')) - - fg.start() - fg.wait() - -if __name__ == "__main__": - main() diff --git a/gnuradio-examples/python/usrp/Makefile.am b/gnuradio-examples/python/usrp/Makefile.am index 71f460721..712aec16b 100644 --- a/gnuradio-examples/python/usrp/Makefile.am +++ b/gnuradio-examples/python/usrp/Makefile.am @@ -25,9 +25,11 @@ EXTRA_DIST = \ fm_tx_2_daughterboards.py \ fm_tx4.py \ max_power.py \ + usrp_benchmark_usb.py \ usrp_nbfm_ptt.py \ usrp_nbfm_rcv.py \ usrp_spectrum_sense.py \ + usrp_test_loop_lfsr.py \ usrp_tv_rcv_nogui.py \ usrp_tv_rcv.py \ usrp_wfm_rcv.py \ diff --git a/gnuradio-examples/python/usrp/limbo/tvrx_am_rcv_gui.py b/gnuradio-examples/python/usrp/limbo/tvrx_am_rcv_gui.py deleted file mode 100755 index 403cf3fa4..000000000 --- a/gnuradio-examples/python/usrp/limbo/tvrx_am_rcv_gui.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# -# -# Demodulate an AM signal from the TVRX or a recorded file. -# The file format must be 256 ksps, complex data. -# - -from gnuradio import gr, gru, eng_notation -from gnuradio import audio_oss as audio -from gnuradio import usrp -from gnuradio import tv_rx -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys -import math -from gnuradio.wxgui import stdgui, fftsink, scopesink -import wx - -# -# return a gr.flow_graph -# -class wfm_rx_graph (stdgui.gui_flow_graph): - def __init__(self,frame,panel,vbox,argv): - stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv) - - #set rf freq - rf_freq = 120.e6 - - # Decimation rate from USRP ADC to IF. - usrp_decim = 100 - - # Calculate the sampling rate of the USRP and capture file. - # Decimate the IF sampling rate down by 4 to 64 ksps - # This is a flow graph that has an input (capture file) and output (audio channel). - #self = gr.flow_graph () - - # Signal source is assumed to be 256 kspb / complex data stream. - which_side = 0 - # usrp is data source - if which_side == 0: - src = usrp.source_c (0, usrp_decim, 1, gru.hexint(0xf0f0f0f0), 0) - else: - src = usrp.source_c (0, usrp_decim, 1, gru.hexint(0xf0f0f0f2), 0) - - if_rate = 640e3 # src.adc_freq() / usrp_decim - if_decim = 5 - demod_rate = if_rate / if_decim - - audio_decimation = 4 - audio_rate = demod_rate / audio_decimation - - # set up frontend - dboard = tv_rx.tv_rx (src, which_side) - self.dboard = dboard - (success, actual_freq) = dboard.set_freq(rf_freq) - assert success - - if_freq = rf_freq - actual_freq - src.set_rx_freq (0, -if_freq) - - print "actual freq ", actual_freq - print "IF freq ", if_freq - - dboard.set_gain(50) - - #src = gr.file_source (gr.sizeof_gr_complex, "samples/atis_ffz_am_baseband_256k_complex.dat") - #src = gr.file_source (gr.sizeof_gr_complex, "samples/garagedoor1.dat", True) - - #channel_coeffs = gr.firdes.band_pass ( - # 1.0, # gain - # if_rate, - # 10, # center of low transition band - # 10000, # center of hi transition band - # 200, # width of transition band - # gr.firdes.WIN_HAMMING) - - channel_coeffs = gr.firdes.low_pass (1.0, if_rate, 10e3, 4e3, gr.firdes.WIN_HANN) - print "len(channel_coeffs) = ", len(channel_coeffs) - - # Tune to the desired frequency. - ddc = gr.freq_xlating_fir_filter_ccf (if_decim, channel_coeffs, -20e3, if_rate) - - # Demodule with classic sqrt (I*I + Q*Q) - magblock = gr.complex_to_mag() - - # Scale the audio - volumecontrol = gr.multiply_const_ff(.1) - - #band-pass - audio_coeffs = gr.firdes.band_pass ( - 1.0, # gain - demod_rate, - 10, # center of low transition band - 6000, # center of hi transition band - 200, # width of transition band - gr.firdes.WIN_HAMMING) - - - # Low pass filter the demodulator output - #audio_coeffs = gr.firdes.low_pass (1.0, demod_rate, 500, 200, gr.firdes.WIN_HANN) - print "len(audio_coeffs) = ", len(audio_coeffs) - - # input: float; output: float - audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) - - # sound card as final sink - audio_sink = audio.sink (int (audio_rate)) - - # now wire it all together - self.connect (src, ddc) - self.connect (ddc, magblock) - self.connect (magblock, volumecontrol) - self.connect (volumecontrol, audio_filter) - self.connect (audio_filter, (audio_sink, 0)) - - d_win = fftsink.fft_sink_c (self, panel, title="RF", fft_size=512, sample_rate=if_rate) - self.connect (src,d_win) - vbox.Add (d_win.win, 4, wx.EXPAND) - - p_win = fftsink.fft_sink_c (self, panel, title="IF", fft_size=512, sample_rate=demod_rate) - self.connect (ddc,p_win) - vbox.Add (p_win.win, 4, wx.EXPAND) - - r_win = fftsink.fft_sink_f (self, panel, title="Audio", fft_size=512, sample_rate=audio_rate) - self.connect (audio_filter,r_win) - vbox.Add (r_win.win, 4, wx.EXPAND) - - #audio_oscope = scopesink.scope_sink_f (self, panel, "Oscope Data", audio_rate) - #self.connect (audio_filter, audio_oscope) - #vbox.Add (audio_oscope.win, 4, wx.EXPAND) - -if __name__ == '__main__': - - app = stdgui.stdapp (wfm_rx_graph, "TVRX AM RX") - app.MainLoop () diff --git a/gnuradio-examples/python/usrp/limbo/usrp_fft_old.py b/gnuradio-examples/python/usrp/limbo/usrp_fft_old.py deleted file mode 100755 index 5edb372b9..000000000 --- a/gnuradio-examples/python/usrp/limbo/usrp_fft_old.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui, fftsink, scopesink -from optparse import OptionParser -import wx - -class app_flow_graph (stdgui.gui_flow_graph): - def __init__(self, frame, panel, vbox, argv): - stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv) - - self.frame = frame - self.panel = panel - - parser = OptionParser (option_class=eng_option) - parser.add_option ("-d", "--decim", type="int", default=16, - help="set fgpa decimation rate to DECIM") - parser.add_option ("-c", "--ddc-freq", type="eng_float", default=0, - help="set Rx DDC frequency to FREQ", metavar="FREQ") - parser.add_option ("-m", "--mux", type="intx", default=0x32103210, - help="set fpga FR_RX_MUX register to MUX") - parser.add_option ("-g", "--gain", type="eng_float", default=0, - help="set Rx PGA gain in dB (default 0 dB)") - (options, args) = parser.parse_args () - - self.u = usrp.source_c (0, options.decim, 1, gru.hexint(options.mux), 0) - self.u.set_rx_freq (0, options.ddc_freq) - - self.u.set_pga (0, options.gain) - self.u.set_pga (1, options.gain) - - self.u.set_verbose (0) - - input_rate = self.u.adc_freq () / self.u.decim_rate () - - fft = fftsink.fft_sink_c (self, panel, fft_size=1024, sample_rate=input_rate) - #fft = fftsink.fft_sink_c (self, panel, fft_size=1024, fft_rate=50, sample_rate=input_rate) - self.connect (self.u, fft) - vbox.Add (fft.win, 10, wx.EXPAND) - - if 0: - c2f_1 = gr.complex_to_float () - scope = scopesink.scope_sink_f (self, panel, "Rx Data", input_rate) - vbox.Add (scope.win, 4, wx.EXPAND) - - self.connect (self.u,c2f_1) - self.connect ((c2f_1, 0), (scope, 0)) - self.connect ((c2f_1, 1), (scope, 1)) - - # build small control area at bottom - hbox = wx.BoxSizer (wx.HORIZONTAL) - hbox.Add ((1, 1), 1, wx.EXPAND) - hbox.Add (wx.StaticText (panel, -1, "Set ddc freq: "), 0, wx.ALIGN_CENTER) - self.tc_freq = wx.TextCtrl (panel, -1, "", style=wx.TE_PROCESS_ENTER) - hbox.Add (self.tc_freq, 0, wx.ALIGN_CENTER) - wx.EVT_TEXT_ENTER (self.tc_freq, self.tc_freq.GetId(), self.handle_text_enter) - hbox.Add ((1, 1), 1, wx.EXPAND) - # add it to the main vbox - vbox.Add (hbox, 0, wx.EXPAND) - - self.update_status_bar () - - def handle_text_enter (self, event): - str = event.GetString () - self.tc_freq.Clear () - self.u.set_rx_freq (0, eng_notation.str_to_num (str)) - self.update_status_bar () - - def update_status_bar (self): - ddc_freq = self.u.rx_freq (0) - decim_rate = self.u.decim_rate () - sample_rate = self.u.adc_freq () / decim_rate - msg = "decim: %d %sS/s DDC: %s" % ( - decim_rate, - eng_notation.num_to_str (sample_rate), - eng_notation.num_to_str (ddc_freq)) - - self.frame.GetStatusBar().SetStatusText (msg, 1) - - - -def main (): - app = stdgui.stdapp (app_flow_graph, "USRP FFT") - app.MainLoop () - -if __name__ == '__main__': - main () diff --git a/gr-utils/src/python/usrp_benchmark_usb.py b/gnuradio-examples/python/usrp/usrp_benchmark_usb.py index fc01514a1..fc01514a1 100755 --- a/gr-utils/src/python/usrp_benchmark_usb.py +++ b/gnuradio-examples/python/usrp/usrp_benchmark_usb.py diff --git a/gr-utils/src/python/usrp_test_loop_lfsr.py b/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py index 446ca30a1..446ca30a1 100755 --- a/gr-utils/src/python/usrp_test_loop_lfsr.py +++ b/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py diff --git a/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py b/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py index 64d51e223..64d51e223 100644..100755 --- a/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py +++ b/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py diff --git a/gnuradio-examples/python/usrp/wfm_rcv_file.py b/gnuradio-examples/python/usrp/wfm_rcv_file.py deleted file mode 100755 index 2c8d4f760..000000000 --- a/gnuradio-examples/python/usrp/wfm_rcv_file.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, eng_notation -from gnuradio import audio -# from gnuradio import usrp -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys -import math - - -# -# return a gr.flow_graph -# -def build_graph (input_filename, repeat): - adc_rate = 64e6 # USRP A/D sampling rate - decim = 250 # FPGA decimated by this amount - - quad_rate = adc_rate / decim # 256 kHz (the sample rate of the file) - audio_decimation = 8 - audio_rate = quad_rate / audio_decimation # 32 kHz - - fg = gr.flow_graph () - - # usrp is data source - # src = usrp.source_c (0, decim) - # src.set_rx_freq (0, -IF_freq) - - src = gr.file_source (gr.sizeof_gr_complex, input_filename, repeat) - - (head, tail) = build_pipeline (fg, quad_rate, audio_decimation) - - # sound card as final sink - audio_sink = audio.sink (int (audio_rate)) - - # now wire it all together - fg.connect (src, head) - fg.connect (tail, (audio_sink, 0)) - - return fg - -def build_pipeline (fg, quad_rate, audio_decimation): - '''Given a flow_graph, fg, construct a pipeline - for demodulating a broadcast FM signal. The - input is the downconverteed complex baseband - signal. The output is the demodulated audio. - - build_pipeline returns a two element tuple - containing the input and output endpoints. - ''' - fm_demod_gain = 2200.0/32768.0 - audio_rate = quad_rate / audio_decimation - volume = 1.0 - - # input: complex; output: float - fm_demod = gr.quadrature_demod_cf (volume*fm_demod_gain) - - # compute FIR filter taps for audio filter - width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - audio_rate/2 - width_of_transition_band, - width_of_transition_band, - gr.firdes.WIN_HAMMING) - - TAU = 75e-6 # 75us in US, 50us in EUR - fftaps = [ 1 - math.exp(-1/TAU/quad_rate), 0] - fbtaps= [ 0 , math.exp(-1/TAU/quad_rate) ] - deemph = gr.iir_filter_ffd(fftaps,fbtaps) - - # input: float; output: float - audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) - - fg.connect (fm_demod, deemph) - fg.connect (deemph, audio_filter) - return ((fm_demod, 0), (audio_filter, 0)) - - -def main (): - usage = "usage: %prog [options] filename" - parser = OptionParser (option_class=eng_option, usage=usage) - parser.add_option ("-r", "--repeat", action="store_true", default=False) - # parser.add_option (... your stuff here...) - (options, args) = parser.parse_args () - - if len (args) != 1: - parser.print_help () - sys.exit (1) - - fg = build_graph (args[0], options.repeat) - - fg.start () # fork thread(s) and return - raw_input ('Press Enter to quit: ') - fg.stop () - -if __name__ == '__main__': - main () - - diff --git a/gr-utils/src/python/Makefile.am b/gr-utils/src/python/Makefile.am index cb8e9811c..231153636 100644 --- a/gr-utils/src/python/Makefile.am +++ b/gr-utils/src/python/Makefile.am @@ -23,7 +23,6 @@ EXTRA_DIST = \ $(bin_SCRIPTS) bin_SCRIPTS = \ - usrp_benchmark_usb.py \ usrp_fft.py \ usrp_oscope.py \ usrp_print_db.py \ @@ -31,5 +30,4 @@ bin_SCRIPTS = \ usrp_rx_nogui.py \ usrp_siggen.py \ usrp_test_counting.py \ - usrp_test_loop.py \ - usrp_test_loop_lfsr.py + usrp_test_loopback.py diff --git a/gr-utils/src/python/usrp_test_loop.py b/gr-utils/src/python/usrp_test_loopback.py index 51a705a05..51a705a05 100755 --- a/gr-utils/src/python/usrp_test_loop.py +++ b/gr-utils/src/python/usrp_test_loopback.py |