Saving transmitted data from USRP2 to a file

Hello All,

I am using the Python example program “usrp2_siggen_gui.py” and wanted
to
save the transmitted data to a file. I added the following lines:

    self.u = usrp2.source_32fc(self.tb.interface_name(),

self.tb.mac_addr())
self._sink = gr.file_sink(gr.sizeof_gr_complex, ‘test.txt’)
self.tb.connect(self.u, self._sink)

The addition of the above lines cause what appears to be random data
(noise?) transmitted to my spectrum analyzer.

What is the correct way to record what is being transmitted? And does
anybody know why there isn’t a Python program that transmits a recorded
file? I can record to a file and view it nicely in Matlab. I can
transmit a
signal and view it on my spectrum analyzer nicely. But I cannot seem to
record and play back a file.

Thanks for answering my questions!

Hafeez


View this message in context:
http://www.nabble.com/Saving-transmitted-data-from-USRP2-to-a-file-tp23972786p23972786.html
Sent from the GnuRadio mailing list archive at Nabble.com.

hjaffer wrote:

Hello All,

I am using the Python example program “usrp2_siggen_gui.py” and wanted
to
save the transmitted data to a file. I added the following lines:

    self.u = usrp2.source_32fc(self.tb.interface_name(),

self.tb.mac_addr())
self._sink = gr.file_sink(gr.sizeof_gr_complex, ‘test.txt’)
self.tb.connect(self.u, self._sink)

The addition of the above lines cause what appears to be random data
(noise?) transmitted to my spectrum analyzer.

What is the correct way to record what is being transmitted? And does
anybody know why there isn’t a Python program that transmits a recorded
file? I can record to a file and view it nicely in Matlab. I can
transmit a
signal and view it on my spectrum analyzer nicely. But I cannot seem to
record and play back a file.

Thanks for answering my questions!

this is the code i am using to write:

nsamples = 20000 #number of samples to write
filename = “rxsamples.dat” #file name

self.dst_file = gr.file_sink(gr.sizeof_gr_complex, filename)
self.head = gr.head(gr.sizeof_gr_complex, nsamples)
self.connect(self.source_usrp, self.head, self.dst_file)

and to read:

self.src_file = gr.file_source(gr.sizeof_gr_complex, filename, True)
#True for repeat data at end of file
self.connect(self.src_file, self.sink_usrp)

Thanks for responding but I couldn’t get your code to work. I get the
following errors when I incorporate your code into various files:

AttributeError: ‘app_gui’ object has no attribute ‘connect’
AttributeError: ‘gr_top_block_sptr’ object has no attribute
‘source_usrp’

I have a USRP2 by the way. Not sure if source_usrp will only work for
the
first version.

Hafeez

Amit K.-6 wrote:

    self._sink = gr.file_sink(gr.sizeof_gr_complex, 'test.txt')

record and play back a file.
self.dst_file = gr.file_sink(gr.sizeof_gr_complex, filename)


Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


View this message in context:
http://www.nabble.com/Saving-transmitted-data-from-USRP2-to-a-file-tp23972786p23990388.html
Sent from the GnuRadio mailing list archive at Nabble.com.

hjaffer wrote:

Thanks for responding but I couldn’t get your code to work. I get the
following errors when I incorporate your code into various files:

AttributeError: ‘app_gui’ object has no attribute ‘connect’
AttributeError: ‘gr_top_block_sptr’ object has no attribute
‘source_usrp’

I have a USRP2 by the way. Not sure if source_usrp will only work for
the
first version.

Hafeez

i am using usrp1, not sure if it is different for usrp2