Hi Marcus, I updated the flow graph (attached) as you suggested. It would be great if you can help check and let me know if I am wrong...
For upgrading the UHD, I followed this link. UHD is installed successfully. However, it seems that gnuradio does not call the latest UHD. Instead, it still calls uhd-host which is combined in the gnuradio package. Do you have suggestions about how to solve this problem? Thanks. Pengyu On Thu, Apr 23, 2015 at 6:28 PM, Marcus D. Leech <[email protected]> wrote: > On 04/23/2015 06:23 PM, Pengyu Zhang wrote: > >> Thanks for the inspiring tips. I did not use the WX GUI scope for >> checking the phase offset. Instead, I log the baseband signal received by >> each RX antenna. Then, I plot the IQ constellation of the received baseband >> for checking their phase offset. >> >> Can you be a bit more specific when you say the "multi_usrp object" and >> the "timed commands"? Are there tutorials that I can follow step by step >> for using the two functions you mentioned? Your comments are very helpful :) >> >> A source/sink block in Gnu Radio uses an underlying multi_usrp object, > so all you have to do is configure your source block for two channels, with > two devices, and use > > addr0=<first-device-ip-addr,addr1=<second-device-ip-addr> > > In the device arguments. > > Also, recent gr-uhd (3.7.6.1 and newer at least) use timed commands, so > phase-zeroing will happen after a tune automatically, without you having > to do anything. > > > The top of the UHD manual is here: > > > http://files.ettus.com/manual/page_devices.htmlhttp://files.ettus.com/manual/page_devices.html > > The Doxygen docs are here: > > http://files.ettus.com/manual/page_coding.html > > The documents for gr-uhd are part of the Gnu Radio documentation: > > http://gnuradio.org/doc/doxygen/classgr_1_1uhd_1_1usrp__source.html > > >
mimo_signal.grc
Description: Binary data
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Fri Apr 24 16:18:47 2015
##################################################
from gnuradio import analog
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import uhd
from gnuradio import wxgui
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from gnuradio.wxgui import scopesink2
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import time
import wx
class top_block(grc_wxgui.top_block_gui):
def __init__(self):
grc_wxgui.top_block_gui.__init__(self, title="Top Block")
_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 100000
##################################################
# Blocks
##################################################
self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
self.GetWin(),
title="amp scope",
sample_rate=samp_rate,
v_scale=0,
v_offset=0,
t_scale=0,
ac_couple=True,
xy_mode=False,
num_inputs=2,
trig_mode=wxgui.TRIG_MODE_AUTO,
y_axis_label="Counts",
)
self.Add(self.wxgui_scopesink2_1.win)
self.uhd_usrp_source_0 = uhd.usrp_source(
device_addr="addr0=192.168.10.2, addr1=192.168.10.3",
stream_args=uhd.stream_args(
cpu_format="fc32",
channels=range(2),
),
)
self.uhd_usrp_source_0.set_clock_source("external", 0)
self.uhd_usrp_source_0.set_time_source("external", 0)
self.uhd_usrp_source_0.set_subdev_spec("A:0", 0)
self.uhd_usrp_source_0.set_clock_source("external", 1)
self.uhd_usrp_source_0.set_time_source("external", 1)
self.uhd_usrp_source_0.set_subdev_spec("A:0", 1)
self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec())
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
self.uhd_usrp_source_0.set_center_freq(915000000, 0)
self.uhd_usrp_source_0.set_gain(10, 0)
self.uhd_usrp_source_0.set_antenna("RX2", 0)
self.uhd_usrp_source_0.set_bandwidth(2000000, 0)
self.uhd_usrp_source_0.set_center_freq(915000000, 1)
self.uhd_usrp_source_0.set_gain(10, 1)
self.uhd_usrp_source_0.set_antenna("RX2", 1)
self.uhd_usrp_source_0.set_bandwidth(2000000, 1)
self.uhd_usrp_sink_0 = uhd.usrp_sink(
device_addr="addr0=192.168.10.3",
stream_args=uhd.stream_args(
cpu_format="fc32",
channels=range(1),
),
)
self.uhd_usrp_sink_0.set_clock_source("external", 0)
self.uhd_usrp_sink_0.set_time_source("external", 0)
self.uhd_usrp_sink_0.set_subdev_spec("A:0", 0)
self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec())
self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
self.uhd_usrp_sink_0.set_center_freq(915000000, 0)
self.uhd_usrp_sink_0.set_gain(10, 0)
self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
self.uhd_usrp_sink_0.set_bandwidth(2000000, 0)
self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/vijaykp/rx2_", False)
self.blocks_file_sink_1.set_unbuffered(False)
self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/vijaykp/rx1_", False)
self.blocks_file_sink_0.set_unbuffered(False)
self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1)
self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_CONST_WAVE, 1000, 0.5, 0)
##################################################
# Connections
##################################################
self.connect((self.blocks_complex_to_mag_0, 0), (self.wxgui_scopesink2_1, 0))
self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_0, 0))
self.connect((self.blocks_complex_to_mag_0_0, 0), (self.wxgui_scopesink2_1, 1))
self.connect((self.uhd_usrp_source_0, 0), (self.blocks_file_sink_0, 0))
self.connect((self.analog_sig_source_x_1, 0), (self.blocks_float_to_complex_0, 0))
self.connect((self.analog_sig_source_x_1, 0), (self.blocks_float_to_complex_0, 1))
self.connect((self.blocks_float_to_complex_0, 0), (self.uhd_usrp_sink_0, 0))
self.connect((self.uhd_usrp_source_0, 1), (self.blocks_file_sink_1, 0))
self.connect((self.uhd_usrp_source_0, 1), (self.blocks_complex_to_mag_0_0, 0))
# QT sink close method reimplementation
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate)
self.analog_sig_source_x_1.set_sampling_freq(self.samp_rate)
self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate)
self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
if __name__ == '__main__':
import ctypes
import os
if os.name == 'posix':
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
tb = top_block()
tb.Start(True)
tb.Wait()
_______________________________________________ Discuss-gnuradio mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
