discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Shutting down a usrp_sink_s


From: Mattias Kjellsson
Subject: [Discuss-gnuradio] Shutting down a usrp_sink_s
Date: Mon, 16 Mar 2009 15:43:39 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Hi list,

I have a question regarding the shutdown procedures of c++- flow- graphs (using trunk r10527, ubuntu 8.10). As far as I have understood a flow- graph will continue until one of the blocks in it either returns -1, or ctrl+c is pressed.

However, if I connect a gr_file_source(sizeof(short), "./data_to_usrp.dat", true) with a usrp_sink_s in a gr_top_block and do top_block->start() the flow- graph exits as if the repeat- flag in gr_file_source wasn't set to true.

If I on the other hand use (the same configuration) top_block->start() the flow- graph continues until ctrl+c is pressed, but the destructor of top-block isn't run, which I verified with a printf in it.
t't
If I install a signal handler which catches ctrl+c and sets a flag, and then use (still the same configuration) uses something like:

top_block->start();
while(!signaled)
   asm(" nop");
top_block->stop();

The flow- graph is run as long as ctrl+c isn't pressed and the destructor of top_block is run as well.

Why is the destructor so important? It's important because if I don't add the two following statements in there:

d_tx0->write_io (d_side, -129, 224);
d_tx0->write_io (d_side, -129, 128);
(where d_tx0 is a usrp_sink_s_sptr)

I end up with a pike in the spectrum at the tuned center frequency.

I have basically worked my way from the c++ dial- tone example, which imo. is illustrative.

I guess my question is how do I shut down a usrp1 correctly from c++?


Best regards
//Mattias





reply via email to

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