Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maint 3.7 #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,311 changes: 1,311 additions & 0 deletions examples/Frame_Sync_Example.grc

Large diffs are not rendered by default.

5,622 changes: 5,622 additions & 0 deletions examples/HackRF_RTLSDR_loopback_test.grc

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions examples/epy_block_0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
Embedded Python Blocks:

Each time this file is saved, GRC will instantiate the first class it finds
to get ports and parameters of your block. The arguments to __init__ will
be the parameters. All of them are required to have default values!
"""

import numpy as np
import pylab
from gnuradio import gr
import pmt


class msg_block(gr.basic_block): # other base classes are basic_block, decim_block, interp_block
"""Convert strings to uint8 vectors"""

def __init__(self): # only default arguments here
"""arguments to this function show up as parameters in GRC"""
gr.basic_block.__init__(
self,
name='Embedded Python Block', # will show up in GRC
in_sig=None,
out_sig=None
)
self.message_port_register_out(pmt.intern('msg_out'))
self.message_port_register_in(pmt.intern('msg_in'))
self.set_msg_handler(pmt.intern('msg_in'), self.handle_msg)

def handle_msg(self, msg):

nvec = pmt.to_python(msg)

self.message_port_pub(pmt.intern('msg_out'), pmt.cons(pmt.make_dict(), pmt.pmt_to_python.numpy_to_uvector(np.array([ord(c) for c in nvec], np.uint8))))


def work(self, input_items, output_items):
pass
Binary file added examples/fmmod.dat
Binary file not shown.
Binary file added examples/gaussian_filter.dat
Binary file not shown.
Empty file modified examples/microsoft_mouse_sniffer.py
100755 → 100644
Empty file.
Empty file modified examples/nordic_auto_ack.py
100755 → 100644
Empty file.
15 changes: 9 additions & 6 deletions examples/nordic_channelized_receiver.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from gnuradio import gr, blocks, digital, filter
from gnuradio.filter import firdes
from gnuradio import iio
import thread
import nordic
import pmt
Expand Down Expand Up @@ -34,11 +35,13 @@ def __init__(self, args):
dr = 2 # 2M

# SDR source (gr-osmosdr source)
self.osmosdr_source = osmosdr.source()
self.osmosdr_source.set_sample_rate(self.sample_rate * channel_count)
self.osmosdr_source.set_center_freq(self.freq)
self.osmosdr_source.set_gain(self.gain)
self.osmosdr_source.set_antenna('TX/RX')
#self.osmosdr_source = osmosdr.source()
#self.osmosdr_source.set_sample_rate(self.sample_rate * channel_count)
#self.osmosdr_source.set_center_freq(self.freq)
#self.osmosdr_source.set_gain(self.gain)
#self.osmosdr_source.set_antenna('TX/RX')
self.pluto_source = iio.pluto_source('', int(self.freq), int(int(self.sample_rate * channel_count)), int(2e6), 0x8000, True, True, True, "manual", 64.0, '', True)
#self.pluto_sink = iio.pluto_sink('192.168.2.1', int(self.freq), int(int(self.sample_rate * channel_count)), int(2e6), 0x8000, False, 10.0, '', True)

# PFB channelizer
taps = firdes.low_pass_2(
Expand All @@ -48,7 +51,7 @@ def __init__(self, args):
# Stream to streams (PFB channelizer input)
self.s2ss = blocks.stream_to_streams(
gr.sizeof_gr_complex, channel_count)
self.connect(self.osmosdr_source, self.s2ss)
self.connect(self.pluto_source, self.s2ss)

# Demodulators and packet deframers
self.nordictap_printer = nordictap_printer()
Expand Down
57 changes: 17 additions & 40 deletions examples/nordic_channelized_transmitter.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import array
import random
import osmosdr
from gnuradio import iio
import argparse
from bitstring import BitArray
from gnuradio import uhd
Expand Down Expand Up @@ -40,59 +41,35 @@ def __init__(self, args):
self.osmosdr_sink.set_center_freq(self.freq)
self.osmosdr_sink.set_gain(self.gain)
self.osmosdr_sink.set_antenna('TX/RX')
#self.pluto_sink = iio.pluto_sink('192.168.2.1', int(self.freq), int(int(self.sample_rate * channel_count)), int(2e6), 0x8000, False, 10.0, '', True)

# PFB channelizer
taps = firdes.low_pass_2(
1, self.sample_rate, self.symbol_rate / 2, 100e3, 30)
self.synthesizer = filter.pfb_synthesizer_ccf(channel_count, taps)

# Modulators and packet framers
self.nordictap_transmitter = nordictap_transmitter(channel_map)
self.nordictap_transmitter = nordic.nordictap_transmitter(channel_map)
self.mods = []
self.tx = nordic.nordic_tx(channel_count)
for x in range(channel_count):
self.mods.append(digital.gfsk_mod())
self.mods.append(digital.gfsk_mod(
samples_per_symbol=2,
sensitivity=1.0,
bt=0.35,
verbose=True,
log=True,))
self.connect((self.tx, x), self.mods[x])
self.connect(self.mods[x], (self.synthesizer, x))
self.connect(self.synthesizer, self.osmosdr_sink)

# Wire up output packet connection
self.blocks_message_debug = blocks.message_debug()

# Wire up output packet connection
self.msg_connect(self.nordictap_transmitter,
"nordictap_out", self.tx, "nordictap_in")


# Nordic transmitter strobe
class nordictap_transmitter(gr.sync_block):

# Constructor

def __init__(self, channel_map):
gr.sync_block.__init__(
self, name="Nordictap Printer/Transmitter", in_sig=None, out_sig=None)

self.channel_map = channel_map

# Packet output port
self.message_port_register_out(pmt.intern("nordictap_out"))

# Transmit a packet
def transmit(self, address, payload, channel_index, sequence_number):

channel = self.channel_map[channel_index]

# Build a payload
nordictap = [channel_index] + [
channel, 2, len(address), len(payload), sequence_number, 0, 2]
for c in address:
nordictap.append(ord(c))
for c in payload:
nordictap.append(ord(c))

# Transmit packet
vec = pmt.make_u8vector(len(nordictap), 0)
for x in range(len(nordictap)):
pmt.u8vector_set(vec, x, nordictap[x])
self.message_port_pub(pmt.intern("nordictap_out"), vec)
self.msg_connect(self.nordictap_transmitter,
"nordictap_out", self.blocks_message_debug, "print")


def main():
Expand All @@ -109,8 +86,8 @@ def main():
tb.start()

# Transmit some packets, hopping between three channels
address = '\x11\x22\x11\x22\x11'
payload = '\x55\x44\x33\x22\x11'
address = '\x55\x55\x55\x55\x55'
payload = '\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA'
sequence_number = 0
while True:
for x in range(3):
Expand All @@ -119,7 +96,7 @@ def main():
sequence_number += 1
if sequence_number > 3:
sequence_number = 0
time.sleep(0.1)
time.sleep(0.2)

try:
raw_input('Press Enter to quit: ')
Expand Down
20 changes: 11 additions & 9 deletions examples/nordic_receiver.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from gnuradio import gr, blocks, digital, filter
from gnuradio.filter import firdes
from gnuradio import iio
import thread
import nordic
import pmt
Expand All @@ -13,7 +14,7 @@
import argparse
from bitstring import BitArray
from gnuradio import uhd
from Queue import Queue
#from Queue import Queue


class top_block(gr.top_block):
Expand All @@ -28,11 +29,12 @@ def __init__(self, args):
self.sample_rate = args.data_rate * args.samples_per_symbol

# SDR source (gr-osmosdr source)_tx_queue.push(msg);
self.osmosdr_source = osmosdr.source()
self.osmosdr_source.set_sample_rate(self.sample_rate)
self.osmosdr_source.set_center_freq(self.freq)
self.osmosdr_source.set_gain(self.gain)
self.osmosdr_source.set_antenna('TX/RX')
#self.osmosdr_source = osmosdr.source()
#self.osmosdr_source.set_sample_rate(self.sample_rate)
#self.osmosdr_source.set_center_freq(self.freq)
#self.osmosdr_source.set_gain(self.gain)
#self.osmosdr_source.set_antenna('TX/RX')
self.pluto_source = iio.pluto_source('', int(self.freq), int(self.sample_rate), int(2e6), 0x8000, True, True, True, "manual", 60.0, '', True)

# Receive chain
dr = 0
Expand All @@ -45,8 +47,8 @@ def __init__(self, args):
self.gfsk_demod = digital.gfsk_demod(
samples_per_symbol=args.samples_per_symbol)
self.lpf = filter.fir_filter_ccf(
1, firdes.low_pass_2(1, self.sample_rate, self.symbol_rate / 2, 50e3, 50))
self.connect(self.osmosdr_source, self.lpf)
1, firdes.low_pass_2(1, self.sample_rate, self.symbol_rate / 2, 100e3, 50))
self.connect(self.pluto_source, self.lpf)
self.connect(self.lpf, self.gfsk_demod)
self.connect(self.gfsk_demod, self.rx)

Expand All @@ -56,7 +58,7 @@ def __init__(self, args):
self.rx, "nordictap_out", self.nordictap_printer, "nordictap_in")


# Nordic Printer
# Nordic Printeror
class nordictap_printer(gr.sync_block):

# Constructor
Expand Down
6 changes: 3 additions & 3 deletions examples/nordic_sniffer_scanner.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self):

# SDR configuration
self.freq = 2402e6
self.gain = 70
self.gain = 60
self.symbol_rate = 2e6
self.sample_rate = 4e6

Expand All @@ -30,7 +30,7 @@ def __init__(self):

# Low pass filter
self.lpf = filter.fir_filter_ccf(
1, firdes.low_pass_2(1, self.sample_rate, self.symbol_rate / 2, 50e3, 50))
1, firdes.low_pass_2(1, self.sample_rate, self.symbol_rate / 2, 100e3, 50))

# GFSK demod, defaults to 2 samples per symbol
self.gfsk_demod = digital.gfsk_demod()
Expand Down Expand Up @@ -76,7 +76,7 @@ def __init__(self, tb):
thread.start_new_thread(self.tick, ())

# Channels and channel groups
self.channels = range(2, 84)
self.channels = range(2, 102)

# 10ms tick
def tick(self):
Expand Down