discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] usrp2: timestamp absolute ?


From: Juha Vierinen
Subject: Re: [Discuss-gnuradio] usrp2: timestamp absolute ?
Date: Mon, 11 May 2009 19:25:32 +0000

> my question is about the time stamp in rx_metadata->timestamp. I've got the
> rx_streaming_samples running and now I wondering what the time value is about.
> In the code I've found this:
> uint32_t        timestamp;      // time of rx or tx (100 MHz)
>
> Can you tell me what the timestamp exactly refers to. Is it just a counter?

It is a 32-bit counter (I remember somebody saying that this will soon
be a 64-bit counter) that just counts 100 MHz samples, so it will
overflow quite often. In normal operation this isn't tied to any
absolute clock.

> When/How is it started/reseted?

If you call sync_to_pps() and provide a PPS input (one second digital
pulse), the system will start streaming samples at the next PPS pulse.
This resets the timestamp to zero, which makes it possible to attach
an absolute time to your samples. I'm not sure exactly how accurate
this is, as I haven't properly tested this yet. If your sample clock
is locked to a good GPS syncronized reference clock, I'd guess the
accuracy could be better than 1e-8 s. I guess some of the "big guys"
might know more about this.

> Or to be more precisely: How do I calculate an absolute time like the extended
> unix time stamp with uSec and nSec?

The remaing us and ns are 0 if you are locked to a reference. You can
calculate the absolute time by counting the number of samples
received, assuming no buffer overflows have occured (which you can
detect from timestamp difference anomalies or missing frame sequence
numbers).

When streaming the data, you will have to throw away a small amount of
samples in the beginning, but you can quite easily determine where the
real first sample is located by looking at the time stamps of the
incoming frames.

If you are interested, I have a modified rx_streaming_samples.cc that
configures the sync_to_pps and determines where the true beginning of
samples is located at.

juha




reply via email to

[Prev in Thread] Current Thread [Next in Thread]