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: Josh Blum
Subject: Re: [Discuss-gnuradio] How do I capture of the time of USRP N210 samples with host computer system time?
Date: Fri, 04 Jan 2013 13:47:12 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0


On 01/04/2013 01:21 PM, LD Zhang wrote:
> Great! Thanks Josh for the answers to my last email. Please see my comments
> and questions below.
> 
> ============================================================================
> ========
> 
> If you want to use the PC clock, I recommend calling set time now with the
> current PC time before scheduling streaming. This will make the USRP tick
> counter roughly match the PC clock.
> 
> python:
> usrp_source.set_time_now(uhd.time_spec_t(time.time())
> 
> c++
> usrp_source->set_time_now(uhd::time_spec_t(secs, micros, long(1e6));
> 
> This way, your only time-ambiguity is the variance in ethernet control
> packets and the difference in time between the different PCs. That should
> satisfy referenced to PC's time anyway...
> 
>>>>
> I will try it in Python to set the USRP time. My generated top_block.py is
> doing as: self.uhd_usrp_source_0.set_.......
> I suppose I will just do:
> self.uhd_usrp_source_0.set_time_now(uhd.time_spec_t(time.time())
> 
> There is however a question of how often one needs to set the USRP time. It
> would depend on how fast the USRP clock drifts with respect to host computer
> system time. I remember a number of 2 ppm accuracy of the TCXO frequency
> reference. How does this translate to rate of clock drift (in say
> micro-seconds drift per hour)?
> 

Doesnt really matter. The PC and USRP are on two different clocks with
very different drifts. You should probably just set the time again
before every acquisition. The ambiguity is probably going to be on the
order of several ms anyway.

>>>>
> 
> --------------------------------------
> 
> The next step would be to schedule when a stream begins for each device so
> they send RX samples to the host at the "same time" (according to the USRP
> anyway).
> 
> I think the USRP source block supports setting the time, and streaming at a
> specific time, but there isnt a way to do this at the GRC level. So you
> might need some hand coded python added to the generated flowgraph, if you
> are using GRC.
> 
>>>>
> OK, I want to do this. But what is the command to do in python? Something
> like:
> self.uhd_usrp_source_0.rx_sample_time??? Or .schedule_time??? 
> 


There is a set_start_time() call. setting this will effect what time the
streaming begins when the flow graph starts

Also, as an alternative, there is access to the issue_stream_cmd(). You
can leave the flow graph running and issue commands to turn streaming on
and off, schedule bursts, etc...

> I do need to pass the sample gather start time as a variable to the
> top_block.py script.  How do I do that (I am a matlaber who is still clumsy
> with python)?
> 

I guess you could just exec the python process to do a single
acquisition, write to file, close and return.

If you are messing w/ GRC, the parameter block will generate command
line options and top block constructor parameters for you.

-josh

> Thanks and Regards,
> 
> LD
> 
> _______________________________________________
> 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]