Error on "Assertion `imu >= 0' failed" when using gr.udp_source/sink

Hello,

I modified “benchmark_tx.py and benchmark_rx.py” by replacing the
usrp_source/sink with gr.udp_source/sink and gr.file_source/sink, to see
if the generated IQ data from tx side can be correctly captured and
processed at rx side via UDP socket or trace file instead of USRP. If it
does, then I can analyze the signal off-line or transmit the captured
data to others via socket.

The modified program with gr.file_source/sink works correctly and the
results are exactly the same when using usrp_source/sink.

But when using udp_source/sink, the tx side can send packets to udp_sink
well, but the rx side program is aborted with error
“python: gri_mmse_fir_interpolator.cc:71: float
gri_mmse_fir_interpolator::interpolate(const float*, float) const:
Assertion `imu >= 0’ failed.”

My python codes are configured like the following:
rx side:


self.u = gr.udp_source(gr.sizeof_gr_complex, options.host, options.port,
options.packet_size, not options.no_eof, not options.no_wait)
rx_path = receive_path.receive_path(demod_class, rx_callback, options)
self.connect(self.u, rx_path)

tx side:

self.u = gr.udp_sink(gr.sizeof_gr_complex, options.host, options.port,
options.packet_size, options.no_eof);
tx_path = transmit_path.transmit_path(modulator_class, options)
self.connect(tx_path, self.u)

Then I added a printf in “gri_mmse_fir_interpolator.cc”, and found imu
is −2147483648, .i.e, -0x80000000;

But in normal situation when using usrp_source/sink or
file_source/sink, it is between 63–67.

I searched the mailing list and knew that the imu value is used to tell
the interpolating filter where in the filter to takethe output from,
but got few clues to solve this problem.

I wonder if udp_source/sink modifies the complex data stream it
transmits then the gnuradio can’t process it correctly?
Or is there any suggestion to solve it?

Thanks in advance!

Zhen

I just solved this problem!

The reason is that in gnuradio-examples, UDP default payload size is set
to 1471. In gr_udp_source.cc, all received data will be round down to a
multiple of d_itemsize. Since sizeof_gr_complex is 8, so only 1464 Bytes
are received correctly, while the left 7 byte are abandoned. This will
in turn disturb the position of the following data stream, and also
affect the mmse_fir_interpolator and make imu negative.

Actually, the default UDP payload size in gr_udp_source.h is set to
1472, but in
examples, it is set to 1471. I am not sure if this is a bug. A simple
way to bypass this problem is to set MTU
size as a multiple of itemsize, such as 1464 or 1472, then everything
works as expected.


发件人: Zhen [email protected]
收件人: “[email protected][email protected]
发送日期: 2011年6月28日, 星期二, 上午 2:34
主题: [Discuss-gnuradio] Error on “Assertion `imu >= 0’ failed” when using
gr.udp_source/sink

Hello,

I modified “benchmark_tx.py and benchmark_rx.py” by replacing the
usrp_source/sink with gr.udp_source/sink and gr.file_source/sink, to see
if the generated IQ data from tx side can be correctly captured and
processed at rx side via UDP socket or trace file instead of USRP. If it
does, then I can analyze the signal off-line or transmit the captured
data to others via socket.

The modified program with gr.file_source/sink works correctly and the
results are exactly the same when using usrp_source/sink.

But when using
udp_source/sink, the tx side can send packets to udp_sink well, but the
rx side program is aborted with error
“python: gri_mmse_fir_interpolator.cc:71: float
gri_mmse_fir_interpolator::interpolate(const float*, float) const:
Assertion `imu >= 0’ failed.”

My python codes are configured like the following:
rx side:


self.u = gr.udp_source(gr.sizeof_gr_complex, options.host, options.port,
options.packet_size, not options.no_eof, not options.no_wait)
rx_path = receive_path.receive_path(demod_class, rx_callback, options)
self.connect(self.u, rx_path)

tx side:

self.u = gr.udp_sink(gr.sizeof_gr_complex, options.host, options.port,
options.packet_size,
options.no_eof);
tx_path = transmit_path.transmit_path(modulator_class, options)
self.connect(tx_path, self.u)

Then I added a printf in “gri_mmse_fir_interpolator.cc”, and found imu
is −2147483648, .i.e, -0x80000000;

But in normal situation when using usrp_source/sink or
file_source/sink, it is between 63–67.

I searched the mailing list and knew that the imu value is used to tell
the interpolating filter where in the filter to takethe output from,
but got few clues to solve this problem.

I wonder if udp_source/sink modifies the complex data stream it
transmits then the gnuradio can’t process it correctly?
Or is there any suggestion to solve it?

Thanks in advance!

Zhen

On Wed, Jun 29, 2011 at 07:44, Zhen [email protected] wrote:

simple way to bypass this problem is to set MTU size as a multiple of
itemsize, such as 1464 or 1472, then everything works as expected.

Very nice catch. I have yet looked at the code to verify this, but your
description sounds plausible. Thanks!

Johnathan