Hi,
    I am studying GNURadio now. but I have a problem with it. At first, there 
is a test file called test_usrp_standard_tx.cc. This file is work well and usrp 
can be shutdown automatically when all my wanted data are transmitted. then, I 
add a code like followed:
//test_usrp_standard_tx.cc
...
utx->start();
test_output(utx, (long long)nsamples, amp, waveform);
while(1); // added code
return 0;
}
As result of Spectrum Analyzer, it always have  frequency spectrum even though 
I pull out usrp's USB wire. So, I  think the action of shutdown usrp is occured 
in destructor.
However, when I test my own code, it cannot shutdown usrp too. here is my new 
test code:
 
gr_message_source_sptr x0 = gr_make_message_source(1, 4);
gr_top_block_sptr tb = gr_make_top_block("topblock");

void* msg_source_proc (void *args)
{
        ...
        gr_message_sptr msg = gr_make_message_from_string(s, 0, 0, 0);
        x0->msgq()->insert_tail(msg);
        return NULL;
}
main()
{       pthread_t thd_src;
        pthread_attr_t  attr;
        pthread_attr_init(&attr);
        pthread_create(&thd_src, &attr, msg_source_proc, NULL);
        ...
        usrp_sink_c_sptr x6 = usrp_make_sink_c(which_board, interp_rate, nchan, 
-1, 0, 0);
        usrp_subdev_spec subdev_spec = x6->pick_tx_subdevice();
        db_base_sptr db = x6->selected_subdev(subdev_spec);
        ....
        usrp_tune_result r;
        x6->tune(db->which(), db, center_freq, &r);
        db->set_enable(true);

        tb->connect(x0,0,x1,0);//connect blocks
        tb->connect(x1,0,x2,0);
        tb->connect(x2,0,x3,0);
        tb->connect(x3,0,x4,0);
        tb->connect(x4,0,x5,0);
        tb->connect(x5,0,x6,0);
        tb->run();
        printf ("*******************\n");
        return 0;
}
    The result showned that it can send a pkt well but cannot shutdown usrp and 
 "printf ("*******************\n")" have not print; 
    So I think the program doesn't jump out of "tb->run" . to say nothing of 
destsructor which is to shutdown usrp.
    what's wrong with this? I need you help.
    thank you very much
    best wishes!
 
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to