<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi list<br>
</p>
<p><br>
</p>
<p>I'm having some trouble with gr-osmosdr and rtl_tcp. I'm trying to set up a Raspberry Pi as a remote receive to provide I/Q samples over the network to a machine running gnss-sdr (for realtime GPS processing.) The Pi simply runs "rtl_tcp -f 1575420000 -a
 0.0.0.0", and then on gnss-sdr the gr-osmosdr block is created with </p>
<p><br>
</p>
<p>osmosdr::source::make("rtl_tcp=<address of pi>");<br>
</p>
<p><br>
</p>
<p>This connects as expected, but the generated data from rtl_tcp is not being consumed fast enough; the linked list quickly fills up to 502.</p>
<p><br>
</p>
<p>I thought maybe the WiFi was the bottleneck, so I switched to Ethernet. No luck, same behaviour.</p>
<p><br>
</p>
<p>I decided to take it all the way back and plug the dongle straight into the machine that is running gnss-sdr, and then run rtl_tcp on the same machine: "rtl_tcp -f 1575420000" and change the arguments for the gnuradio block to<br>
​<br>
</p>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">osmosdr::source::make(</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">"rtl_tcp"</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">);</span>​<br>
<br>
</div>
<p>I still get this poor performance. Note that on the same machine, with the GrOsmoSdr block connecting straight to the dongle via USB (i.e. creating the block with empty arguments) the performance is fine and I'm able to track GPS satellites in realtime.
 I understand that having the network layer in between is going to cause some delay, but I didn't expect this much.<br>
</p>
<p><br>
</p>
<p>I thought that maybe the actual processing of gnss-sdr was holding up the reads in some way, so I tried a different program which post-processes the data; the code which does this is in the listing below (pulled from the function "frontend_capture" from <a href="https://raw.githubusercontent.com/gnss-sdr/gnss-sdr/next/src/utils/front-end-cal/main.cc" id="LPlnk174063">https://raw.githubusercontent.com/gnss-sdr/gnss-sdr/next/src/utils/front-end-cal/main.cc</a>).<br>
</p>
<p><br>
</p>
<p>The source block is just a wrapper around an osmosdr::source("rtl_tcp"). The conditioner is a pass-through block. Unfortunately, the reads *still* aren't keeping up with the writes from rtl_tcp. I'd like to understand what's causing this. Is it because of
 the frequency tuning? Is it the sample rate? I have tried various rates. I noticed <span style="font-size: 12pt;">rtl_tcp_source_c::get_sample_rates</span><span style="font-size: 12pt;">​ returns a few "known to work" rates. Should I be setting the sample
 rate to exactly one of these?</span></p>
<p><br>
</p>
<p><br>
</p>
<pre>    gr::top_block_sptr top_block;
    GNSSBlockFactory block_factory;
    boost::shared_ptr<gr::msg_queue> queue;

    queue =  gr::msg_queue::make(0);
    top_block = gr::make_top_block("Acquisition test");

    std::shared_ptr<GNSSBlockInterface> source;
    source = block_factory.GetSignalSource(configuration, queue);

    std::shared_ptr<GNSSBlockInterface> conditioner = block_factory.GetSignalConditioner(configuration,queue);

    gr::block_sptr sink;
    sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat");

    //--- Find number of samples per spreading code ---
    long fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
    int samples_per_code = round(fs_in_
            / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
    int nsamples = samples_per_code * 50;

    int skip_samples = fs_in_ * 5; // skip 5 seconds

    gr::block_sptr head = gr::blocks::head::make(sizeof(gr_complex), nsamples);

    gr::block_sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), skip_samples);

    try
    {
            source->connect(top_block);
            conditioner->connect(top_block);
            top_block->connect(source->get_right_block(), 0, conditioner->get_left_block(), 0);
            top_block->connect(conditioner->get_right_block(), 0, skiphead, 0);
            top_block->connect(skiphead, 0, head, 0);
            top_block->connect(head, 0, sink, 0);
            top_block->run();
    }
    catch(std::exception& e)
    {
            std::cout << "Failure connecting the GNU Radio blocks " << e.what() << std::endl;
            return false;
    }

    //delete conditioner;
    //delete source;
    return true;<br></pre>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
Anthony Arnold | Programmer</div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<br>
</div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
b:  <font color="#000000"><u>http://anthony-arnold.com/</u></font><br>
<div>t:   <font color="#000000"><u>http://twitter.com/anthonyarnold_/</u></font></div>
<div>e:  <u>anthony.arnold@uqconnect.edu.au</u></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif"><br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>