Clock generation
External reference clock
(c) Spectrum GmbH
85
External reference clock
If you have an external clock generator with a extremely stable frequency, you can use it as a reference clock. You can connect it to the
external clock connector and the PLL will be fed with this clock instead of the internal reference. The following table shows how to enable the
reference clock mode:
Due to the fact that the driver needs to know the external fed in frequency for an exact calculation of the sampling rate you must set the
SPC_REFERENCECLOCK register accordingly as shown in the table below. The driver automatically then sets the PLL to achieve the desired
sampling rate. Please be aware that the PLL has some internal limits and not all desired sampling rates may be reached with every reference
clock.
Example of reference clock:
The reference clock must be defined via the SPC_REFERENCECLOCK register prior to defining the sample rate
via the SPC_SAMPLERATE register to allow the driver to calculate the proper clock settings correctly.
Termination of the clock input
If the external connector is used as an input, either for feeding in an external reference clock or for external clocking you can enable a
50 Ohm termination on the board. If the termination is disabled, the impedance is high. Please make sure that your source is capable of
driving that current and that it still fulfills the clock input specification as given in the technical data section.
Oversampling
All fast A/D converters have a minimum clock frequency that is defined by the manufacturer of this A/D converter. You find this minimum
sampling rate specified in the technical data section as minimum external sampling clock.
When using one of the above mentioned internal clock modes the driver allows you to program sampling clocks that lie far beneath this
minimum A/D converter clock. To run the A/D converter properly we use a special oversampling mode where the A/D converter is within
its specification and only the digital part of the card is running with the slower clock. This is completely defined inside the driver and cannot
be modified by the user. The following register allows to read out the oversampling factor for further calculation
The oversampling factor is of interest for three different cases:
• When using clock output the sampling clock at the output connector is the real A/D converter clock and not the programmed slower sam-
pling rate. To calculate the output clock, please just multiply the programmed sampling clock with the oversampling factor read with the
above mentioned register.
• As all modern A/D converters have a data pipeline integrated to obtain high speed sampling together with high resolution there is a
delay between the trigger and the valid data. Our hardware compensates this delay internally as long as sampling is done synchro-
nously. When oversampling is active this compensation no longer works and data is shifted compared to the trigger position by a couple
of samples.
• When using the timestamp option the counter is also running with the real A/D converter clock and not with the programmed slower sam-
pling clock. When interpreting timestamp values it is therefore necessary to check the oversampling factor and take it into account.
Register
Value
Direction
Description
SPC_CLOCKMODE
20200
read/write
Defines the used clock mode
SPC_CM_EXTREFCLOCK
32
Enables internal PLL with external reference for sample clock generation
Register
Value
Direction
Description
SPC_REFERENCECLOCK
20140
read/write
Programs the external reference clock in the range from 1 MHz to 125 MHz.
External sampling rate in Hz as an integer value
You need to set up this register exactly to the frequency of the external fed in clock.
spcm_dwSetParam_i32 (hDrv, SPC_CLOCKMODE, SPC_CM_EXTREFCLOCK); // Set to reference clock mode
spcm_dwSetParam_i32 (hDrv, SPC_REFERENCECLOCK, 10000000); // Reference clock that is fed in is 10 MHz
spcm_dwSetParam_i32 (hDrv, SPC_SAMPLERATE, 25000000); // We want to have 25 MHz as sampling rate
Register
Value
Direction
Description
SPC_CLOCK50OHM
20120
read/write
A „1“ enables the 50 Ohm termination at the external clock connector. Only possible, when using
the external connector as an input.
Register
Value
Direction
Description
SPC_OVERSAMPLINGFACTOR
200123
read only
Returns the oversampling factor for further calculations. If oversampling isn’t active a 1 is returned.