Small Osmosdr fixes. Still unsatisfactory w/HackRF Jawbreaker. DC block

unhelpful.
This commit is contained in:
Nick Foster 2013-08-08 22:15:24 -07:00
parent c878d80e28
commit 55559086ac
3 changed files with 18 additions and 14 deletions

View File

@ -59,7 +59,8 @@ class mainwindow(QtGui.QMainWindow):
if defaults["pmf"] is not None: if defaults["pmf"] is not None:
self.ui.check_pmf.setChecked(bool(defaults["pmf"])) self.ui.check_pmf.setChecked(bool(defaults["pmf"]))
if defaults["samplerate"] is not None: if defaults["samplerate"] is not None:
self.ui.combo_rate.setCurrentIndex(self.rates.index(int(defaults["samplerate"]))) if defaults["samplerate"] in self.rates:
self.ui.combo_rate.setCurrentIndex(self.rates.index(int(defaults["samplerate"])))
self.ui.prog_rssi.setMinimum(0) self.ui.prog_rssi.setMinimum(0)
self.ui.prog_rssi.setMaximum(40) self.ui.prog_rssi.setMaximum(40)
@ -140,6 +141,7 @@ class mainwindow(QtGui.QMainWindow):
#hook up parameter-changed signals so we can change gain, rate, etc. while running #hook up parameter-changed signals so we can change gain, rate, etc. while running
self.ui.combo_rate.currentIndexChanged['QString'].connect(self.update_sample_rate) self.ui.combo_rate.currentIndexChanged['QString'].connect(self.update_sample_rate)
self.ui.line_gain.editingFinished.connect(self.update_gain) self.ui.line_gain.editingFinished.connect(self.update_gain)
self.ui.combo_source.currentIndexChanged['QString'].connect(self.populate_source_options)
#hook up live data text box update signal #hook up live data text box update signal
self.live_data_changed_signal.connect(self.on_append_live_data) self.live_data_changed_signal.connect(self.on_append_live_data)
@ -228,7 +230,7 @@ class mainwindow(QtGui.QMainWindow):
elif sourceid == "Osmocom": elif sourceid == "Osmocom":
try: try:
import osmosdr import osmosdr
self.src = osmosdr.source_c("") self.src = osmosdr.source("")
self.rates = [rate.start() for rate in self.src.get_sample_rates() if (rate.start() % 2.e6) == 0] self.rates = [rate.start() for rate in self.src.get_sample_rates() if (rate.start() % 2.e6) == 0]
self.antennas = ["RX"] self.antennas = ["RX"]
self.src = None self.src = None
@ -258,11 +260,12 @@ class mainwindow(QtGui.QMainWindow):
self.ui.combo_ant.addItems(self.antennas) self.ui.combo_ant.addItems(self.antennas)
#set up recommended sample rate #set up recommended sample rate
recommended_rate = min(x for x in self.rates if x >= 4e6 and if len(self.rates) > 1:
max(self.rates) % x == 0) recommended_rate = min(x for x in self.rates if x >= 4e6 and
if recommended_rate >= 8.e6: max(self.rates) % x == 0)
self.ui.check_pmf.setChecked(True) if recommended_rate >= 8.e6:
self.ui.combo_rate.setCurrentIndex(self.rates.index(recommended_rate)) self.ui.check_pmf.setChecked(True)
self.ui.combo_rate.setCurrentIndex(self.rates.index(recommended_rate))
################ action handlers #################### ################ action handlers ####################
def on_combo_source_currentIndexChanged(self, index): def on_combo_source_currentIndexChanged(self, index):

View File

