discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Read samples from two channels and write to file


From: Karthik Vijayraghavan
Subject: Re: [Discuss-gnuradio] Read samples from two channels and write to file
Date: Wed, 23 Apr 2008 12:37:05 -0700

On Wed, Apr 23, 2008 at 5:38 AM, Diana Iosifescu <address@hidden> wrote:
> Hello,
>  I am a student at the University of Aveiro, Portugal and I have just
>  started working at a project with GNU Radio and the USRP board.
>  I have a question regarding the sample acquisition.
>  I need to read the samples from both channels of a Basic Rx and then to
>  write them in a file.
>  Until now I have used the usrp_rx_cfile.py file, but it allows the
>  acquisition from only one channel. My question is: can I acquire data in
>  the same, from both channels?
>  Thanks for any help.
>  Diana
>  --
>  Posted via http://www.ruby-forum.com/.

I recently finished doing exactly this. The following code works for
me. I modified this from the multi_fft example file.

n_chans = 2;
self.rx_src = usrp.source_c()
rx_subdev = self.rx_src.db[0]+self.rx_src.db[1]
self.rx_src.set_mux(gru.hexint(0xf1f0f3f2))
deinterleaver = gr.deinterleave(gr.sizeof_gr_complex)
self.rx_src_fft0 =  fftsink2.fft_sink_c(panel,title="Ch
RXB-A",fft_size=fftsize_N,sample_rate=rx_rate/sw_decim)
self.rx_src_fft0 =  fftsink2.fft_sink_c(panel,title="Ch
RXB-B",fft_size=fftsize_N,sample_rate=rx_rate/sw_decim)

self.connect(self.rx_src,deinterleaver)
self.connect((deinterleaver,0),self.rx_src_fft0)
self.connect((deinterleaver,1),self.rx_src_fft1)
vbox.Add(self.rx_src_fft0.win,10,wx.EXPAND)
vbox.Add(self.rx_src_fft1.win,10,wx.EXPAND)

#Tune the receiver
for i in range(len(rx_subdev)):
       r = self.rx_src.tune(rx_subdev[i]._which, rx_subdev[i],carrier_freq)
       if not r:
            print "set_freq: failed to set subdev[%d] freq to %f" %
(i, carrier_freq)


RXB-A appears on (deinterleaver,0) ad RXB-B appears on
(deinterleaver,1). If you are using RXA then you might want to replace
the mux value by something like 0xf3f2f1f0.

Regards,
Karthik

-- 
www.stanford.edu/~karthikv




reply via email to

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