[USRP-users] Record in disc 4 channels in continuos mode

Anabel Almodovar anabel.almodovar at gmail.com
Mon Nov 11 12:01:52 EST 2019


Dear Nate,

The parameters that I introduce are the following:


*//setup the program options*

*    po::options_description desc("Allowed options");*

*    desc.add_options()*

*        ("help", "help message")*

*        ("args",
po::value<std::string>(&args)->default_value("addr0=192.168.60.2,second_addr0=192.168.50.2,recv_buff_size=900000000"),
"multi uhd device address args")*

*        ("file",
po::value<std::string>(&file)->default_value("/home/rs3lab/Escritorio/Grabaciones"),
"name of the file to write binary samples to")*

*        ("type", po::value<std::string>(&type)->default_value("short"),
"sample type: double, float, or short")*

*        ("nsamps", po::value<size_t>(&total_num_samps)->default_value(0),
"total number of samples to receive")*

*        ("duration", po::value<double>(&total_time)->default_value(0),
"total number of seconds to receive")*

*        ("time", po::value<double>(&total_time), "(DEPRECATED) will go
away soon! Use --duration instead")*

*        ("spb", po::value<size_t>(&spb)->default_value(10000), "samples
per buffer")*

*        ("rate", po::value<double>(&rate)->default_value(25e6), "rate of
incoming samples")*

*        ("freq", po::value<double>(&freq)->default_value(800e6), "RF
center frequency in Hz")*

*        ("gain", po::value<double>(&gain)->default_value(80), "gain for
the RF chain")*

*        ("ant", po::value<std::string>(&ant), "antenna selection")*

*        ("subdev", po::value<std::string>(&subdev)->default_value("A:0 A:1
B:0 B:1"), "subdevice specification")*

*        ("channel_list",
po::value<std::string>(&channel_list)->default_value("0,1,2,3"), "which
channel to use")*

*        ("bw", po::value<double>(&bw), "analog frontend filter bandwidth
in Hz")*

*        ("ref", po::value<std::string>(&ref)->default_value("external"),
"reference source (internal, external, mimo)")*

*        ("wirefmt",
po::value<std::string>(&wirefmt)->default_value("sc16"), "wire format (sc8,
sc16 or s16)")*

*        ("setup", po::value<double>(&setup_time)->default_value(1.0),
"seconds of setup time")*

*        ("progress", "periodically display short-term bandwidth")*

*        ("stats", "show average bandwidth on exit")*

*        ("sizemap", "track packet size and display breakdown on exit")*

*        ("null", "run without writing to file")*

*        ("continue", "don't abort on a bad packet")*

*        ("skip-lo", "skip checking LO lock status")*

*        ("int-n", "tune USRP with integer-N tuning")*

*    ;*



Then I initialize a vector so I can save the data of the 4 channels:


*    uhd::rx_metadata_t md;*

*//    std::vector<samp_type> buff(samps_per_buff);*

*//    std::ofstream outfile;*

*//***************************************************************************************

*//allocate buffers to receive with samples (one buffer per channel)*

*    const size_t samps_per_buff = rx_stream->get_max_num_samps();*

*    std::vector<std::vector<std::complex<float> > > buffs(*

*        usrp->get_rx_num_channels(), std::vector<std::complex<float>
>(samps_per_buff)*

*    );*



*    //create a vector of pointers to point to each of the channel buffers*

*    std::vector<std::complex<float> *> buff_ptrs;*

*    for (size_t i = 0; i < buffs.size(); i++)
buff_ptrs.push_back(&buffs[i].front());*

*//************************************************************************************



*  //  if (not null)*

*  //      outfile.open(file.c_str(), std::ofstream::binary);*

*    bool overflow_message = true;*



*    //setup streaming*

*    uhd::stream_cmd_t stream_cmd((num_requested_samples == 0)?*

*        uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS:*

*        uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE*

*    );*

*    stream_cmd.num_samps = size_t(num_requested_samples);*

*    stream_cmd.stream_now = false;*

*    //stream_cmd.time_spec = uhd::time_spec_t();*

*    stream_cmd.time_spec = usrp->get_time_last_pps(0)+1.1;*

*    rx_stream->issue_stream_cmd(stream_cmd);*


In addition, once a burst is adquired, the data is save in a file:



*        num_total_samps += num_rx_samps;*



*for (size_t i=0; i < num_rx_channels; i++)*

*{              *

*                std::ostringstream oss;*

*                oss << file << "/Grabaciones_CH_"<< i  << buffer <<
".dat";*

*                std::ofstream oss1;*



*
oss1.open(oss.str().c_str(),std::ofstream::app|std::ofstream::binary);*

*  oss1.write((const char*)&buff_ptrs,
samps_per_buff)*sizeof(std::complex<short>)); *

*               oss1.close();*

*}*


Thank you in advanced.


Regards,

Anabel

El lun., 11 nov. 2019 a las 16:55, Nate Temple (<nate.temple at ettus.com>)
escribió:

> Hi Anabel,
>
> What parameters are you using with the rx_samples_to_file example?
>
> Regards,
> Nate Temple
>
> On Mon, Nov 11, 2019 at 3:02 AM Anabel Almodovar via USRP-users <
> usrp-users at lists.ettus.com> wrote:
>
>> Hello,
>>
>> I am trying to make a continuous acquisition with an ettus x310 card
>> whose daughter boards are TwinRx. I have used as a base the example
>> "rx_samples_to_file.cpp" and I have modified it to be able to acquire
>> continuously with the 4 available channels. However, this gives me an
>> error and saves a lot of zeros even though I don't get the overflow error. By
>> testing the unmodified example I also get those zeros.
>>
>> Could someone tell me why this happens? How can I solve this error and
>> save the acquisition continuously on disk with the 4 channels?
>>
>> Thank you in advanced.
>>
>> Regards,
>> Anabel
>> _______________________________________________
>> USRP-users mailing list
>> USRP-users at lists.ettus.com
>> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20191111/dc3b5e18/attachment.html>


More information about the USRP-users mailing list