\input texinfo    @c -*-texinfo-*-
%
% fine-delay.in - main file for the documentation
%
%%%%

%------------------------------------------------------------------------------
%
%                         NOTE FOR THE UNAWARE USER
%                         =========================
%
%    This file is a texinfo source. It isn't the binary file of some strange
%    editor of mine. If you want ASCII, you should "make fine-delay.txt".
%
%------------------------------------------------------------------------------

%
% This is not a conventional info file...
% I use three extra features:
%   - The '%' as a comment marker, if at beginning of line ("\%" -> "%")
%   - leading blanks are allowed (this is something I can't live without)
%   - braces are automatically escaped when they appear in example blocks
%

@comment %**start of header
@documentlanguage en
@documentencoding UTF-8
@setfilename fine-delay.info
@settitle fine-delay
@iftex
@afourpaper
@end iftex
@paragraphindent 3
@comment %**end of header

@setchapternewpage off

@set update-month October 2011

@finalout

@titlepage
@title Fine Delay User's Manual
@subtitle FMC Delay 1ns-4cha
@author CERN BE-CO-HT / Tomasz Włostowski, Alessandro Rubini

@end titlepage
@headings single

@iftex
@contents
@end iftex

@c ##########################################################################
@node Top
@chapter Introduction

The @i{FMC Delay 1ns-4cha} is an FPGA Mezzanine Card (FMC - VITA 57 standard),
whose main purpose is to produce pulses delayed by a user-programmed value with
respect to the input trigger pulse. The card can also work as a Time to Digital converter (TDC)
or as a programmable pulse generator triggering at a given UTC time. 

This document provides an end-user description of Fmc Delay 1ns-4cha's features and its
programming API. Moreover, an explanation of the card's operation and a short carrier FPGA 
implementation guide are available for advanced users or developers. For the sake of clarity of this document, the card's 
name will be further abbreviated as @i{FmcDelay}.

@menu
* Requirements and supported platforms::    
* Card speficications::           
* Card operation::              
* Programmer's API reference::                 
* Theory of operation::  
* FPGA implementers' guidelines::    
* Acknowledgments::             
@end menu

@c ##########################################################################
@node Requirements and supported platforms
@chapter Requirements and supported platforms

@i{FmcDelay} can work with any VITA 57-compliant FMC carrier, provided that the carrier's FPGA has enough logic resources. 
So far, FmcDelay has been only tested with the CERN's SPEC (Simple PCI-Express Carrier) board and the provided drivers currently
work only with that carrier. A VME version using the SVEC carrier is currently being developed and should be available soon.

In order to operate @i{FmcDelay}, the following hardware/software components are required:

@itemize @bullet
@item A standard PC with at least one free 4x (or wider) PCI-Express slot,
@item A SPEC PCI-Express FMC carrier (supplied with the @i{FmcDelay}),
@item 50-ohm cables with 1-pin LEMO 00 plugs for connecting the I/O signals,
@item Any Linux (kernel 2.6 or 3.0+) distribution,
@item Demo GUI Application requires Python 2.7+ and PyQt 4.0+
@end itemize

@c ==========================================================================
@node Card specifications
@chapter Card specifications

@node Modes of operation
@section Modes of operation

@i{FmcDelay} can work in one or more of the following modes:
@itemize @bullet
@item @b{Pulse Delay}: produces one or more pulse(s) on selected outputs
a given time after an input trigger pulse (fig. 1a)
@item @b{Pulse Generator}: produces one or more pulse(s) on selected outputs starting at an
absolute time value programmed by the user (fig. 1b). In this mode, time base is usually provided by the White Rabbit network.
@item @b{Time to Digital Converter}: tags all trigger and output pulses and delivers the timestamps to the user's application.
@end itemize

@float
@image{drawings/func, 12cm,,,.pdf}
@caption{Fig. 1. @i{FmcDelay} operating modes.}
@end float


Modes (pulse delay/generator) can be selected independently for each output. For example, one can configure the output 1 to delay trigger pulses
by 1 us, and the output 2 to produce a pulse at the beginning of each second. The TDC mode can be enabled for the input and output at any time and
does not interfere with the operation of the channels being time tagged.

@c ==========================================================================

@section Mechanical/Environmental
@noindent @b{Mechanical and environmental specs:}
@itemize @bullet
@item Format: FMC (VITA 57), with rear zone for conduction cooling
@item Operating temperature range: 0 - 90 degC.
@item Carrier connection: 160-pin Low Pin Count FMC connector
@end itemize

@section Electrical
@noindent @b{Inputs/Outputs:}
@itemize @bullet
@item 1 trigger input (LEMO 00)
@item 4 pulse outputs (LEMO 00)
@item 2 LEDs
@item Carrier communication via 160-pin Low Pin Count FMC connector
@end itemize

@noindent @b{Trigger input:}
@itemize
@item TTL/LVTTL levels, DC-coupled. Reception of a trigger pulse is indicated by blinking the "TRIG" LED in the front panel.
@item 2 kOhm or 50 Ohm input impedance (programmable via software). 50 Ohm termination is indicated by the "TERM" LED in the front panel.
@item Power-up input impedance: 2 kOhm.
@item Protected against short circuit, overcurrent (> 200 mA) and overvoltage (up to +28 V).
@item Maximum input pulse edge rise time: 20 ns.
@end itemize

@noindent @b{Outputs:}
@itemize
@item TTL-compatible levels DC-coupled: Voh = 3 V, Vol = 200 mV (50 Ohm load), Voh = 6 V, Vol = 400 mV (high impedance).
@item Output impedance: 50 Ohm (source-terminated)
@item Rise/fall time: 2.5 ns (10%% - 90%%, 50 Ohm load)
@item Power-up state: LOW (2 kOhm pulldown), guaranteed glitch-free.
@item Protected against continuous short circuit, overcurrent and overvoltage (up to +28 V).
@end itemize

@noindent @b{Power supply:}
@itemize
@item Used power supplies: P12V0, P3V3, P3V3_AUX, VADJ (voltage monitor only).
@item Typical current comsumption: 200 mA (P12V0) + 1.5 A (P3V3).
@item Power dissipation: 7 W. Forced cooling is required.
@end itemize

@node Timing
@section Timing
@float
@image{drawings/io_timing, 14cm,,,.pdf}
@caption{Fig. 2. @i{FmcDelay} timing parameter definitions.}
@end float

@noindent @b{Time base:}
@itemize @bullet
@item Onboard oscillator accuracy: +/- 2.5 ppm (i.e. max. 2.5 ns error for a delay of 1 ms).
@item When using White Rabbit as the timing reference: depending on the characteristics of the grandmaster clock and the carrier used. On SPEC v 4.0 FMC carrier, the accuracy is better than 1 ns.
@end itemize

@noindent @b{Input timing:}
@itemize @bullet
@item Minimum pulse width: @math{t_{IW}} = 50 ns. Pulses below 24 ns are rejected.
@item Minimum gap between the last delayed output pulse and subsequent trigger pulse: @math{T_{LT}} = 50 ns
@item Input TDC performance: 400 ps pp accuracy, 27 ps resolution, 70 ps trigger-to-trigger rms jitter (measured at 500 kHz pulse rate)
@end itemize

@noindent @b{Output timing:}
@itemize @bullet
@item Resolution: 10 ps.
@item Accuracy (pulse generator mode): 300 ps.
@item Train generation: trains of 1-65536 pulses or continuous square wave up to 10 MHz.
@item Output-to-output jitter (outputs programmed to the same delay): 10 ps rms.
@item Output-to-output jitter (outputs programmed to to different delays, worst case): 30 ps rms.
@item Output pulse spacing (@math{T_{SP}}) : 100 ns - 16 s. Adjustable in 10 ps steps when both @math{T_{PW}}, @math{T_{GAP}} > 200 ns. Outside that range, @math{T_{SP}} resolution is limited to 4 ns.
@item Output pulse start (@math{t_{START}}) resolution: 10 ps for the rising edge of the pulse, 10 ps for subsequent pulses if the condition above is met, otherwise 4 ns.
@end itemize

@noindent @b{Delay mode specific parameters:}
@itemize @bullet
@item Delay accuracy: < 1 ns.
@item Trigger-to-output jitter: 80 ps rms.
@item Trigger-to-output delay: minimum @math{T_{DLY}} = 500 ns, maximum @math{T_{DLY}} = 120 s.
@item Maximum trigger pulse rate: @math{T_{DLY} + N*(T_{SP} + T_{GAP}) +} 100 ns, where N = number of output pulses. 
@item Trigger pulses are ignored until the output with the biggest delay has finished generation of the pulse(s).
@end itemize


@chapter Principles of operation

@b{Note:} If you are an electronics engineer, you can skip this section, as you will most likely find it rather boring.

@float
@image{drawings/analog_digital_delays, 16cm,,,.pdf}
@caption{Fig. 3. Principle of operation of analog and digital delay generators.}
@end float

Contrary to typical analog delay cards, which work by comparing an analog ramp triggered by the input pulse with a voltage proportional to the desired delay, 
@i{FmcDelay} is a digital delay generator, which relies on time tag arithmetic. The principle of operation of both generators is illustrated in figure 3.

When a trigger pulse comes to the input, @i{FmcDelay} first produces its' precise time tag using a Time-to-Digital converter (TDC). Afterwards, the time tag is summed together 
with the delay preset and the result is passed to a digital pulse generator. In its simplest form, it consists of a free running counter and a comparator. When the counter 
reaches the value provided on the input, a pulse is produced on the output. Note that in order for the system to work correctly, both the TDC and the Pulse Generator must
use exactly the same time base (not shown on the drawings).

Digital architecture brings several advantages compared to analog predecessors: Timestamps generated by the TDC can be also passed to the host system,
and the Pulse Generators can be programmed with arbitrary pulse start times instead of @math{t_{TRIG} + T_{DLY}}. Therefore, @i{FmcDelay} can be used simultaneously as 
a TDC, pulse generator or a pulse delay.

% @c ##########################################################################
@bye
