How to delete and create a new top_block?

Hi,

After I stop a top_block, is it possible to create a new top_block and
start it without exiting my python application?

My experience is that it doesn’t work very well. I get the following
error when I instantiate a new top_block and start it.
“UHD source block got error code 0x1
gr_block_executor: source <gr_block gr uhd usrp source (9)> produced no
output. We’re marking it DONE.”

I’ve attached a small example that triggers the error.

Best regards
Patrik

On 04/29/2011 06:58 AM, Patrik E. wrote:

Hi,

After I stop a top_block, is it possible to create a new top_block and start it
without exiting my python application?

My experience is that it doesn’t work very well. I get the following error when
I instantiate a new top_block and start it.
“UHD source block got error code 0x1
gr_block_executor: source <gr_block gr uhd usrp source (9)> produced no output.
We’re marking it DONE.”

If it helps, that error is from a timeout where the uhd recv() function
timed out getting samples causing the work() function to return 0. Now,
the tb.stop() called the source block’s stop() function to tell the USRP
to stop streaming.

So to me that sounds like the scheduler called the work() routine after
the block was stopped (which is what seems to have happened). This seems
incorrect… Perhaps its because tb.stop() stops the streaming, but
tb.wait() can continue to call work()?

-Josh

So to me that sounds like the scheduler called the work() routine after
the block was stopped (which is what seems to have happened). This seems
incorrect… Perhaps its because tb.stop() stops the streaming, but
tb.wait() can continue to call work()?

Can you try this diff, I think it solves the problem if my hunch above
is correct: http://pastebin.com/zMCP6LHh

-Josh

Hi Josh,

Can you try this diff, I think it solves the problem if my
hunch above is correct: http://pastebin.com/zMCP6LHh

Thanks four your reply!

I’ve tried this patch and I don’t get the error anymore, but my
application still doesn’t work though. It seems that the UHD-source
doesn’t produce any samples after that I’ve stopped and created a new
top_block.

I’ve done three tests where I use your patch and I also added a printf
when I’m in that state.

  1. UHD source (2 USRP2) -> HEAD(1024 samples) -> FILE_SINK
    The USRP2s are synchronized. The output files contains the number of
    samples I expected. Everything is fine.

  2. UHD source (2 USRP2) -> FILE_SINK
    The USRP2s are synchronized. After I stopped and created a new top_block
    2-3 times I see my printf from the ERROR_CODE_TIMEOUT state and the
    output files are empty after that. I expected that all output files
    should contain at least some samples.

  3. UHD source (2 USRP2) -> FILE_SINK
    The USRP2s are NOT synchronized. All my output files contains some
    samples as I expected. Everything is fine.

My conclusion from these small tests is that the ERROR_CODE_TIMEOUT
occurs when the USRP2s are synchronized. I don’t see the reason why it
works with the HEAD block and not without it. Do you have any clue? I
attach my test file for testcase 2.

Br
Patrik

My conclusion from these small tests is that the
ERROR_CODE_TIMEOUT occurs when the USRP2s are synchronized. I
don’t see the reason why it works with the HEAD block and not
without it. Do you have any clue? I attach my test file for
testcase 2.

We have done some more tests and found out that it is the call to
set_time_unknown_pps() from the GNU Radio that triggers this behavior.
If we do not sync the time between the USRP2s there is no problem to
delete and create a new top_block.

Our solution to this problem is to increase the timeout for the
uhd_source block as it takes at least 1 second to synch the time over
the USRPs, see this diff:
http://pastebin.com/4Lfr6ft2

Can anyone see any problems with increasing the timeout?

BR,
Patrik

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs