Storing A/D samples in memory

As a part of some research work on cooperative communications in
wireless
networks, I had decided to use
the USRP as one the of my implementation platforms. I used the tutorials
by
D. Shen as a reference. There are, however , some specific problems I
need
help with :

I need to store the received signal A/D samples (before all the
post-demod processing stuff takes place) in memory and to correlate
them
with similar samples stored somewhere else in memory. Once this initial
processing is done, I can move on to the demod part. The sample
storage/correlation part is where I am
getting stuck time and again. Is there some specific block I am going
to
need or do I need to write my own signal processing block from scratch?
I tried looking in the mailing list archives but
couldn’t
find anything similar. Kindly point to any suitable reference on this
topic
I may have overlooked.

Sincerely,
Kshitij

On Jul 18, 2007, at 4:53 PM, Kshitij Kumar S. wrote:

As a part of some research work on cooperative communications in
wireless networks, I had decided to use
the USRP as one the of my implementation platforms. I used the
tutorials by D. Shen as a reference. There are, however , some
specific problems I need help with :


I need to store the received signal A/D samples (before all the
post-demod processing stuff takes place) in memory and to
correlate them with similar samples stored somewhere else in memory.

do you want the raw A/D samples? this would have to be a hardware
solution (pinout to the FPGA). However, If you just want the samples
that are coming across the USB (these samples have been decimated and
filtered) , then you can do a simple write to a file

fg = gr.flow_graph()

src = usrp.souce()
snk = gr.file_sink_c(…)

fg.connect(src,snk)

then you can do what you want with the data offline

Hi Kshitij,
I am considering the channel estimation by pilot. So, it may very like
what
you want. Could you give more detail what is your target?
Is there any one have experience on the real time channel estimation
(with
pilot) on GNU Radio?

2007/7/18, David S. [email protected]:

Thanks David,

         I was looking to store the decimated samples(Would be quite 

a
problem storing raw samples at 64 MHz :slight_smile: coming in through the USB.)
This
is definitely helpful.
@Zhifeng , I was working on some cooperative communications protocol
(honestly, just a fancy multi-hop prototype) where the samples received
from
the transmitter and the relay could be utilized towards providing a
better
SNR at the receiver , hopefully, by forming a virtual antenna array (of
sorts).

Regards,
Kshitij

Kshitij Kumar S. wrote:

processing is done, I can move on to the demod part. The sample
storage/correlation part is where I am
getting stuck time and again. Is there some specific block I am going to
need or do I need to write my own signal processing block from scratch?
I tried looking in the mailing list archives but couldn’t
find anything similar. Kindly point to any suitable reference on this
topic
I may have overlooked.

You will probably want to write your own block.
If you have to correlate over a small range sjust use a direct
implementation.
If you want to corrlate over a large range you probably want to use FFT
for that

I have been working with the gr-radar code a while back.
This uses offline samples (stored to disk) and processes it in a
standalone application.
(Not using gnuradio flowgraph)

You can find some correlation examples in the gr-radar code in svn.
I don’t remember if the standard code used FFt or not.

I have much more complicated experimental code (using special case
overlap-add FFTS) If you need that.

(I would advice to first understand the standard code)

I also have been doing correlation realtime using standard blocks and
gnuradio flowgraphs.

Below will give you an idea.

    src0=some complex source
    src1=some second complex source to correlate with
    dst_float=gr.file_sink(gr_size_of_float*fft_size,filename)
    dst_complex=gr.file_sink(gr_size_of_complex*fft_size,filename)

    s2p0 = gr.serial_to_parallel(gr.sizeof_gr_complex, fft_size) 

#make the data blockbased
fft0 = gr.fft_vcc(fft_size, True, True)
#take the fft of a block of data to go to freq domain
s2p1 = gr.serial_to_parallel(gr.sizeof_gr_complex, fft_size)
#make the data block_based
fft1 = gr.fft_vcc(fft_size, True, True) #go
to freq domain
conj1=gr.conjugate_cc() #take the conjugate to do
correlation
#if you leave out this step you will do concolution

    mult=gr.multiply_cc()               #correlate in the freq 

domain
ifft=gr.fft_vcc(fft_size, False, True) #convert back
to the time domain using inverse FFT
c2mag = gr.complex_to_mag(fft_size) #take the
magnitude of the complex values

    fg.connect(src0,s2p,fft0)             #make the data blockbased
    fg.connect(src1,s2p,fft1)             #make the data blockbased
    fg.connect(fft1,conj1) 

#take the conjugate to do correlation
#if you leave out this step you will do concolution

    fg.connect(fft0,(mult,0))             #correlate in the freq 

domain
fg.connect(conj1,(mult,1)) #correlate in the freq
domain
fg.connect(mult,ifft) #convert back to the time
domain using inverse FFT
fg.connect(mult,c2mag) #take the magnitude of the
complex values

    fg.connect(mult,dst_complex) #every output element is an 

block_array (size=fft_size) of complex correlation values
fg.connect(c2mag,dst_float) #every output element is an
block_array (size=fft_size) of float correlation magnitude values

I hope this helps,
Martin