Forum: GNU Radio (no subject)

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.
Narayanan, Sivaramasubramanian (R&T) (Guest)
on 2009-02-17 12:41
(Received via mailing list)
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 ()
Narayanan, Sivaramasubramanian (R&T) (Guest)
on 2009-02-18 14:47
(Received via mailing list)
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 ()
Martin B. (Guest)
on 2009-02-18 17:04
(Received via mailing list)
On Wed, Feb 18, 2009 at 06:14:54PM +0530, Narayanan, Sivaramasubramanian
(R&T) wrote:
> 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.

What exactly did you see? Did you try an FFT visualisation with
appropriate decimation? Your error and debugging procedure description
could be a bit more precise for others to help.
Do you have a spectrum analyser to see what's happening? At 100 MHz,
you could even use a normal FM radio to pick up something (you might
want to use a different test signal, in that case).

MB
This topic is locked and can not be replied to.