Question about stream tag

Hello,
I want to use my USRP2 to implement a TDMA system, and I want to
send 5 seconds, receive 5 seconds, and do the recycle. I used the stream
tag demo in gr-uhd/taguhd. The question is:

  1. As sean have said in
    Re: [Discuss-gnuradio] How to implement a TDMA system
    we should use “tx_time”, “tx_sob” (start-of-burst), and “tx_eob”
    (end-of-burst) to tag the data flow, but yend B in
    How to align Tx/Rx timestamps - GNU Radio - Ruby-Forum said the data not enclosed by
    sob-eob tag pair was dropped. Is this problem really exist? And any
    solution?
  2. Is there any way to switch the Tx/Rx? And how to tell the USRP to
    receive for a desired time slot such as 5 seconds then stop? The only
    parameter I can see in gr_uhd_usrp_source is ‘rx_time’(tells when to
    start receive), I do not know how to stop the streaming after 5 seconds.
    Thank you for your help. Any suggestion is appreciated.

On Thu, May 24, 2012 at 10:27 AM, Pan, Luyuan [email protected]
wrote:

solution?
2. Is there any way to switch the Tx/Rx? And how to tell the USRP to receive
for a desired time slot such as 5 seconds then stop? The only parameter I
can see in gr_uhd_usrp_source is ‘rx_time’(tells when to start receive), I
do not know how to stop the streaming after 5 seconds.
Thank you for your help. Any suggestion is appreciated.

Best regards,
Pan, Luyuan

It sounds like you need to add a rate control to your MAC layer.
Obviously, when you aren’t transmitting, you don’t want to be
generating any samples. You’ll need to buffer them. This is going to
take some work outside of GNU Radio to create an app that has a thread
to control the samples and pass them to a message source block in GNU
Radio.

I’m not sure there’s a good example of this, and we don’t really have
a ‘best practices’ for this right now.

Tom

On 2012/5/24 22:34, Tom R. wrote:

sob-eob tag pair was dropped. Is this problem really exist? And any
Obviously, when you aren’t transmitting, you don’t want to be
generating any samples. You’ll need to buffer them. This is going to
take some work outside of GNU Radio to create an app that has a thread
to control the samples and pass them to a message source block in GNU
Radio.

I’m not sure there’s a good example of this, and we don’t really have
a ‘best practices’ for this right now.

Tom
In Tx side, This may be the ‘best’ solution at present. But in Rx side,
I just want the USRP to sample for 5 seconds, then stop. Is there any
way to reach this goal? Should I use the “stream_cmd” in uhd to set the
receive mode in USRP or any better alternative? Can the modes (“Start
continuous”, “Stop continuous”,“Num samps and done”…) achieve my goal?
Any suggestion is appreciated. Thank you.

Best regards,
Pan, Luyuan

If you know your sample rate, you can calculate how many samples will
occur over 5 seconds and pass that as “num samps and done” to a stream
command. (I’ve never used stream command interface myself, but I think
this will work).

In Tx side, This may be the ‘best’ solution at present. But in Rx side,
I just want the USRP to sample for 5 seconds, then stop. Is there any
way to reach this goal? Should I use the “stream_cmd” in uhd to set the
receive mode in USRP or any better alternative? Can the modes (“Start
continuous”, “Stop continuous”,“Num samps and done”…) achieve my goal?
Any suggestion is appreciated. Thank you.

So, you have access to start(), stop() and set_start_time() on the
source object; The issue is that you cant really stop the block while
the flow graph is running or the source block will timeout, return 0,
and quit. So, here is a potential fix to make the work function block
when the streaming is stopped:

http://gnuradio.org/cgit/jblum.git/commit/?h=wip_uhd_stopper&id=c78d307ecd5dac4e28190e5aa9b8377538f65ffa

heres my git repo:
git://gnuradio.org/jblum.git

-josh