Buffer Question for Streaming with USRP

Hi all,

I’m using a C++ program that modulates a signal that I feed to GRC via
an mkfifo (named pipe) file. The problem is that I get underruns from
the USRP.

There is a function in the C++ program that converts from double to
float and then dumps it to stdout which I then feed to an mkfifo file in
the command line. With the buffer size of 32 bytes in the stdout line in
C++ I get consistent underruns. With the buffer size to 4096 bytes, I
get an initial underrun and then none for about 1-2 minutes and then I
start getting them more consistently, and about 500msec of no signal for
each underrun. With the buffer size set to the size of a 2 second packet
(at 500 kHz) I get an underrun every 4 seconds with a 1-2 seconds of no
signal randomly in between my modulated signal.

Does anyone have any ideas if I need to use a certain buffer size? I
tried this on my netbook with an intel atom and also laptop with a duo
core and got the same thing.

When I run the C++ program and output to a regular file, and read in
with the GRC script at the same time, I don’t get any underruns at all,
but of course this isn’t real time.

My other idea is to find a way to do the conversion from double to float
in GRC with a custom block. I also wonder if going from stdout to a pipe
file and then reading the pipe file from GRC is also a problem.

Thanks-Tom

On Sun, Apr 03, 2011 at 07:12:58PM -0700, Tom H. wrote:

consistently, and about 500msec of no signal for each underrun. With the
this isn’t real time.

My other idea is to find a way to do the conversion from double to float in GRC
with a custom block. I also wonder if going from stdout to a pipe file and
then reading the pipe file from GRC is also a problem.

Hi Tom,

I wonder… how do you get double-values in the first place? Literally
no GNU Radio block in the main tree uses double. Perhaps it’s the Monday
morning, but the only way I can think of to get doubles into your flow
graph
without writing lots of code yourself is by reading them from a file,
which you could convert to float beforehand.

Just checking here… are you sure you have double? After your custom
converter,
is the data valid?
Your underruns might also be caused by something else. Do you have a
hardware clock on both ends of the flow graph (e.g. a USRP and a sound
card)?

However, writing simple blocks like a double->float converter is
super-easy. I reckon it would take you as long as it took to set up the
custom converter and the pipes. Use create-gnuradio-out-of-tree-project
to get started and then add a sync block.

MB


Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Hi Martin,

Thanks, for sure the C++ program is giving output in doubles. I was told
by Josh that you can use the gr file block with vector length 8 to read
it in as a double with GRC, but none of the other blocks use double
which is why I would need a double to float converter.

The C++ program I’m working with has a function to convert from double
to float, but I don’t think it handles the buffer correctly. I didn’t
write it.

For sure the output looks good when I use the C++ program and the
converter from double to float and read it in with GRC as float. I
checked with an oscilloscope, the problem is when I get the underruns.
I’m not exactly sure how to handle the clock, I’m using a camera, then
the C++ modulator, then the C++ converter (double to float), and that
gets fed into GRC. In GRC I have the gr file block, a resampler (to
match the sampling frequency of the signal to the USRP), a float to
complex block, then the USRP sink block.

At this point even a simple custom block from double to float in GRC is
hard for me to make myself due to my lack of programming experience.
Thanks for the advice

— On Mon, 4/4/11, Martin B. [email protected] wrote:

From: Martin B. [email protected]
Subject: Re: [Discuss-gnuradio] Buffer Question for Streaming with USRP
To: [email protected]
Date: Monday, April 4, 2011, 8:10 AM

On Sun, Apr 03, 2011 at 07:12:58PM -0700, Tom H. wrote:

consistently, and about 500msec of no signal for each underrun. With the
this isn’t real time.

My other idea is to find a way to do the conversion from double to float in GRC
with a custom block. I also wonder if going from stdout to a pipe file and
then reading the pipe file from GRC is also a problem.

Hi Tom,

I wonder… how do you get double-values in the first place? Literally
no GNU Radio block in the main tree uses double. Perhaps it’s the Monday
morning, but the only way I can think of to get doubles into your flow
graph
without writing lots of code yourself is by reading them from a file,
which you could convert to float beforehand.

Just checking here… are you sure you have double? After your custom
converter,
is the data valid?
Your underruns might also be caused by something else. Do you have a
hardware clock on both ends of the flow graph (e.g. a USRP and a sound
card)?

However, writing simple blocks like a double->float converter is
super-easy. I reckon it would take you as long as it took to set up the
custom converter and the pipes. Use create-gnuradio-out-of-tree-project
to get started and then add a sync block.

MB


Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstrae 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Wrttemberg and
National Laboratory of the Helmholtz Association

-----Inline Attachment Follows-----