Example: rx_samples_to_file.py

Dear All,

My aim at the timebeing is to synchronously record some data from 3
USRP-N200 for offline processing I wonder if the provided example
“rx_samples_to_file.py” works for multiple USRPs with external Ref/PPS.

Does anybody have an expereince with this example and wants to share it?
I cann’t find any mentioning for the PPS signal in the source file.

Best regards,

Zo

Zo

Not all examples exercise every possible API interface.

You can reproduce most of rx_samples_to_file in a .grc script within a
few minutes that enables using of PPS inputs, etc.

Dear Marcus,

I a working under windows now. I have modified the the example
“rx_samples_to_file.cpp” by including the following lines

usrp->set_time_source(“external”);
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
boost::this_thread::sleep(boost::posix_time::seconds(1));

for (size_t chan = 0; chan < usrp->get_rx_num_channels(); chan++)
stream_args.channels.push_back(chan);
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);

std::vector<std::vector<std::complex > >
buffs( usrp->get_rx_num_channels(),
std::vector<std::complex >(samps_per_buff) );

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

while(not stop_signal_called and (num_requested_samples !=
num_total_samps or num_requested_samples == 0)){
size_t num_rx_samps = rx_stream->recv(buff_ptrs, samps_per_buff,
md, 2.0);
outfile1.write((const char*)buff_ptrs[0],
num_rx_sampssizeof(float));
outfile2.write((const char
)buff_ptrs[1],
num_rx_sampssizeof(float));
outfile3.write((const char
)buff_ptrs[2],
num_rx_samps*sizeof(float));
}

outfile1.close();
outfile2.close();
outfile3.close();

I am feeding a split sinusoid to these boards so I expected to see
similar values in these three files. However, i only see a sinusoid in
the first file and some random noise in the 2nd and 3rd files. I am not
sure how the metadata saves from the three boards. Would you check the
lines above and reply if you have any insights, please?
I wasn’t able to verify sync.

Best regards,

Zo

Date: Mon, 15 Apr 2013 15:37:21 -0700
From: [email protected]
To: [email protected]
Subject: Re: Example: rx_samples_to_file.py

  Dear All,



    My aim at the timebeing is to synchronously record some data
    from 3 USRP-N200 for offline processing I wonder if the provided
    example "rx_samples_to_file.py" works for multiple USRPs with
    external Ref/PPS.



    Does anybody have an expereince with this example and wants to
    share it? I cann't find any mentioning for the PPS signal in the
    source file.



    Best regards,



    Zo









Not all examples exercise every possible API interface.



You can reproduce most of rx_samples_to_file in a .grc script within
a few minutes that enables using of PPS inputs, etc.





--

Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org


Discuss-gnuradio mailing list

[hidden email]

https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

If you reply to this email, your message will be added to the 

discussion below:
http://gnuradio.4.n7.nabble.com/Example-rx-samples-to-file-py-tp40777p40806.html

To start a new topic under GnuRadio, email 

[email protected]

To unsubscribe from GnuRadio, click here.

NAML

Got it! The problem I sent before is now solved by exeplicity defining
gain, frequncy and rate for the three cheannles as follows:
usrp->set_rx_gain(gain,std::string(),0);
usrp->set_rx_gain(gain,std::string(),1);
usrp->set_rx_gain(gain,std::string(),2);
and similar lines for freq and rate.

However, the obtained data is not time-alligned although I sync with the
unknown pps as in my prevoius code.

From: [email protected]
To: [email protected]
Subject: RE: Example: rx_samples_to_file.py
Date: Mon, 6 May 2013 09:15:41 +0000

Dear Marcus,

I a working under windows now. I have modified the the example
“rx_samples_to_file.cpp” by including the following lines

usrp->set_time_source(“external”);
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
boost::this_thread::sleep(boost::posix_time::seconds(1));

for (size_t chan = 0; chan < usrp->get_rx_num_channels(); chan++)
stream_args.channels.push_back(chan);
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);

std::vector<std::vector<std::complex > >
buffs( usrp->get_rx_num_channels(),
std::vector<std::complex >(samps_per_buff) );

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

while(not stop_signal_called and (num_requested_samples !=
num_total_samps or num_requested_samples == 0)){
size_t num_rx_samps = rx_stream->recv(buff_ptrs, samps_per_buff,
md, 2.0);
outfile1.write((const char*)buff_ptrs[0],
num_rx_sampssizeof(float));
outfile2.write((const char
)buff_ptrs[1],
num_rx_sampssizeof(float));
outfile3.write((const char
)buff_ptrs[2],
num_rx_samps*sizeof(float));
}

outfile1.close();
outfile2.close();
outfile3.close();

I am feeding a split sinusoid to these boards so I expected to see
similar values in these three files. However, i only see a sinusoid in
the first file and some random noise in the 2nd and 3rd files. I am not
sure how the metadata saves from the three boards. Would you check the
lines above and reply if you have any insights, please?
I wasn’t able to verify sync.

Best regards,

Zo

Date: Mon, 15 Apr 2013 15:37:21 -0700
From: [email protected]
To: [email protected]
Subject: Re: Example: rx_samples_to_file.py

  Dear All,



    My aim at the timebeing is to synchronously record some data
    from 3 USRP-N200 for offline processing I wonder if the provided
    example "rx_samples_to_file.py" works for multiple USRPs with
    external Ref/PPS.



    Does anybody have an expereince with this example and wants to
    share it? I cann't find any mentioning for the PPS signal in the
    source file.



    Best regards,



    Zo









Not all examples exercise every possible API interface.



You can reproduce most of rx_samples_to_file in a .grc script within
a few minutes that enables using of PPS inputs, etc.





--

Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org


Discuss-gnuradio mailing list

[hidden email]

https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

If you reply to this email, your message will be added to the 

discussion below:
http://gnuradio.4.n7.nabble.com/Example-rx-samples-to-file-py-tp40777p40806.html

To start a new topic under GnuRadio, email 

[email protected]

To unsubscribe from GnuRadio, click here.

NAML

Yes I am using the command: uhd::usrp::multi_usrp::make(args) passing
the IP addresses of the three N200 boards. Moreover I check the boards
synch using usrp->get_time_synchronized () which returns true but still
the sinusoids are not temporally alligned. A colleague raised an
arguement the even though the boards’ clcok are synch the daughter
boards may introduce phase shift. Is this arguement valid? I am using DB
DBSRX2.

Many thanks,

Zo

PS. Thanks for recommending GRC but I am more confortable to work under
windows with MSVC.
Date: Mon, 6 May 2013 04:59:09 -0700
From: [email protected]
To: [email protected]
Subject: Re: Example: rx_samples_to_file.py

    Dear Marcus,



    I a working under windows now. I have modified the the example
    "rx_samples_to_file.cpp" by including the following lines



    usrp->set_time_source("external");

    usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));

    boost::this_thread::sleep(boost::posix_time::seconds(1));



    for (size_t chan = 0; chan < usrp->get_rx_num_channels();
    chan++)

            stream_args.channels.push_back(chan);

    uhd::rx_streamer::sptr rx_stream =
    usrp->get_rx_stream(stream_args);



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



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

        for (size_t i = 0; i < buffs.size(); i++)

             buff_ptrs.push_back(&buffs[i].front());



    while(not stop_signal_called and (num_requested_samples !=
    num_total_samps or num_requested_samples == 0)){

            size_t num_rx_samps = rx_stream->recv(buff_ptrs,
    samps_per_buff, md, 2.0);

            outfile1.write((const char*)buff_ptrs[0],
    num_rx_samps*sizeof(float));

            outfile2.write((const char*)buff_ptrs[1],
    num_rx_samps*sizeof(float));

            outfile3.write((const char*)buff_ptrs[2],
    num_rx_samps*sizeof(float));

        }



        outfile1.close();

        outfile2.close();

        outfile3.close();





    I am feeding a split sinusoid to these boards so I expected to
    see similar values in these three files. However, i only see a
    sinusoid in the first file and some random noise in the 2nd and
    3rd files. I am not sure how the metadata saves from the three
    boards. Would you check the lines above and reply if you have
    any insights, please?

    I wasn't able to verify sync.



    Best regards,



    Zo



Where are you actually doing the setup on the 3 N210s?  Via a
mult-usrp object?



Seriously, you can do this in GRC in about five minutes.





--

Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org


Discuss-gnuradio mailing list

[hidden email]

https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

If you reply to this email, your message will be added to the 

discussion below:
http://gnuradio.4.n7.nabble.com/Example-rx-samples-to-file-py-tp40777p41189.html

To start a new topic under GnuRadio, email 

[email protected]

To unsubscribe from GnuRadio, click here.

NAML

for (size_t chan = 0; chan < usrp->get_rx_num_channels(); chan++)

}

the lines above and reply if you have any insights, please?
I wasn’t able to verify sync.

Best regards,

Zo
Where are you actually doing the setup on the 3 N210s? Via a mult-usrp
object?

Seriously, you can do this in GRC in about five minutes.

Zo

PS. Thanks for recommending GRC but I am more confortable to work
under windows with MSVC.
So, rx_samples_to_file isn’t actually a Gnu Radio component, but an
example program that’s part of UHD.

Just in the interests of pedanticism, if you’re going to be going that
route, further questions should probably be posted to usrp-users,
not here.