Hi Firas, But it shows the same error as before. I am doing tests like that:
def main(): t = my_top_block() t.start() t.wait() t.stop() print t.c2mag.level() #print power time.sleep(3) m = my_top_block() m.start() m.wait() m.stop() print m.c2mag.level() #print power time.sleep(3) n = my_top_block() n.start() n.wait() n.stop() print n.c2mag.level() #print power time.sleep(3) r = my_top_block() r.start() r.wait() r.stop() print r.c2mag.level() #print power time.sleep(3) Or I am doing the while loop like that def main(): while 1: t = my_top_block() t.start() t.wait() t.stop() print t.c2mag.level() #print power time.sleep(3) error message >>> StdErr: usrp2: failed to enable realtime scheduling 1.43518970096e-07 StdErr: S1.41236599021e-07 StdErr: usrp2: channel 0 not receiving usrp2::rx_samples() failed 0.0 StdErr: usrp2: channel 0 not receiving usrp2::rx_samples() failed 0.0 The thing is that the first output is always fine to print the received power. After that it will print the power again as expected, however with error message "StdErr: S". It sometimes can print the power for third time, then usrp2 collapses with "StdErr: usrp2: channel 0 not receiving usrp2::rx_samples() failed". However,most of time usrp2 collapses in the second loop rather than third loop. If it is the problem of setting the loop of flow graph, I think I can't get the second output or even third output. Am I right? For example, if I changed the usrp2 source with constant sine wave, the program runs fine. If it is the problem of usrp2, I guess I will face the same problem even I am writing my own block simliary like message sink or gr-bin_statistics sink. Another question is that can I change the tune delay time in gr-bin_statistics block to do the same thing such as time.sleep(3)? I just throw all the samples in next 3 seconds thank you best regards, Andy Firas A. wrote: > > Hi, > > Replace all xxx.run with xxx.start() and put xxx.wait() followed by > xxx.stop() to stop the flowgraph > > Best Regards, > > Firas > > > > > ----- Original Message ---- >> From: Andy_Long <luckshiw...@yahoo.com.cn> >> To: Discuss-gnuradio@gnu.org >> Sent: Thu, April 15, 2010 10:50:39 AM >> Subject: Re: re[Discuss-gnuradio] configuring with usrp2 src present >> >> > Hello,Johnathan > > Did I have some misunderstanding about it? I still >> think the problem is from > USRP2 rather than flow graph. > For example, I >> made some tests to change the while loop such as: > > def main(): > >> > t = my_top_block() > t.run() > >> print t.c2mag.unmuted(): #show exceed threshold or not > >> time.sleep(3) > > m = my_top_block() > m.run() >> > print m.c2mag.unmuted(): #show exceed threshold or not >> > time.sleep(3) > > n = my_top_block() >> > n.run() > print n.c2mag.unmuted(): #show >> exceed threshold or not > time.sleep(3) > > > As same >> condition as before, after two correct outputs, the third one start > to show >> the error. > > Thank you. > regards, > Andy > > > > Johnathan >> Corgan-2 wrote: >> >> On Wed, Apr 14, 2010 at 12:27, Andy_Long < >> ymailto="mailto:luckshiw...@yahoo.com.cn" >> href="mailto:luckshiw...@yahoo.com.cn">luckshiw...@yahoo.com.cn> >> 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 >> >> href="mailto:Discuss-gnuradio@gnu.org">Discuss-gnuradio@gnu.org >> >> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio >> >> >> > > -- > View this message in context: >> http://old.nabble.com/reconfiguring-with-usrp2-src-present-tp27615622p28252256.html > Sent >> from the GnuRadio mailing list archive at >> href="http://Nabble.com">Nabble.com. > > > > _______________________________________________ > Discuss-gnuradio >> mailing list > >> href="mailto:Discuss-gnuradio@gnu.org">Discuss-gnuradio@gnu.org > >> href="http://lists.gnu.org/mailman/listinfo/discuss-gnuradio" >> target=_blank >> >http://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > http://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > -- View this message in context: http://old.nabble.com/reconfiguring-with-usrp2-src-present-tp27615622p28264537.html Sent from the GnuRadio mailing list archive at Nabble.com. _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio