discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Using gr.head with multi-channel receiving


From: shea_watson
Subject: [Discuss-gnuradio] Using gr.head with multi-channel receiving
Date: Wed, 28 Mar 2012 15:47:03 -0700 (PDT)

Hello,

I am trying to receive two channels at once with the USRP N210 and a TVRX2
daughterboard.  My code to set up the top block is below:

class collect_double_tb(grc_wxgui.top_block_gui):

        def __init__(self,centerfreq0,filename0,centerfreq1,filename1,nsamples):
                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 = 20000000

                ##################################################
                # Blocks
                ##################################################
                
                self.uhd_usrp_source_0 = uhd.usrp_source(
                        device_addr="",
                        stream_args=uhd.stream_args(
                                cpu_format="fc32",
                                channels=range(2),
                        ),
                )
                
                self.uhd_usrp_source_0.set_subdev_spec("A:RX1 A:RX2", 0)
                self.uhd_usrp_source_0.set_samp_rate(samp_rate)
                self.uhd_usrp_source_0.set_center_freq(centerfreq0, 0)
                self.uhd_usrp_source_0.set_gain(3, 0)
                self.uhd_usrp_source_0.set_center_freq(centerfreq1, 1)
                self.uhd_usrp_source_0.set_gain(3, 1)
                self.gr_file_sink_0 = gr.file_sink(gr.sizeof_gr_complex*1, 
filename0)
                self.gr_file_sink_0.set_unbuffered(False)
                self.gr_file_sink_1 = gr.file_sink(gr.sizeof_gr_complex*1, 
filename1)
                self.gr_file_sink_1.set_unbuffered(False)

                self._head0 = gr.head(gr.sizeof_gr_complex,int(nsamples))
                self._head1 = gr.head(gr.sizeof_gr_complex,int(nsamples))
                
                ##################################################
                # Connections
                ##################################################
                self.connect((self.uhd_usrp_source_0, 0),self._head0,
(self.gr_file_sink_0, 0))
                self.connect((self.uhd_usrp_source_0, 1),self._head1,
(self.gr_file_sink_1, 0))


Then, to run this top block, I run:

tb = collect_double_tb(f0,filename0,f1,filename1,nsamples)
tb.run()
tb = None


The problem is, no matter what I set nsamples to, I always get a 17.4 kB
file.  Are there limitations with using gr.head this way with two channel
reception?  Or, is there a better way to g about collecting a specific
amount of data with two channels receiving simultaneously?

Thank you,

SW

-- 
View this message in context: 
http://old.nabble.com/Using-gr.head-with-multi-channel-receiving-tp33544858p33544858.html
Sent from the GnuRadio mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]