@ -102,7 +102,7 @@ class modes_radio (gr.top_block, pubsub):
#RX path args #RX path args
group.add_option("-r", "--rate", type="eng_float", default=4e6, group.add_option("-r", "--rate", type="eng_float", default=4e6,
help="set sample rate [default=%default]") help="set sample rate [default=%default]")
group.add_option("-T", "--threshold", type="eng_float", default=5.0, group.add_option("-T", "--threshold", type="eng_float", default=7.0,
help="set pulse detection threshold above noise in dB [default=%default]") help="set pulse detection threshold above noise in dB [default=%default]")
group.add_option("-p","--pmf", action="store_true", default=False, group.add_option("-p","--pmf", action="store_true", default=False,
help="Use pulse matched filtering [default=%default]") help="Use pulse matched filtering [default=%default]")
@ -119,7 +119,6 @@ class modes_radio (gr.top_block, pubsub):
if self.live_source(): if self.live_source():
self._u.set_gain(gain) self._u.set_gain(gain)
print "Gain is %f" % self.get_gain() print "Gain is %f" % self.get_gain()
return self.get_gain() return self.get_gain()
def set_rate(self, rate): def set_rate(self, rate):
@ -176,7 +175,7 @@ class modes_radio (gr.top_block, pubsub):
#osmocom doesn't have gain bucket distribution like UHD does #osmocom doesn't have gain bucket distribution like UHD does
elif options.source == "osmocom": #RTLSDR dongle or HackRF Jawbreaker elif options.source == "osmocom": #RTLSDR dongle or HackRF Jawbreaker
import osmosdr import osmosdr
self._u = osmosdr.source_c(options.args) self._u = osmosdr.source(options.args)
# self._u.set_sample_rate(3.2e6) #fixed for RTL dongles # self._u.set_sample_rate(3.2e6) #fixed for RTL dongles
self._u.set_sample_rate(options.rate) self._u.set_sample_rate(options.rate)
if not self._u.set_center_freq(options.freq): if not self._u.set_center_freq(options.freq):
@ -188,7 +187,7 @@ class modes_radio (gr.top_block, pubsub):
###DO NOT COMMIT ###DO NOT COMMIT
self._u.set_gain(14, "RF", 0) self._u.set_gain(14, "RF", 0)
self._u.set_gain(40, "IF", 0) self._u.set_gain(40, "IF", 0)
#self._u.set_gain(14, "BB", 0) self._u.set_gain(6, "BB", 0)
###DO NOT COMMIT ###DO NOT COMMIT
# self._u.set_gain(options.gain) # self._u.set_gain(options.gain)
print "Gain is %i" % self._u.get_gain() print "Gain is %i" % self._u.get_gain()
@ -214,3 +213,4 @@ class modes_radio (gr.top_block, pubsub):
def close(self): def close(self):
self._sender.close() self._sender.close()
self._u = None

View File

@ -19,7 +19,7 @@
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
# #
from gnuradio import gr, blocks from gnuradio import gr, blocks, filter
import air_modes_swig import air_modes_swig
class rx_path(gr.hier_block2): class rx_path(gr.hier_block2):
@ -36,6 +36,7 @@ class rx_path(gr.hier_block2):
# Convert incoming I/Q baseband to amplitude # Convert incoming I/Q baseband to amplitude
self._demod = blocks.complex_to_mag_squared() self._demod = blocks.complex_to_mag_squared()
# self._dcblock = filter.dc_blocker_ff(128, False)
self._bb = self._demod self._bb = self._demod
# Pulse matched filter for 0.5us pulses # Pulse matched filter for 0.5us pulses
@ -54,7 +55,7 @@ class rx_path(gr.hier_block2):
self._slicer = air_modes_swig.slicer(self._queue) self._slicer = air_modes_swig.slicer(self._queue)
# Wire up the flowgraph # Wire up the flowgraph
self.connect(self, self._demod) self.connect(self, self._demod)#, self._dcblock)
self.connect(self._bb, (self._sync, 0)) self.connect(self._bb, (self._sync, 0))
self.connect(self._bb, self._avg, (self._sync, 1)) self.connect(self._bb, self._avg, (self._sync, 1))
self.connect(self._sync, self._slicer) self.connect(self._sync, self._slicer)