discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Issue_stream_cmd, Segmentation Fault


From: Zhihong Luo
Subject: Re: [Discuss-gnuradio] Issue_stream_cmd, Segmentation Fault
Date: Thu, 11 Feb 2016 19:36:48 -0500

Hi all,

I just installed the file again, and this time the file can be generated with no errors. I must have did something wrong last time I installed it. And there is no segmentation fault. Thank you for previous help.

But when I used it, if I set  "issue_stream_cmd_on_start" as false as follow, even if I issue stream command after the flow graph starts, the file of the file sink is still empty.

gr::uhd::usrp_source::sptr usrp_source = gr::uhd::usrp_source::make(device_addr, uhd::stream_args_t("fc32"),false);

tb->start();
usrp_source->issue_stream_cmd (stream_cmd); (mode is NUM_SAMPLES_AND_DONE)

I expect the file to have some small amount of data, but no matter how larger the sample number I set, it was still empty.

Another issue is that if I set it to issue stream command on start ("issue_stream_cmd_on_start"  = true), even if I call usrp_source->stop(), the file still keeps growing larger.

I am confused by these two issues, thanks in advance for anyone pointing out the problem.

On Thu, Feb 11, 2016 at 1:21 AM, Zhihong Luo <address@hidden> wrote:
For more information, the line that causes error is:

gr::uhd::usrp_source::sptr usrp_source = gr::uhd::usrp_source::make(device_addr, uhd::stream_args_t("fc32"));

And if I delete the usrp_source::make line, there will be no error. But even if I change it into the old style of make, the same error output occurs. Therefore, the problem is about the new make function, which I used from Revision 338cfae6. I just copied and pasted the three files of the revision, then make and make install.

Thanks,
Zhihong

On Wed, Feb 10, 2016 at 10:21 PM, Zhihong Luo <address@hidden> wrote:
Hi James,

I modified the code, uninstalled then make and install again. But when I tried to generate the C API file (which can be generated before I did all these), it outputs errors:

CMakeFiles/tags.dir/tags.cc.o: In function `_main(int, char**)':
tags.cc:(.text+0x892): undefined reference to `gr::uhd::usrp_source::make(uhd::device_addr_t const&, uhd::stream_args_t const&, bool)'
collect2: error: ld returned 1 exit status
make[2]: *** [apps/tags] Error 1
make[1]: *** [apps/CMakeFiles/tags.dir/all] Error 2
make: *** [all] Error 2

It has errors on usrp_source, which I just modified the code of. I checked the source files, they are the same as Revision 338cfae6. So where can my mistakes be? Thanks in advance.

Zhihong

On Wed, Feb 10, 2016 at 8:38 PM, James Humphries <address@hidden> wrote:
You can uninstall in the build directory:

sudo make uninstall



On Wed, Feb 10, 2016 at 8:33 PM, Zhihong Luo <address@hidden> wrote:
Hi James,

Actually, the commit was only a month ago, I checked my source code and it is different from the revised version. So just to make sure, what I need to do is to change the source files (usrp_source_impl.cc, usrp_source.h etc), then

        mkdir build  (under gnuradio/)
        cd build
        cmake ..
        make
        make test
        sudo make install

Then the lib files will be overwritten? Or do I need to delete something before doing so?

Thanks,
Zhihong

On Wed, Feb 10, 2016 at 7:43 PM, James Humphries <address@hidden> wrote:
Hi Zhihong,

4ae7a6015ba719a4720f61cc6f3857de2ebda89f is the commit hash that refers to a specific commit on the GNU Radio repository.

If you built GNU Radio recently (I believe this commit was last August), then you should be OK. 

-Trip

On Wed, Feb 10, 2016 at 6:42 PM, Zhihong Luo <address@hidden> wrote:
Hi Martin,

What I want to do is to use the stream command to receive data, put it into the file, rest for like 2s, then start receiving again. I think I can do this by using multiple NUM SAMPLE AND DONE commands?

 I don"t really understand the stop() here, I am using it because the manual seems to say so?  Previously, I simply called the issue-stream-cmd function before the flow graph start, but the file grew large very rapidly, so I was thinking maybe the stop() is the right way to do it. Now I have no idea how to call it.  

Sorry, but what is 4ae7a6015ba719a4720f61cc6f3857de2ebda89f ? 

Thanks a lot,
Zhihong 
2016年2月10日星期三,Martin Braun <address@hidden> 写道:
Which version are you running? 4ae7a6015ba719a4720f61cc6f3857de2ebda89f
should fix this issue.

Also, is this really what you want to happen? If you just call
issue_stream_cmd() with a STOP command, it will stop, but all the data
will still flow through the graph, instead of getting flushed.
Especially as you are stopping and starting the flow graph.

My guess is you don't really need stop() here.

Cheers,
M


On 02/10/2016 03:07 PM, Zhihong Luo wrote:
> Hi All,
>
> In the manual, it says to use issue_stream_cmd:
>
> After starting the flow graph, the user should call stop()
> <https://gnuradio.org/doc/doxygen/classgr_1_1block.html#a0863bc16f7c84adf4cddf5d53124450e>on
> this block, then issue any desired arbitrary stream_cmd_t structs to the
> device
>
> Therefore, I tried to stop() then issue the stream command, but it ran
> into segmentation fault. My code is:
>
>     uhd::stream_cmd_t
> stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
>      size_t num_requested_samples= 10000;
>      stream_cmd.num_samps = size_t(num_requested_samples);
>      stream_cmd.stream_now = true;
>      stream_cmd.time_spec = uhd::time_spec_t();
>     ...
>     std::cout << "starting flow graph" << std::endl;
>     tb->start();
>     usrp_source->stop();
>     usrp_source->issue_stream_cmd (stream_cmd);
>
> Even if I delete the issue_stream_cmd line, there is still a
> segmentation fault. Can someone point out where I made a mistake? Thanks.
>
> Zhihong Luo
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio








reply via email to

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