I have tried transmitting an analog signal from one USRP2 to another, but
when I run usrp2_fft.py on the rx computer, there is no receive signal.  The
analog signal is supposed to be two tones at 350 and 440 HZ transmitted at
2.6GHz.  Can anyone help me figure out what I am doing wrong?

I have tried using GRC, but at the most up to date version does not work
with Fedora, which is the OS that I have to use, this is for a research
project with a professor at my university, and the mandate is to use Fedora,
this does not look like it will change in the near future.

Alex
#!/usr/bin/env python

from gnuradio import gr
from gnuradio import usrp2
from gnuradio import audio
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import math

def build_graph(options, args):
	#These are set to 440 and 350
	freq0 = options.waveform_freq
	freq1 = options.waveform2_freq
	#This is the USRP2
	sink1 = usrp2.sink_32fc(options.interface,options.mac_addr)
	DACRate = sink1.dac_rate()
	interp = options.interp
	amp = .5
	scRate = 50e3 
	cFreq = 1/16*scRate
	tWidt = 1/16*scRate
	tFreq = 2.6e9
	#Sets the tranmsmit center frequency
	tx = sink1.set_center_freq(tFreq)
	print tx
	g  = sink1.set_gain(1)
	print g


	fg = gr.top_block()
	ethRate = DACRate/interp
	#Frequency generators
	src0 = gr.sig_source_f(scRate,gr.GR_SIN_WAVE,int(freq0),amp)
	src1 = gr.sig_source_f(scRate,gr.GR_SIN_WAVE,int(freq1),amp)
	add0 = gr.add_ff()
	#Converts the input samples to complex to transmit to USRP2
	f2c  = gr.float_to_complex()

	#Creates filter for interpolator
	chanCoeffs = gr.firdes.low_pass(1.0, scRate, 1000, 3000, gr.firdes.WIN_HAMMING)
	print ethRate/scRate
	print DACRate
	#Upsamples the input stream to transmit to the USRP2
	interp = gr.interp_fir_filter_ccf(int(ethRate/scRate),chanCoeffs)

	#Plays the two tones over speakers
	sink0 = audio.sink(int(scRate))
	fg.connect((src0, 0), (add0, 0))
	fg.connect((src1, 0), (add0, 1))
	fg.connect(add0, sink0)
	fg.connect(add0, f2c)
	fg.connect(f2c, interp)
	fg.connect(interp, sink1)
	
	return fg
def get_options():
    usage="%prog: [options]"

    parser = OptionParser(option_class=eng_option, usage=usage)

    parser.add_option("-e", "--interface", type="string", default="eth0",
                      help="Use specified Ethernet interface [default=%default]")
    parser.add_option("-m", "--mac-addr", type="string", default="",
                      help="Use USRP2 at specified MAC address [default=None]")  
    parser.add_option("-i", "--interp", type="int", default=16, metavar="INTERP",
                      help="Set FPGA interpolation rate of INTERP [default=%default]")
    parser.add_option("-f", "--tx-freq", type="eng_float", default=None,
                      help="Set carrier frequency to FREQ [default=mid-point]", metavar="FREQ")
    parser.add_option("--lo-offset", type="eng_float", default=None,
                      help="set daughterboard LO offset to OFFSET [default=hw default]")
    parser.add_option("-g", "--gain", type="eng_float", default=None,
                      help="Set TX gain to GAIN [default=mid-point]")
    parser.add_option("-w", "--waveform-freq", type="eng_float", default=440,
                      help="Set baseband waveform frequency to FREQ [default=%default]")
    parser.add_option("-x", "--waveform2-freq", type="eng_float", default=350,
                      help="Set 2nd waveform frequency to FREQ [default=%default]")
    parser.add_option("--sine", dest="type", action="store_const", const=gr.GR_SIN_WAVE,
                      help="Generate a carrier modulated by a complex sine wave", default=gr.GR_SIN_WAVE)
    parser.add_option("--const", dest="type", action="store_const", const=gr.GR_CONST_WAVE, 
                      help="Generate a constant carrier")
    parser.add_option("--offset", type="eng_float", default=0,
                      help="Set waveform phase offset to OFFSET [default=%default]")
    parser.add_option("--gaussian", dest="type", action="store_const", const=gr.GR_GAUSSIAN,
                      help="Generate Gaussian random output")
    parser.add_option("--uniform", dest="type", action="store_const", const=gr.GR_UNIFORM,
                      help="Generate Uniform random output")
    parser.add_option("--2tone", dest="type", action="store_const", const="2tone",
                      help="Generate Two Tone signal for IMD testing")
    parser.add_option("--sweep", dest="type", action="store_const", const="sweep",
                      help="Generate a swept sine wave")
    parser.add_option("-a", "--amplitude", type="eng_float", default=0.1,
                      help="Set output amplitude to AMPL (0.0-1.0) [default=%default]", metavar="AMPL")
    parser.add_option("-v", "--verbose", action="store_true", default=False,
                      help="Use verbose console output [default=%default]")

    (options, args) = parser.parse_args()

    return (options, args)

if __name__=="__main__":
	(options, args) = get_options()
	fg = build_graph(options, args)
	fg.start()
	raw_input('Press enter to quit: ')
	fg.stop()
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to