Synchronizing USRP Events Using Timed Commands in UHD

From Ettus Knowledge Base
Revision as of 17:26, 4 February 2020 by SamReiter (Talk | contribs) (PPS (Pulse Per Second))

Jump to: navigation, search

Application Note Number

AN-TC

Revision History

Date Author Details
2020-02-10 Sam Reiter Initial creation

Abstract

This AN discusses Timed Commands in UHD. We will explore usecases, theory of operation, and examples of timed command use in UHD 3.x.

Timed Commands: Overview and Usecases

  • A
  • B
  • C
  • D
  • E
  • F
  • G
  • H
  • I
  • J

Clocking and Timekeeping in the USRP

In this section, we will cover several key topics relating to USRP synchronization and the use of timed commands in UHD.

CHDR Packet Types and Structure

CHDR or "Compressed Header" packets are a derivative of the VITA 49 (VRT) protocol. While the CHDR protocol is proprietary to USRP devices, mapping to and from VITA-49 is a trivial task. All packet routing in b2xx and "Gen 3" USRPs uses the CHDR protocol.

There are 4 types of packets used in the USRP:

  • Data
  • Flow Control
  • Command
  • Command Response

The type of packet is determined by the state of bits 63 and 62 in the CHDR header. See UHD Manual: Radio Transport Protocols for more information on CHDR structure.

packet breakdown.png


All of these packet types have a single bit (61) used to denote whether an optional timestamp is included. If present, a timestamp is a 64-bit value representing an absolute time value. In this application note, we’re concerned with the use and functionality of command packets with a timestamp present, also known as “Timed Commands”.

Command Queue

PPS (Pulse Per Second)

PPS is a signal used by USRPs for time synchronization. Within the context of a USRP, a PPS signal is expected to have the following properties:

  • 1Hz
  • TTL Signal Levels
  • 25% duity cycle

A USRP's PPS can be derived from a GPSDO automatically, from an externally supplied PPS signal, or via internal PPS synthesis (not supported in legacy USRPs).

A PPS trigger is used to coordinate time alignment events across multiple devices. For example, the USRPs internal sense of time (the vita_time counter) can be synchronously set/reset across multiple USRPs via UHD API calls such as

set_time_next_pps
set_time_unknown_pps

For further information on PPS and other common reference signals, see the UHD Manual: Device Synchronization.

Radio Core Block Timing

The Radio Core is the heart of the USRP's functionality. The radio core is responsible for controlling all TX and RX daughterboard components (synthesizer, signalpath, gain and attenuation elements, etc.), GPIO, setting up data streaming to/from DACs and ADCs, and related error handling.

rfnoc gsg an 10.png

In addition to the functionality listed above, the Radio Core is also responsible for maintaining the USRP's sense of absolute time. This absolute time value is stored as a 64-bit counter called the "VITA time" or vita_time in UHD. The vita_time counter is incremented off of the FPGA's base clock and local to the Radio Core USRP, meaning that other RFNoC blocks can not reference this counter value directly.

General RFNoC block Timing

Summary

USRP Time Sources

Internal PPS

External PPS

GPSDO

UHD API for Timed Commands

Overview of Relevant Methods

Timed Commands vs. Stream Commands with time_spec (remove this?)

Commands that can be timed

Time Resolution of Timed Commands

Example: Using Timed Commands to Phase Align Channels

Example: Using Timed Commands to Control GPIO