Re: [Discuss-gnuradio] Strange output of "0" at the terminal
From:
Andrew Davis
Subject:
Re: [Discuss-gnuradio] Strange output of "0" at the terminal
Date:
Thu, 23 Feb 2012 10:33:15 -0500
As I said, your system is not processing the samples fast enough and a buffer overflows and samples are lost. You say it happends durring that loop, that might use enough CPU time to cause these problems. Your options are to get a faster system, sample at a lower rate or find a way to make your code faster.
On Thursday, February 23, 2012, Wu Ting <address@hidden> wrote: > Hi! Thank you for your response. I've kept working on this problem for two
> days, but still cannot find a way to solve it. > > I simplified the program and have determined that the 'O' is produced is > this while loop: > > while msgCount<10000: > msg = tb.queue.delete_head()
> payload = msg.to_string() > f.write(payload) > msgCount += 1 > > I also tried to make it sleep for a short time after each operation: > > while msgCount<10000: > msg = tb.queue.delete_head()
> sleep(0.00001) > payload = msg.to_string() > sleep(0.00001) > f.write(payload) > sleep(0.00001) > msgCount += 1 > > It still has the problem. I'm using a USRP source with 4M smapling rate, and
> connect it with message_sink. > > self.source = uhd.usrp_source(device_addr="", > stream_args=uhd.stream_args('sc16', 'sc16', args="scalar=1024")) > self.source.set_samp_rate(4e6)
> self.queue = gr.msg_queue() > self.sink = gr.message_sink(gr.sizeof_short*2, self.queue, False) > self.connect(self.source, self.sink) > > This is really a serious problem for our application because we want to
> continuously record some data. Does anyone has any idea how to deal with > this problem, or at least catch this error when it happens? Any suggestions > will be greatly appreciated. > > Wu
> > -----Original Message----- > From: Andrew Davis [mailto:address@hidden] > Sent: 2012年2月23日 0:15 > To: Wu Ting; address@hidden
> Subject: Re: [Discuss-gnuradio] Strange output of "0" at the terminal > > "O" means there has been an overflow, some part of your system is not fast > enough to keep up with the incoming data, probably your hard drive, or you
> may not have a fast enough CPU to process as the sample rate you have > chosen. > > 2012/2/22 Wu Ting <address@hidden>:
>> The output is “O” (Oh) not “0” (zero). >> >> >> >> I made more tests and feel the problem may be from use of write() to >> write data into files. Anyone had similar problem?
>> >> >> >> Wu >> >> >> >> From: >> discuss-gnuradio-bounces+wu.ting=address@hidden
>> [mailto:discuss-gnuradio-bounces+wu.ting=comf5.comm.eng.osaka-u.ac.jp@ >> gnu.org] >> On Behalf Of Wu Ting
>> Sent: 2012年2月22日 14:48 >> To: address@hidden >> Subject: [Discuss-gnuradio] Strange output of "0" at the terminal >>
>> >> >> Hi all, >> >> >> >> I’m now using message_sink and msg_queue to receive data from USRP. I >> do some calculation for all the data in the msg_queue one by one and
>> write some of them into a file. Everything seems to be working >> smoothly. But once in a while, a “0” is printed in the terminal. >> (There is no code to print “0” in my program.) I checked the data, and
>> found that every time a “0” is printed, some data are lost, and the >> length of lost data seems to be of hundreds of messages. >> >> >> >> There is no other error information, so I’m really confused by this
> problem. >> Does anyone has a clue of what happened and how should I deal with it? >> >> >> >> Thanks, >> >> >> >> Wu >> >>
>> _______________________________________________ >> Discuss-gnuradio mailing list >> address@hidden >> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>> > >