Forum: GNU Radio Receive Problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
slimchao (Guest)
on 2008-12-10 19:25
(Received via mailing list)
i use LFRX und LFTX daughterboard for RFID-Anwendung und i try to send a
single gaussian puls with TX-daughterboards but i can not receive it
with
gr.file_sink(...).  can anybody help me?  my code is followed:

from gnuradio import gr, gru, eng_notation
from gnuradio import audio
from gnuradio import usrp
from gnuradio.eng_option import eng_option
from gnuradio.eng_notation import num_to_str, str_to_num
from optparse import OptionParser
import sys
import math
import wx
import time
from gnuradio.wxgui import stdgui, fftsink, form, slider, scopesink

def build_graph():

    fg = gr.flow_graph ()
    #
-------------------------------------------------------------------------
    # controllable values
    #
-------------------------------------------------------------------------
    tx_subdev_spec1=(1,0)
    rx_subdev_spec1=(1,0)
    adc_rate = 64e6
    dac_rate = 128e6
    nsamples = 4000
    decim_rate = 16
    interp_rate = 32
    target_freq = 1.356e7
    samplerate = dac_rate / interp_rate
    center_freq = 1.356e7

    #
#########################################################################
    # usrp is data sink (transmit path)
    #
#########################################################################
    tx = usrp.sink_c (0, interp_rate)
    tx.set_pga(0, 0)  #[-20,0] in dB

    #
-------------------------------------------------------------------------
    # determine the daughterboard subdevice we're using
    #
-------------------------------------------------------------------------
    tx_subdev = usrp.selected_subdev(tx, tx_subdev_spec1)
    print "Determining TX d'board %s" % (tx_subdev.side_and_name(),)
    tx_subdev.set_enable(True)
    print "Tuning TX d'board (side %s) to %sHz" %
(tx_subdev.side_and_name(), num_to_str(target_freq))
    tx.tune(tx_subdev._which, tx_subdev, target_freq)

    tx.set_mux(usrp.determine_tx_mux_value(tx, tx_subdev_spec1))
    print "TX mux value: 0x%08x" % (0xFFFFFFFFL
    & long(usrp.determine_tx_mux_value(tx, tx_subdev_spec1)))
    ss= tx.tune(tx_subdev._which, tx_subdev, target_freq)
    print "Interp rate: " + str(tx.interp_rate())
    print "DXC freq: ", num_to_str(ss.dxc_freq)
    print "N Channels: " + str(tx.set_nchannels(1))   # 1 or 2
    print "USB freq: " + str(tx.dac_freq()/tx.interp_rate())
    print "Tx freq: " + str(tx.tx_freq(0))
  #print "Number of DUC: " + str(self.tx.has_tx_halfband())

    print "PGA Min:" + str(tx.pga_min())
    print "PGA Max:" + str(tx.pga_max())

    #
#########################################################################
    # usrp is data source (receive path)
    #
#########################################################################
    rx = usrp.source_c (0, decim_rate)
    rx.set_pga(0, 20)       #[0, 20] in dB

    #
-------------------------------------------------------------------------
    # determine the daughterboard subdevice we're using
    #
-------------------------------------------------------------------------
    rx_subdev = usrp.selected_subdev(rx, rx_subdev_spec1)
    print "Determining RX d'board %s" % (rx_subdev.side_and_name(),)
    rx.set_mux(usrp.determine_rx_mux_value(rx, rx_subdev_spec1))
    print "RX mux value: 0x%08x" % (0xFFFFFFFFL
    & long(usrp.determine_rx_mux_value(rx, rx_subdev_spec1)))
    rx.tune(0, rx_subdev, target_freq)

    print "Decim rate: " + str(rx.decim_rate())
    print "Rx freq: " + str(rx.rx_freq(0))
    print "ADC freq: " + str(rx.adc_freq())
    print "N Channels: " + str(rx.set_nchannels(1))      #1,2,3 or 4

    #
#########################################################################
    # build one signal source, interleave it, amplify and connect it to
usrp
    #
#########################################################################
    src=gr.file_source(gr.sizeof_gr_complex,"/home/xx/test/gauss1012.dat",
False)
    # type convertion
    #convert = gr.float_to_complex ()
    # and wire it up
    #fg.connect(src, convert)
    fg.connect(src, tx)

    #
#########################################################################
    # save receive signal as *.dat or *.txt
    # The current day and time is the name of the saved data in the
subdirectory
    #
#########################################################################
    today = time.strftime('%Y%m%d')
    # The current time
    now = time.strftime('%H%M%S')
    #head = gr.head(gr.sizeof_gr_complex, nsamples)
    #dst=gr.file_sink(gr.sizeof_gr_complex, "/home/xx/test/" + today +
now +
"tx.dat")
    #fg.connect(src, head, dst)

    head0 = gr.head(gr.sizeof_gr_complex, nsamples)
    dst0=gr.file_sink(gr.sizeof_gr_complex, "/home/xx/test/" +today +
now +
"rx.dat")
    fg.connect(rx, head0, dst0)

    return fg


###################
# main function   #
###################
if __name__ == '__main__':
   fg = build_graph()
   fg.start()
   raw_input('press Enter to quit: ')

   fg.stop()

--
View this message in context:
http://www.nabble.com/Receive-Problem-tp20939900p2...
Sent from the GnuRadio mailing list archive at Nabble.com.
This topic is locked and can not be replied to.