HackRF Jawbreaker enhancements -- selectable DC blocking filter improves short

pkt decoding.
This commit is contained in:
Nick Foster 2013-08-09 15:41:26 -07:00
parent 55559086ac
commit ca58874861
5 changed files with 34 additions and 9 deletions

View File

@ -58,12 +58,14 @@ class mainwindow(QtGui.QMainWindow):
if defaults["pmf"] is not None:
self.ui.check_pmf.setChecked(bool(defaults["pmf"]))
if defaults["dcblock"] is not None:
self.ui.check_dcblock.setChecked(bool(defaults["dcblock"]))
if defaults["samplerate"] is not None:
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.setMaximum(40)
self.ui.prog_rssi.setMinimum(-60)
self.ui.prog_rssi.setMaximum(0)
if defaults["antenna"] is None:
self.ui.combo_ant.setCurrentIndex(self.ui.combo_ant.findText("RX2"))
@ -295,6 +297,7 @@ class mainwindow(QtGui.QMainWindow):
options.gain = float(self.ui.line_gain.text())
options.threshold = float(self.ui.line_threshold.text())
options.pmf = self.ui.check_pmf.isChecked()
options.dcblock = self.ui.check_dcblock.isChecked()
self._servers = ["inproc://modes-radio-pub"] #TODO ADD REMOTES
self._relay = air_modes.zmq_pubsub_iface(self.context, subaddr=self._servers, pubaddr=None)
@ -378,6 +381,7 @@ class mainwindow(QtGui.QMainWindow):
self.prefs["antenna"] = options.antenna
self.prefs["gain"] = options.gain
self.prefs["pmf"] = "1" if options.pmf else "0"
self.prefs["dcblock"] = "1" if options.dcblock else "0"
self.prefs["source"] = self.ui.combo_source.currentText()
self.prefs["threshold"] = options.threshold
self.prefs["sbs1"] = "1" if self.ui.check_sbs1.isChecked() else "0"
@ -437,6 +441,7 @@ class mainwindow(QtGui.QMainWindow):
defaults = {}
defaults["samplerate"] = None #let app pick it
defaults["pmf"] = None
defaults["dcblock"] = None
defaults["antenna"] = None
defaults["gain"] = "25"
defaults["kml"] = "1"

View File

@ -427,7 +427,7 @@ def make_parser(pub):
try:
ret = air_modes.modes_report(modes_reply(int(data, 16)),
int(ecc, 16),
10.0*math.log10(float(reference)),
10.0*math.log10(max(1e-8,float(reference))),
air_modes.stamp(0, float(timestamp)))
pub["modes_dl"] = ret
pub["type%i_dl" % ret.data.get_type()] = ret

View File

@ -45,7 +45,8 @@ class modes_radio (gr.top_block, pubsub):
self._resample = None
self._setup_source(options)
self._rx_path = air_modes.rx_path(self._rate, options.threshold, self._queue, options.pmf)
self._rx_path = air_modes.rx_path(self._rate, options.threshold,
self._queue, options.pmf, options.dcblock)
#now subscribe to set various options via pubsub
self.subscribe("freq", self.set_freq)
@ -106,6 +107,8 @@ class modes_radio (gr.top_block, pubsub):
help="set pulse detection threshold above noise in dB [default=%default]")
group.add_option("-p","--pmf", action="store_true", default=False,
help="Use pulse matched filtering [default=%default]")
group.add_option("-d","--dcblock", action="store_true", default=False,
help="Use a DC blocking filter (best for HackRF Jawbreaker) [default=%default]")
parser.add_option_group(group)
@ -186,8 +189,9 @@ class modes_radio (gr.top_block, pubsub):
options.gain = 34
###DO NOT COMMIT
self._u.set_gain(14, "RF", 0)
self._u.set_gain(40, "IF", 0)
self._u.set_gain(30, "IF", 0)
self._u.set_gain(6, "BB", 0)
self._u.set_bandwidth(4e6)
###DO NOT COMMIT
# self._u.set_gain(options.gain)
print "Gain is %i" % self._u.get_gain()

View File

@ -24,7 +24,7 @@ import air_modes_swig
class rx_path(gr.hier_block2):
def __init__(self, rate, threshold, queue, use_pmf=False):
def __init__(self, rate, threshold, queue, use_pmf=False, use_dcblock=False):
gr.hier_block2.__init__(self, "modes_rx_path",
gr.io_signature(1, 1, gr.sizeof_gr_complex),
gr.io_signature(0,0,0))
@ -36,9 +36,13 @@ class rx_path(gr.hier_block2):
# Convert incoming I/Q baseband to amplitude
self._demod = blocks.complex_to_mag_squared()
# self._dcblock = filter.dc_blocker_ff(128, False)
self._bb = self._demod
if use_dcblock:
self._dcblock = filter.dc_blocker_cc(100*self._spc,True)
self.connect(self, self._dcblock, self._demod)
else:
self.connect(self, self._demod)
self._bb = self._demod
# Pulse matched filter for 0.5us pulses
if use_pmf:
self._pmf = blocks.moving_average_ff(self._spc, 1.0/self._spc)#, self._rate)
@ -55,7 +59,6 @@ class rx_path(gr.hier_block2):
self._slicer = air_modes_swig.slicer(self._queue)
# Wire up the flowgraph
self.connect(self, self._demod)#, self._dcblock)
self.connect(self._bb, (self._sync, 0))
self.connect(self._bb, self._avg, (self._sync, 1))
self.connect(self._sync, self._slicer)

View File

@ -316,6 +316,19 @@
<string>Use Pulse Matched Filtering</string>
</property>
</widget>
<widget class="QCheckBox" name="check_dcblock">
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<width>221</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Use DC blocking filter</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="group_output">
<property name="geometry">