[USRP-users] about synchronization btw USRP(Min)

天杨 闵 mty513 at msn.com
Tue Dec 9 12:09:54 EST 2014


Hi  Marcus Mueller:

I am using NSRPN200 to make a channel sounder rightnow.
the accurate sample timing synchronization is very necessary for me.
I used the timed commands you suggested.
I should say it is better than before, but there still existed timing offset.
the result is like sometime it is accurate, however sometime it does not
I attached the Tx side code below.
could you please check my code here, the red part is where I modified.
is there any problem in it?

******************************************************************************** 
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
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 = 32000

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="addr=192.168.0.95",
            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_time_unknown_pps(uhd.time_spec(1.0))
        self.uhd_usrp_sink_0.set_time_next_pps(uhd.time_spec(1.0))
        self.uhd_usrp_sink_0.set_start_time(uhd.time_spec(3.0))
        self.uhd_usrp_sink_0.set_samp_rate(25000000)
        self.uhd_usrp_sink_0.set_center_freq(2400000000, 0)
        self.uhd_usrp_sink_0.set_gain(30, 0)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/mnt/ramdisk/tx_data5.dat", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.uhd_usrp_sink_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

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

Best regards

Min
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20141210/99b722d9/attachment-0002.html>


More information about the USRP-users mailing list