I'm using a USRP2 with UHD and starting a receive a short time in the future. I 
have an external reference and PPS. Below is the pertinent code, slightly 
simplified.

The timestamp returned in the metadata by recv is always off a little from the 
time I requested in the stream command. The amount it is off seems to be 
consistent and related to the sampling rate. For 25 Msps, it's always off by 
230 nanoseconds, for 12.5 Msps, it's off by 270 nanoseconds, for 6.25 Msps, 
it's off by 350 nanoseconds. If I receive one packet at a time using 
RECV_MODE_ONE_PACKET, the first packet's metadata is off by the same amount.

I'm using the latest gnuradio and uhd (the one with USRP1 support).

Should I expect the timestamp in the received metadata to match the requested 
time in the stream command?

-Marc

// set_clock_config elided. 

uhd::stream_cmd_t 
streamCommand(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
streamCommand.num_samps = _buffer.size();
streamCommand.stream_now = false;
streamCommand.time_spec = startingTime;
_usrp->issue_stream_cmd(streamCommand);

size_t numReceived = _device->recv(&_buffer[0], _buffer.size(), metadata,
                                                                        
uhd::io_type_t::COMPLEX_INT16, 
                                                                        
uhd::device::RECV_MODE_FULL_BUFF);
// Error checking elided.

fprintf (stdout, "Off by %g nanoseconds.\n", (metadata.time_spec - 
startingTime).get_real_secs()*1e9);

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to