discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] How do I capture of the time of USRP N210 samples


From: LD Zhang
Subject: Re: [Discuss-gnuradio] How do I capture of the time of USRP N210 samples with host computer system time?
Date: Mon, 7 Jan 2013 22:14:39 -0800

When I used 

set_start_time(uhd.time_spec(time.time() + 0.5)))

for both USRP units (after set_time_now), this seems to have worked. At
least by visual examination the 2 units are taking data at approximately the
same time. Yeah, yeah, yeah, I know, this is never exactly accurate and one
need to do PPS for accurate and robust operation for long stretch of time.
But actually for this phase of development we are making a point
intentionally not to use the PPS reference and relying on the USRP clock
over shorter stretch of time. I know that because of this we also have to do
ntp sync for the 2 host computers for the USRPs more frequently which makes
the code a little uglier. In the long run, we will adopt the use of a PPS.

Thanks,

LD

-----Original Message-----
From: Josh Blum [mailto:address@hidden On Behalf Of Josh Blum
Sent: Monday, January 07, 2013 3:09 PM
To: address@hidden
Cc: LD Zhang
Subject: Re: [Discuss-gnuradio] How do I capture of the time of USRP N210
samples with host computer system time?



On 01/07/2013 04:46 PM, LD Zhang wrote:
> Thanks to Josh and Marcus for their comments. The set_time_now command 
> works! After I put it in, the earlier observed 0.5 sec offset between 
> the 2 USRP became ~0.1 second. So there is still work to do. I guess 
> my options
> are:
> 
> 1. Make the set_start_time command to work. My question is how I can 
> make it work in python. I hand edited the set_time_now command to 
> embed in the initialization part of the top_block.py code generated 
> from GRC (which has worked). Do I just hand edit the set_start_time just
following that command?
> Now the problem is that after set_time_now, the USRP time is sync'd to 
> the system time. But what is the argument I should give to set_start_time?
> 

Just a time in the near future that you can reasonably schedule in advance
of starting the flow graph. Like:
uhd.time_spec(time.time() + 0.5))

> 2. The other option is to get the metadata out for the samples collected.
> From what I read, it looks like one cannot do it in GRC, but have to 
> edit the cpp source code. Is there an example somewhere of how this is
done?
> 

you can write a custom block in c++ or python to deal with tags

The most complete guide is here, but it requires installing grextras. I
think you can do this w/ more recent native gnuradio, but there isnt a guide
yet

https://github.com/guruofquality/grextras/wiki/Blocks-Coding-Guide#wiki-stre
am-tags

-josh

> Thanks very much,
> 
> LD
> 
> -----Original Message-----
> From: LD Zhang [mailto:address@hidden
> Sent: Friday, January 04, 2013 5:38 PM
> To: 'Marcus D. Leech'; 'address@hidden'
> Subject: RE: [Discuss-gnuradio] How do I capture of the time of USRP 
> N210 samples with host computer system time?
> 
> Great! Thanks. I tried to import time and it works. Now I just have to 
> see if this is sufficient for my sample gather timing or I still have 
> to get the timestamp of the first sample using metadata and such.
> 
> LD
> 
> -----Original Message-----
> From: Marcus D. Leech [mailto:address@hidden
> Sent: Friday, January 04, 2013 4:15 PM
> To: LD Zhang; address@hidden
> Subject: Re: [Discuss-gnuradio] How do I capture of the time of USRP 
> N210 samples with host computer system time?
> 
> On 01/04/2013 07:03 PM, LD Zhang wrote:
>> Hello,
>>
>> I tried the following command in python:
>>
>>> python:
>>> usrp_source.set_time_now(uhd.time_spec_t(time.time())
>>>
>> It doesn't seem to work. Looks like the "time.time()" is wrong? 
>> Looked up an earlier example:
>>
>> set_time_now(uhd::time_spec_t(0.0), 0)
>>
>> The syntax looks different. But this may be doing something different 
>> from my intention which is to sync the USRP time to the host system 
>> time. I am still searching for the right syntax for this command. Any 
>> help is appreciated.
>>
>> LD
>>
>>
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>>
> You'll have to put an:
> 
> import time
> 
> In your python
> 
> 
> 
> --
> Marcus Leech
> Principal Investigator
> Shirleys Bay Radio Astronomy Consortium http://www.sbrac.org
> 
> 
> 
> 
> _______________________________________________
> 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]