USRP underrun

I see a single USRP underrun (uU) about four out of five times that my
application starts. My transmit work() routine couldn’t be simpler: a
for-loop that moves data from a local buffer to the output buffer. So,
I don’t think I can scale it back or anything.

Is there anything I can do to avoid these uU at startup? Does anyone
know what might be causing them? Unfortunately my application can’t
tolerate any under/overruns.

Thanks,
-Lee

On Tue, Aug 01, 2006 at 08:26:58PM -0400, Lee P. wrote:

-Lee
Have you tried enabling real time scheduling?
You’ll need to be running as root or have CAP_SYS_NICE for it to work.

See gnuradio-examples/python/gmsk2/tunnel.py

# Attempt to enable realtime scheduling
r = gr.enable_realtime_scheduling()
if r == gr.RT_OK:
    realtime = True
else:
    realtime = False
    print "Note: failed to enable realtime scheduling"

Eric

Interesting about realtime scheduling?
What does it do and what can we benifit from it?

2006/8/2, Eric B. [email protected]:

On Tue, 2006-08-01 at 17:35 -0700, Eric B. wrote:

Thanks,
realtime = True
else:
realtime = False
print “Note: failed to enable realtime scheduling”

Eric

Thanks, Eric.

I put that code in my script, and ran as root. Unfortunately, I’m still
seeing uU. I also messed around with setting block_size and nblocks,
but I don’t really know what I’m doing there – just changing numbers to
see if it works better :slight_smile:

When I put the above code into my script, I get the following error upon
exit:

Exception exceptions.ReferenceError: ‘weakly-referenced object no longer
exists’ in <bound method db_flexrf_2400_rx.del of
<gnuradio.db_flexrf.db_flexrf_2400_rx object at 0x40dcbccc>> ignored

Did I incorporate the code properly?

I also tried running my app with “sudo nice -20 make check”, but that
didn’t fix my problem either.

It is strange that I almost always get one underrun, and it is usually
at the very beginning of my data.

Could my rx block be affecting my tx block? Again, I’m just
transferring the data in the input buffer into a local buffer.

  • Lee

On Wed, Aug 02, 2006 at 10:40:38AM +0800, hanwen wrote:

Interesting about realtime scheduling?
What does it do and what can we benifit from it?

$ man sched_setscheduler

And look for the part about SCHED_FIFO.

When enabled it ensures that our process runs before most others.

Note that it’s possible to “blow your foot off” with SCHED_FIFO.
If you make a coding mistake and the code enters an infinite tight
loop, it’s really hard to kill the process.

Eric