I am currently trying to get some basic code working to test that my
shiny new USRP is working correctly. I have been going over the
code/examples/list archives for a few weeks on and off, but most of
the code examples are for the basic RX/TX boards, and I only have two
RFX2400’s.
My testing plan was to use the A side to send out some unmodulated
data (which should be the same as OOK? right?) and receive it at the B
side using the WA5VJB antennas, but I can’t seem to get it to work. I
have put together the following code based on the examples and what
help I could find searching the list archives. I’m thinking it should
play a sine wave out my speakers, but all I hear is static.
Additionally, I get a lot of ‘iU’ in the output, I was able to find
that U meant underflow, but there was no ‘i’ listed in the key, just
‘a’ and ‘u’.
So I have two questions that I hope someone has the answer to:
- Why don’t I hear a pretty sine wave?
- What type of underflow is indicated by the letter ‘i’
Thanks
Jason
Output
Using TX board A: Flex 2400 Tx MIMO B
Using RX board B: Flex 2400 Rx MIMO B
gr_fir_fff: using SSE
Press Enter to quit: uUiUiUiU(Lots more iU)
===================
Code
from gnuradio import gr
from gnuradio import audio
from gnuradio import usrp
def build_graph ():
#Parametrs
tx_inter_rate = 512
trans_freq = 24e8
rx_decim_rate = 128;
#Create the flow graph
fg = gr.top_block ()
#Create the USRP sink (transmitter)
ut = usrp.sink_c (0, tx_inter_rate)
#First choose the transmitting device
#tx_sd = usrp.pick_tx_subdevice(ut)
tx_sd = (0,0) #manually choose the correct device
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 (48000, gr.GR_SIN_WAVE, 350, 0.5)
fg.connect (src0, ut)
#Create the USRP Source (receiver)
ur = usrp.source_c(0,rx_decim_rate)
#Choose the recieving device
rx_sd = (1,0)
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, trans_freq)
if not r:
sys.stderr.write(‘Failed to set RF recieve frequency\n’)
raise SystemExit
#Make sure we are using the RX
r_subdev.select_rx_antenna( ‘RX2’)
#Convert complex data to sound samples
conv2 = gr.complex_to_float ()
#Decimate the received signal to soundcard rates
dec_filt = gr.fir_filter_fff(5,(1.0, 1.0, 1.0));
#Write received data to the soundcard
dst = audio.sink (48000)
#Connect the Source to the audio sink
fg.connect (ur,conv2)
fg.connect (conv2,dec_filt)
fg.connect (dec_filt,dst)
return fg
if name == ‘main’:
fg = build_graph ()
fg.start ()
raw_input ('Press Enter to quit: ')
fg.stop ()