discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Simple full duplex communication using Basic Tx and T


From: Narayanan, Sivaramasubramanian (R&T)
Subject: [Discuss-gnuradio] Simple full duplex communication using Basic Tx and TVRX board
Date: Wed, 18 Feb 2009 18:14:54 +0530

Hello,
 
I am trying to implement a transceiver (Full Duplex) with a Basix TX board and TVRX board.
 
I generate a sine wave(3500 Hz) and transmit using Basix Tx at 100MHz.
 
I also want to tune the TVRX board to 100MHz and receive the same signal and plot it on the scope in the GUI.
 
I tried the following code. But I did not get any received signal in the scope.
 
Please let me know what could be the problem and the corrections needed to make it work.
 
Thanks a lot.
Sivaram
 
 
 
 
#!/usr/bin/env python
from gnuradio import gr, usrp
from gnuradio.wxgui import stdgui2, scopesink2
import wx
 
class wfm_scope(stdgui2.std_top_block):
     def __init__(self, frame, panel, vbox, argv):
       stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
 
#Parametrs
 tx_inter_rate = 400
 trans_freq = 100e6
 recv_freq = 100e6
 
 #Create the USRP sink (transmitter)
 ut = usrp.sink_c (0, tx_inter_rate)
 dac_rate = ut.dac_rate()
 sampl_rate = dac_rate / tx_inter_rate
 
 #First choose the transmitting device
  tx_sd = usrp.pick_tx_subdevice(ut)
 m = usrp.determine_tx_mux_value(ut, tx_sd)
 ut.set_mux(m)
 t_subdev = usrp.selected_subdev(ut, tx_sd)
 print "Using TX board %s" % (t_subdev.side_and_name(),)
 
 #Transmit at the maximum possible gain
 t_subdev.set_gain(t_subdev.gain_range()[1])
 
 #Set the transmit frequency and check that it worked
 r = ut.tune(t_subdev._which, t_subdev, trans_freq)
 
 if not r:
  sys.stderr.write('Failed to set RF transmit frequency\n')
  raise SystemExit
 
 #Turn on the transmitter
 t_subdev.set_enable(True)
 
 #Connect the sink to a SIN source
 src0 = gr.sig_source_c (sampl_rate, # sample rate
   gr.GR_SIN_WAVE, # waveform type
   3500,  # frequency
   16000,  # max amplitude
   0)  # DC Offset
 
 self.connect (src0, ut)
 
#---------------------------------------------------------------------------------
 #Create the USRP Source (receiver)
 ur = usrp.source_c(0)
 adc_rate = ur.adc_rate()
 rx_decim_rate = int(adc_rate // sampl_rate)
 ur.set_decim_rate(rx_decim_rate)
 print "Rx decim rate ", rx_decim_rate
 
 #Choose the recieving device
 rx_sd = usrp.pick_rx_subdevice(ur)
 m = usrp.determine_rx_mux_value(ur, rx_sd)
 ur.set_mux(m)
 r_subdev = usrp.selected_subdev(ur, rx_sd)
 print "Using RX board %s" % (r_subdev.side_and_name(),)
 
 #Set the recieve frequency
 r = ur.tune(r_subdev._which, r_subdev, recv_freq)
 
 if not r:
  sys.stderr.write('Failed to set RF recieve frequency\n')
  raise SystemExit
 
 conv2 = gr.complex_to_float ()
 cf = gr.complex_to_float()
 self.connect (ur,conv2)
 # scope as final sink
 self.foo = scopesink2.scope_sink_f(panel, title="Received signal", sample_rate=sampl_rate,v_scale=5e3)
 self.connect (conv2, (self.foo,0))
 vbox.Add (self.foo.win, 1, wx.EXPAND)
 self.foo1 = scopesink2.scope_sink_f(panel, title="Transmitted signal", sample_rate=sampl_rate,v_scale=5e3)
 self.connect (src0, cf, (self.foo1,0))
 vbox.Add (self.foo1.win, 1, wx.EXPAND)
 
if __name__ == '__main__':
 app = stdgui2.stdapp (wfm_scope, "WFM RX")
 app.MainLoop ()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]