discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: re[Discuss-gnuradio] configuring with usrp2 src present


From: Andy_Long
Subject: Re: re[Discuss-gnuradio] configuring with usrp2 src present
Date: Wed, 14 Apr 2010 13:54:09 -0700 (PDT)

Hello, Johnathan,

Thank you for your reply. 

What I want to do is collect the samples from the usrp2 and use
gr.probe_avg_mag_sqrd_cf to check that if the one channel is free or not. If
it is free, wait 3 second and repeat checking the samples again. I think it
just the simple example of spectrum sensing. 


self.u = usrp2.source_32fc(options.interface, options.mac_addr)
nsamples = 10
self.head = gr.head(gr.sizeof_float, int(nsamples))
self.c2mag = gr.probe_avg_mag_sqrd_cf(1, 0.001)
self.sink = gr.null_sink(gr.sizeof_float)

self.connect (self.u, self.c2mag, self.head,self.sink)




def main():
    t = my_top_block()
                
    while not t.c2mag.unmuted():
        t.run()
        print t.c2mag.unmuted(): #show exceed threshold or not
        print t.c2mag.level()        #show power
        time.sleep(3)
        

if __name__ == '__main__':
    try:
        main()
                
    except KeyboardInterrupt:
        pass



But if the flow graph lifetime ended with return of "head" module, how can I
get the print output more than twice? After that, the error message arised.
It confused me a lot since I can not find many information about error in
maillist

usrp2: channel 0 not receiving 
usrp2::rx_samples() failed



Thank you.
regards,
Andy



Johnathan Corgan-2 wrote:
> 
> On Wed, Apr 14, 2010 at 12:27, Andy_Long <address@hidden> wrote:
> 
>> I have faced the same problem. I try to received the limited samples from
>> USRP2 by using "head"block. It should return a -1 and the flow graph will
>> stop, am I right?
> 
> The flowgraph will not only stop, but will end its lifetime.  Once
> run() has returned, the flowgraph is no longer usable, or as we like
> to say, further operations on it are "undefined."
> 
> In general, starting and stopping an individual flowgraph should occur
> at the same level of processing as application startup and shutdown.
> Anything else is usually a sign of incorrect design (though not
> always.)  The run() method on a top block is really just a convenient
> way of telling GNU Radio your application has nothing else to do until
> the flowgraph exits.
> 
> Can you describe what you are trying to do?
> 
> Johnathan
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
> 

-- 
View this message in context: 
http://old.nabble.com/reconfiguring-with-usrp2-src-present-tp27615622p28248114.html
Sent from the GnuRadio mailing list archive at Nabble.com.





reply via email to

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