[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] terminating benckmark_rx.py after TIMEOUT

From: Nathan West
Subject: Re: [Discuss-gnuradio] terminating benckmark_rx.py after TIMEOUT
Date: Thu, 28 Mar 2013 22:57:22 -0500

On Thu, Mar 28, 2013 at 8:45 PM, sumitstop
<address@hidden> wrote:
> How can I terminate benchmark_rx.py after a certain number of TIMEOUTS.
> I have observed two things
> 1. When I dump Tx data using --to-file option and then demod them using
> benchmark_rx , benchmark_rx terminates after demod. No waiting !

I haven't used benchmark with file io yet, but it's probably just
reading from the file until the end of the file then quitting; that is
unless you use the repeat=True option.

> 2. When I use benchmark_rx for OTA reception with USRP, and once the Tx
> stops sending data, it keeps waiting for data and give TIMEOUTS but never
> stops.
> My application wants to get it terminated automatically after a certain
> number of timeouts. I tried digging a lot about where this TIMEOUT is coming
> from but no help so far.
> Any pointers.
I've never seen benchmark give a timeout, when I use it the receive
chain just hangs waiting for packets. You can change this by doing
some carrier sensing. There's a function in receive_path called
carrier_sensed(). It returns true or false if the received power is
above some threshold. You can change the threshold, or even access the
probe yourself. it's defined (in receive_path.py) as
 79         # Carrier Sensing Blocks
 80         alpha = 0.001
 81         thresh = 30   # in dB, will have to adjust
 82         self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)

I'm able to make benchmark_rx stop on its own by going into a loop
after the flowgraph starts. When the carrier is sensed exit the loop
and go in to another one. In the second loop exiit when the carrier is
not sensed anymore. Note that for discontinuous option you'd have to
do something a little bit tricker. Kind of a very simple state
machine. I used this the probe.level might be useful for determining
where to set the threshold (30 won't work) I usually fare well around
-60 in my lab:

    tb.start()        # start flow graph
    carrier_sense = tb.rxpath.carrier_sensed
    while not carrier_sense():
        print tb.rxpath.probe.level()
    while carrier_sense():
        print carrier_sense()
    tb.stop()         # wait for it to finish

You might also want to sleep less alot than .1 so you don't miss the
first packet(s).

Is that along the lines of what you were looking for?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]