# (no subject)

**URL:** <https://www.ruby-forum.com/t/no-subject/160524>\
**Category:** GNU Radio\
**Created:** [February 17, 2009, 11:41am UTC](https://www.ruby-forum.com/t/no-subject/160524 "2009-02-17T11:41:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NarayananSS\_Sivaram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e8c25b/32.png) [@NarayananSS\_Sivaram](https://www.ruby-forum.com/u/NarayananSS_Sivaram)\
**Post date:** [February 17, 2009, 11:41am UTC](https://www.ruby-forum.com/t/no-subject/160524/1 "2009-02-17T11:41:43Z")

</div>

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 ()

---

<div class="post-metadata">

**Author:** ![NarayananSS\_Sivaram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e8c25b/32.png) [@NarayananSS\_Sivaram](https://www.ruby-forum.com/u/NarayananSS_Sivaram)\
**Post date:** [February 18, 2009, 1:47pm UTC](https://www.ruby-forum.com/t/no-subject/160524/2 "2009-02-18T13:47:57Z")

</div>

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 ()

---

<div class="post-metadata">

**Author:** ![NarayananSS\_Sivaram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e8c25b/32.png) [@NarayananSS\_Sivaram](https://www.ruby-forum.com/u/NarayananSS_Sivaram)\
**Post date:** [February 18, 2009, 4:04pm UTC](https://www.ruby-forum.com/t/no-subject/160524/3 "2009-02-18T16:04:57Z")

</div>

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
