Beispiel #1
0
# The purpose of this file is to test the full transmit and receive
# flow in ZMQ loopback test mode.

import sys
import time
sys.path.append('../src')
import zmq_utils as zmu
import rf_mgt as rfm
import xfil
import host

if __name__ == "__main__":

    # build flowgraph config objects
    rf_params = rfm.RfParams()
    bb_params = rfm.BbParams()
    #rf_params.print_vals()

    # instance the host and xfil
    host = host.hostClass(init_rf_params=rf_params,
                          init_bb_params=bb_params,
                          tcp_tx=zmu.TCP_TX_HOST,
                          tcp_rx=zmu.TCP_RX_HOST)
    host.set_uplink_config(rf_params=rf_params,
                           bb_params=bb_params)
    xfil = xfil.xfilClass(init_rf_params=rf_params,
                          init_bb_params=bb_params,
                          tcp_rx=zmu.TCP_RX_XFIL,
                          tcp_tx=zmu.TCP_TX_XFIL)
Beispiel #2
0
if (args.tx_gain is None) or not (0 <= args.tx_gain <= 70):
    tx_gain = args.tx_gain
else:
    tx_gain = rfm.DEF_TX_GAIN
verbose = False if (args.verbose is None) else bool(args.verbose)
if verbose:
    print "Command Line Args:"
    print "  SDR Sel = {}".format(sdr_hw)
    print "  Mod Scheme = {}".format(mod_scheme)
    print "  Verbose = {}".format(verbose)
    temp = raw_input("press any key to continue")

if __name__ == "__main__":
    # build flowgraph config objects using defaults
    # to change these, simply assign fields to you chosen values
    rf_params = rfm.RfParams()
    rf_params.mod_scheme = mod_scheme
    rf_params.tx_gain = tx_gain
    bb_params = rfm.BbParams()

    # instance a radio (this is a half-duplex transceiver, but we'll
    # only use it in transmit mode)
    tx_radio = rs.RadioStack(rx_rf_params=rf_params,
                             rx_bb_params=bb_params,
                             tx_rf_params=rf_params,
                             tx_bb_params=bb_params,
                             tcp_params=zmu.tcp_params_host,
                             sdr_sel=sdr_hw)
    # enable the transmitter
    tx_radio.switch_to_tx()
Beispiel #3
0
sdr_hw = rfm.HW_TEST if (args.sdr_hw is None) else args.sdr_hw
verbose = False if (args.verbose is None) else bool(args.verbose)
if verbose:
    print "Command Line Args:"
    print "  SDR Sel = {}".format(sdr_hw)
    print "  Verbose = {}".format(verbose)

# read text into a list of lines; each of these lines will be a payload
# for the xfil box to send upstream to the host
with open("raven.txt") as f:
    xfil_data = f.readlines()
xfil_data = [x.strip() for x in xfil_data]

if __name__ == "__main__":
    # build flowgraph config objects for the control channel
    rf_params = rfm.RfParams()
    rf_params.sdr_hw = sdr_hw
    rf_params.freq_offset_corr = rfm.XFIL_FREQ_CORR  # corr for hackrf
    bb_params = rfm.BbParams()

    # create some param objects to hold the reconfiguration when it comes in
    tx_rf_params = rfm.RfParams()
    tx_rf_params.sdr_hw = sdr_hw
    tx_rf_params.freq_offset_corr = rfm.XFIL_FREQ_CORR  # corr for hackrf
    tx_bb_params = rfm.BbParams()

    # instance the xfil, using the default for both rx and tx
    # (tx will be changed later via control link)
    xfil = rs.RadioStack(rx_rf_params=rf_params,
                         rx_bb_params=bb_params,
                         tx_rf_params=rf_params,
Beispiel #4
0
SYMBOL_TIME = 100e-6
PREAMBLE_BITS = [0,1,0,1, 0,1,0,1, 0,1,0,1, 0,1,0,1]
PREAMBLE_BYTES = [0x55, 0x55]


if __name__ == "__main__":

    # build rf and bb params objects; these will drive the transmitter
    # and the receiver
    rf_params = rfm.RfParams(sdr_hw=rfm.HW_TEST,
                             samp_rate=SAMP_RATE,
                             center_freq=CENTER_FREQ,
                             freq=FREQ,
                             channel_width=CHANNEL_WIDTH,
                             mod_scheme=rfm.MOD_OOK,
                             threshold=0.5,
                             agc_enable=True,
                             fsk_dev=0,
                             psk_const_num=0,
                             rx_gain=50,
                             tx_gain=50
                             )
    bb_params = rfm.BbParams(encoding=rfm.ENC_NRZ,
                             preamble=PREAMBLE_BITS,
                             symbol_time=SYMBOL_TIME
                             )

    # create socket for zmq
    context = zmq.Context.instance()
    zmq_socket = context.socket(zmq.PUSH)
    zmq_socket.bind(tcp_str)
Beispiel #5
0
# The purpose of this file is to test the full transmit and receive
# flow in ZMQ loopback test mode.

import sys
import time
sys.path.append('../src')
import zmq_utils as zmu
import rf_mgt as rfm
import xfil
import host

if __name__ == "__main__":

    # build flowgraph config objects
    rf_params = rfm.RfParams()
    bb_params = rfm.BbParams()

    # instance the host and xfil
    host = host.hostClass(init_rf_params=rf_params,
                          init_bb_params=bb_params,
                          tcp_tx=zmu.TCP_TX_HOST,
                          tcp_rx=zmu.TCP_RX_HOST)
    host.set_uplink_config(rf_params=rf_params,
                           bb_params=bb_params)
    xfil = xfil.xfilClass(init_rf_params=rf_params,
                          init_bb_params=bb_params,
                          tcp_rx=zmu.TCP_RX_XFIL,
                          tcp_tx=zmu.TCP_TX_XFIL)

    cmd_list = [1,2,3,4,5,6,7]