From c3a9b7b13d6a239f14459f8d1b61d83bf2ee1638 Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Fri, 22 Jan 2010 11:59:48 +0100 Subject: * pick_subdevice() fixed to work with GnuRadio 3.2.2 * Added -A parameter to choose antenna on RFX DB. * Added -F parameter to set FPGA master clock frequency. --- gsm-tvoid/src/python/gsm_scan_light.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'gsm-tvoid') diff --git a/gsm-tvoid/src/python/gsm_scan_light.py b/gsm-tvoid/src/python/gsm_scan_light.py index 308602f..2b4f5c2 100755 --- a/gsm-tvoid/src/python/gsm_scan_light.py +++ b/gsm-tvoid/src/python/gsm_scan_light.py @@ -89,9 +89,9 @@ class burst_callback(gr.feval_ll): #################### def pick_subdevice(u): - if u.db[0][0].dbid() >= 0: + if u.db(0, 0).dbid() >= 0: return (0, 0) - if u.db[1][0].dbid() >= 0: + if u.db(1, 0).dbid() >= 0: return (1, 0) return (0, 0) @@ -236,12 +236,16 @@ class tvoid_receiver(gr.top_block): help="Set USRP decimation rate to DECIM [default=%default]") parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, help="Select USRP Rx side A or B (default=first one with a daughterboard)") + parser.add_option("-A", "--antenna", default=None, + help="Select Rx Antenna (only on RFX-series boards)") parser.add_option("--fusb-block-size", type="int", default=0, help="Set USRP blocksize") parser.add_option("--fusb-nblocks", type="int", default=0, help="Set USRP block buffers") parser.add_option("--realtime",action="store_true", dest="realtime", help="Use realtime scheduling.") + parser.add_option("-F", "--clock-frequency", type="int", default=64e6, + help="USRP FPGA master clock frequency") parser.add_option("-C", "--clock-offset", type="eng_float", default=0.0, help="Sample clock offset frequency") @@ -363,7 +367,8 @@ class tvoid_receiver(gr.top_block): self.ursp = usrp.source_c(decim_rate=options.decim,fusb_block_size=options.fusb_block_size,fusb_nblocks=options.fusb_nblocks) - + self.ursp.set_fpga_master_clock_freq(options.clock_frequency) + if options.rx_subdev_spec is None: options.rx_subdev_spec = pick_subdevice(self.ursp) @@ -373,6 +378,10 @@ class tvoid_receiver(gr.top_block): self.subdev = usrp.selected_subdev(self.ursp, options.rx_subdev_spec) input_rate = self.ursp.adc_freq() / self.ursp.decim_rate() + if options.antenna is not None: + print >> sys.stderr, "USRP antenna %s" % (options.antenna,) + self.subdev.select_rx_antenna(options.antenna) + # set initial values if options.gain is None: # if no gain was specified, use the mid-point in dB @@ -386,10 +395,10 @@ class tvoid_receiver(gr.top_block): #################### def setup_timing(self): options = self.options - clock_rate = 64e6 + clock_rate = options.clock_frequency if options.clock_offset: - clock_rate = 64e6 + options.clock_offset + clock_rate = clock_rate + options.clock_offset elif options.channel: #calculate actual clock rate based on frequency offset (assumes shared clock for sampling and tuning) f = get_freq_from_arfcn(options.channel,options.region) -- cgit v1.2.3