Spectrum M3i.4830-exp, M3i.4860-exp, M3i.4840-exp, M3i.4840, M3i.4831 Hardware Manual

...
M3i.48xx
M3i.48xx-exp
high-speed 16 bit transient recorder,
A/D converter board
for PCI-X, PCI and PCI Express bus
Hardware Manual
English version November 21, 2016
SPECTRUM SYSTEMENTWICKLUNG MICROELECTRONIC GMBH · AHRENSFELDER WEG 13-17 · 22927 GROSSHANSDORF · GERMANY PHONE: +49 (0)4102-6956-0 · FAX: +49 (0)4102-6956-66 · E-MAIL: info@spec.de · INTERNET: http://www.spectrum-instrumentation.com
(c) SPECTRUM SYSTEMENTWICKLUNG MICROELECTRONIC GMBH AHRENSFELDER WEG 13-17, 22927 GROSSHANSDORF, GERMANY
SBench, digitizerNETBOX and generatorNETBOX are registered trademarks of Spectrum Systementwicklung Microelectronic GmbH.
Microsoft, Visual C++, Visual Basic, Windows, Windows 98, Windows NT, Window 2000, Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10 and Windows Server are trademarks/registered trademarks of Microsoft Corporation.
LabVIEW, DASYLab, Diadem and LabWindows/CVI are trademarks/registered trademarks of National Instruments Corporation.
MATLAB is a trademark/registered trademark of The Mathworks, Inc.
Keysight VEE, VEE Pro and VEE OneLab are trademarks/registered trademarks of Keysight Technologies, Inc.
FlexPro is a registered trademark of Weisang GmbH & Co. KG.
PCIe, PCI Express, PCI-X and PCI-SIG are trademarks of PCI-SIG.
PICMG and CompactPCI are trademarks of the PCI Industrial Computation Manufacturers Group.
PXI is a trademark of the PXI Systems Alliance.
LXI is a registered trademark of the LXI Consortium.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation.
AMD and Opteron are trademarks or registered trademarks of Advanced Micro Devices.
Introduction....................................................................................................................... 8
Preface ............................................................................................................................................................................... 8
Overview ............................................................................................................................................................................ 8
General Information ............................................................................................................................................................. 8
Different models of the M3i.48xx series .................................................................................................................................. 9
Additional options.............................................................................................................................................................. 10
Star-Hub...................................................................................................................................................................... 10
BaseXIO (versatile digital I/O) ....................................................................................................................................... 10
The Spectrum type plate ...................................................................................................................................................... 11
Hardware information......................................................................................................................................................... 12
Block diagram.............................................................................................................................................................. 12
Technical Data ............................................................................................................................................................. 13
Dynamic Parameters .................................................................................................................................................... 15
Order Information......................................................................................................................................................... 16
Hardware Installation ..................................................................................................... 17
System Requirements .......................................................................................................................................................... 17
Warnings.......................................................................................................................................................................... 17
ESD Precautions ........................................................................................................................................................... 17
Cooling Precautions...................................................................................................................................................... 17
Sources of noise ........................................................................................................................................................... 17
Installing the board in the system.......................................................................................................................................... 18
Installing a single board without any options.................................................................................................................... 18
Installing a board with digital inputs/outputs mounted on an extra bracket .......................................................................... 20
Installing a board with option BaseXIO ........................................................................................................................... 21
Installing multiple boards synchronized by star-hub option ................................................................................................. 22
Software Driver Installation............................................................................................. 23
Interrupt Sharing ................................................................................................................................................................ 23
Important Notes on Driver Versions 2.22 and Control Center 1.41 and newer .......................................................................... 23
Windows 2000 ................................................................................................................................................................. 24
Installation ................................................................................................................................................................... 24
Version control ............................................................................................................................................................. 24
Driver - Update............................................................................................................................................................. 25
Windows XP 32 (64 Bit discontinued)................................................................................................................................... 26
Installation ................................................................................................................................................................... 26
Version control ............................................................................................................................................................. 26
Driver - Update............................................................................................................................................................. 27
Windows 7, 32/64 Bit....................................................................................................................................................... 28
Installation ................................................................................................................................................................... 28
Version control ............................................................................................................................................................. 29
Driver - Update............................................................................................................................................................. 29
Linux................................................................................................................................................................................. 30
Overview .................................................................................................................................................................... 30
Standard Driver Installation............................................................................................................................................ 30
Standard Driver Update ................................................................................................................................................ 31
Compilation of kernel driver sources (option) ................................................................................................................... 31
Update of self compiled kernel driver .............................................................................................................................. 31
Library only ................................................................................................................................................................. 31
Control Center ............................................................................................................................................................. 32
3
Software ......................................................................................................................... 33
Software Overview............................................................................................................................................................. 33
Card Control Center ........................................................................................................................................................... 33
Discovery of Remote Cards and digitizerNETBOX/generatorNETBOX products.................................................................... 34
Wake On LAN of digitizerNETBOX/generatorNETBOX .................................................................................................... 34
Netbox Monitor ........................................................................................................................................................... 34
Hardware information................................................................................................................................................... 35
Firmware information .................................................................................................................................................... 35
Driver information......................................................................................................................................................... 36
Installing and removing Demo cards ............................................................................................................................... 36
Feature upgrade........................................................................................................................................................... 36
Software License upgrade.............................................................................................................................................. 36
Performing card calibration ........................................................................................................................................... 37
Performing memory test ................................................................................................................................................. 37
Transfer speed test........................................................................................................................................................ 37
Debug logging for support cases .................................................................................................................................... 38
Device mapping........................................................................................................................................................... 38
Firmware upgrade........................................................................................................................................................ 39
Accessing the hardware with SBench 6................................................................................................................................. 39
C/C++ Driver Interface....................................................................................................................................................... 40
Header files ................................................................................................................................................................. 40
General Information on Windows 64 bit drivers............................................................................................................... 40
Microsoft Visual C++ 6.0 and 2005 32 Bit ..................................................................................................................... 40
Microsoft Visual C++ 64 Bit........................................................................................................................................... 41
Borland C++ Builder 32 Bit ........................................................................................................................................... 41
Linux Gnu C/C++ 32/64 Bit ......................................................................................................................................... 41
C++ for .NET............................................................................................................................................................... 41
Other Windows C/C++ compilers 32 Bit ........................................................................................................................ 41
Other Windows C/C++ compilers 64 Bit ........................................................................................................................ 41
National Instruments LabWindows/CVI........................................................................................................................... 42
Driver functions .................................................................................................................................................................. 42
Borland Delphi (Pascal) Programming Interface ...................................................................................................................... 47
Driver interface ............................................................................................................................................................ 47
Examples..................................................................................................................................................................... 48
Visual Basic Programming Interface and Examples ................................................................................................................. 49
Driver interface ............................................................................................................................................................ 49
Examples..................................................................................................................................................................... 50
.NET programming languages ............................................................................................................................................. 51
Library ........................................................................................................................................................................ 51
Declaration.................................................................................................................................................................. 51
Using C#..................................................................................................................................................................... 51
Using Managed C++/CLI.............................................................................................................................................. 52
Using VB.NET .............................................................................................................................................................. 52
Using J# ...................................................................................................................................................................... 52
Python Programming Interface and Examples......................................................................................................................... 53
Driver interface ............................................................................................................................................................ 53
Examples..................................................................................................................................................................... 54
Programming the Board .................................................................................................. 55
Overview .......................................................................................................................................................................... 55
Register tables ................................................................................................................................................................... 55
Programming examples....................................................................................................................................................... 55
Initialization....................................................................................................................................................................... 56
Initialization of Remote Products........................................................................................................................................... 56
Error handling.................................................................................................................................................................... 56
Gathering information from the card..................................................................................................................................... 57
Card type.................................................................................................................................................................... 57
Hardware version......................................................................................................................................................... 58
Production date ............................................................................................................................................................ 58
Last calibration date (analog cards only) ......................................................................................................................... 58
Serial number .............................................................................................................................................................. 58
Maximum possible sampling rate ................................................................................................................................... 59
Installed memory .......................................................................................................................................................... 59
Installed features and options ......................................................................................................................................... 59
Miscellaneous Card Information ..................................................................................................................................... 60
Function type of the card ............................................................................................................................................... 60
Used type of driver ....................................................................................................................................................... 60
Reset................................................................................................................................................................................. 62
4
Analog Inputs.................................................................................................................. 63
Channel Selection .............................................................................................................................................................. 63
Important note on channels selection............................................................................................................................... 63
Setting up the inputs ........................................................................................................................................................... 64
Input Path .................................................................................................................................................................... 64
Input ranges................................................................................................................................................................. 64
Read out of input features .............................................................................................................................................. 65
Input termination........................................................................................................................................................... 66
Input coupling .............................................................................................................................................................. 66
AC/DC offset compensation .......................................................................................................................................... 66
Anti aliasing filter (Bandwidth limit)................................................................................................................................. 66
Enhanced Status Register............................................................................................................................................... 67
Automatic on-board calibration of the offset and gain settings............................................................................................ 67
Acquisition modes ........................................................................................................... 68
Overview .......................................................................................................................................................................... 68
Setup of the mode ........................................................................................................................................................ 68
Commands........................................................................................................................................................................ 68
Card Status.................................................................................................................................................................. 69
Acquisition cards status overview ................................................................................................................................... 70
Generation card status overview .................................................................................................................................... 70
Data Transfer ............................................................................................................................................................... 70
Standard Single acquisition mode ........................................................................................................................................ 72
Card mode.................................................................................................................................................................. 73
Memory, Pre- and Posttrigger ......................................................................................................................................... 73
Example ...................................................................................................................................................................... 73
FIFO Single acquisition mode .............................................................................................................................................. 73
Card mode.................................................................................................................................................................. 73
Length and Pretrigger.................................................................................................................................................... 73
Difference to standard single acquisition mode................................................................................................................. 74
Example FIFO acquisition .............................................................................................................................................. 74
Limits of pre trigger, post trigger, memory size ................................................................................................................. 74
Buffer handling .................................................................................................................................................................. 75
Data organisation .............................................................................................................................................................. 79
Sample format ................................................................................................................................................................... 79
Converting ADC samples to voltage values............................................................................................................................ 79
Clock generation ............................................................................................................. 80
Overview .......................................................................................................................................................................... 80
The different clock modes .............................................................................................................................................. 80
Clock Mode Register..................................................................................................................................................... 80
Details on the different clock modes...................................................................................................................................... 81
Standard internal sampling clock (PLL)............................................................................................................................. 81
Using Quartz2 with PLL (optional, M4i cards only)............................................................................................................ 81
External clock (reference clock) ...................................................................................................................................... 82
Trigger modes and appendant registers .......................................................................... 83
General Description............................................................................................................................................................ 83
Trigger Engine Overview..................................................................................................................................................... 83
Multi Purpose I/O Lines....................................................................................................................................................... 84
Programming the behaviour........................................................................................................................................... 84
Using asynchronous I/O ............................................................................................................................................... 84
Special behaviour of trigger output ................................................................................................................................. 85
Special direct trigger output modes................................................................................................................................. 85
Trigger masks .................................................................................................................................................................... 86
Trigger OR mask .......................................................................................................................................................... 86
Trigger AND mask........................................................................................................................................................ 87
Software trigger ................................................................................................................................................................. 88
Force- and Enable trigger .................................................................................................................................................... 88
Trigger delay ..................................................................................................................................................................... 89
External (analog) trigger ..................................................................................................................................................... 90
Trigger Mode............................................................................................................................................................... 90
Trigger Input Coupling .................................................................................................................................................. 91
Trigger level................................................................................................................................................................. 91
Detailed description of the external analog trigger modes ................................................................................................. 91
External (TTL) trigger using multi purpose I/O connectors ........................................................................................................ 96
TTL Trigger Mode ......................................................................................................................................................... 96
Edge and level triggers ................................................................................................................................................. 96
Channel Trigger ................................................................................................................................................................. 98
Overview of the channel trigger registers......................................................................................................................... 98
Channel trigger level..................................................................................................................................................... 99
Detailed description of the channel trigger modes........................................................................................................... 100
5
Mode Multiple Recording ............................................................................................... 104
Recording modes ............................................................................................................................................................. 104
Standard Mode.......................................................................................................................................................... 104
FIFO Mode ................................................................................................................................................................ 104
Limits of pre trigger, post trigger, memory size ............................................................................................................... 105
Multiple Recording and Timestamps.............................................................................................................................. 105
Trigger Modes ................................................................................................................................................................. 105
Trigger Counter.......................................................................................................................................................... 105
Programming examples..................................................................................................................................................... 106
Timestamps ................................................................................................................... 107
General information ......................................................................................................................................................... 107
Example for setting timestamp mode: ............................................................................................................................ 107
Timestamp modes............................................................................................................................................................. 108
Standard mode .......................................................................................................................................................... 108
StartReset mode.......................................................................................................................................................... 108
Refclock mode............................................................................................................................................................ 109
Reading out the timestamps ............................................................................................................................................... 110
General..................................................................................................................................................................... 110
Data Transfer using DMA ............................................................................................................................................ 110
Data Transfer using Polling .......................................................................................................................................... 112
Comparison of DMA and polling commands.................................................................................................................. 113
Data format ............................................................................................................................................................... 113
Combination of Memory Segmentation Options with Timestamps ........................................................................................... 114
Multiple Recording and Timestamps.............................................................................................................................. 114
Example Multiple Recording and Timestamps................................................................................................................. 115
ABA Mode and Timestamps......................................................................................................................................... 115
ABA mode (dual timebase) ............................................................................................ 116
General information ......................................................................................................................................................... 116
Standard Mode.......................................................................................................................................................... 116
FIFO Mode ................................................................................................................................................................ 117
Limits of pre trigger, post trigger, memory size ............................................................................................................... 117
Example for setting ABA mode: .................................................................................................................................... 118
Reading out ABA data ...................................................................................................................................................... 118
General..................................................................................................................................................................... 118
Data Transfer using DMA ............................................................................................................................................ 119
Data Transfer using Polling .......................................................................................................................................... 120
Comparison of DMA and polling commands.................................................................................................................. 121
ABA Mode and Timestamps......................................................................................................................................... 121
Option BaseXIO............................................................................................................. 123
Introduction ..................................................................................................................................................................... 123
Different functions............................................................................................................................................................. 123
Asynchronous Digital I/O............................................................................................................................................ 123
Special Input Functions................................................................................................................................................ 124
Transfer Data ............................................................................................................................................................. 124
Programming Example ................................................................................................................................................ 124
Special Sampling Feature ............................................................................................................................................ 124
Electrical specifications................................................................................................................................................ 125
Option Star-Hub (M3i and M4i only) .............................................................................. 126
Star-Hub introduction ........................................................................................................................................................ 126
Star-Hub trigger engine ............................................................................................................................................... 126
Star-Hub clock engine ................................................................................................................................................. 126
Software Interface ............................................................................................................................................................ 126
Star-Hub Initialization.................................................................................................................................................. 126
Setup of Synchronization............................................................................................................................................. 128
Setup of Trigger ......................................................................................................................................................... 128
Run the synchronized cards ......................................................................................................................................... 129
SH-Direct: using the Star-Hub clock directly without synchronization.................................................................................. 130
Error Handling ........................................................................................................................................................... 130
Option Remote Server ................................................................................................... 131
Introduction ..................................................................................................................................................................... 131
Installing and starting the Remote Server ............................................................................................................................. 131
Windows .................................................................................................................................................................. 131
Linux......................................................................................................................................................................... 131
Accessing remote cards .................................................................................................................................................... 131
6
Appendix ...................................................................................................................... 132
Error Codes..................................................................................................................................................................... 132
Continuous memory for increased data transfer rate ............................................................................................................. 134
Background ............................................................................................................................................................... 134
Setup on Windows systems.......................................................................................................................................... 134
Setup on Linux systems ................................................................................................................................................ 134
Usage of the buffer ..................................................................................................................................................... 135
Details on M3i cards I/O lines........................................................................................................................................... 136
Multi Purpose I/O Lines............................................................................................................................................... 136
Interfacing with clock input .......................................................................................................................................... 136
Interfacing with clock output......................................................................................................................................... 136
7
Preface Introduction

Introduction

Preface

This manual provides detailed information on the hardware features of your Spectrum instrumentation board. This information includes tech­nical data, specifications, block diagram and a connector description.
In addition, this guide takes you through the process of installing your board and also describes the installation of the delivered driver package for each operating system.
Finally this manual provides you with the complete software information of the board and the related driver. The reader of this manual will be able to integrate the board in any PC system with one of the supported bus and operating systems.
Please note that this manual provides no description for specific driver parts such as those for LabVIEW or MATLAB. These drivers manuals are available on CD or on the Spectrum website.
For any new information on the board as well as new available options or memory upgrades please contact our website http://www.spectrum-instrumentation.com. You will also find the current driver package with the latest bug fixes and new features on our site.
Please read this manual carefully before you install any hardware or software. Spectrum is not responsible for any hardware failures resulting from incorrect usage.

Overview

The PCI bus was first introduced in 1995. Nowadays it is the most common platform for PC based instrumentation boards. The very wide range of installations world-wide, especially in the consumer market, makes it a platform of good value. Its successor is the 2004 introduced PCI Express standard. In today’s standard PC there are usually two to three slots of both standards available for
instrumentation boards. Special industrial PCs offer up to a maximum of 20 slots. The common PCI/PCI-X bus with data rates of up to 133 MHz x 64 bit = 1 GByte/s per bus, is more and more replaced by the PCI Express standard with up to 4 GByte/s data transfer rate per slot. The Spectrum M3i boards are available in two versions, for PCI/PCI-X as well as for PCI Express. The 100% software compatible standards allow to combine both standards in one system with the same driver and software commands.
Within this document the name M3i is used as a synonym for both versions, either PCI/PCI-X or PCI Express. Only passages that differ concerning the bus version of the M3i.xxxx and M3i.xxxx-exp cards are mentioned separately. Also all card drawings will show the PCI/PCI-X version as example if no differences exist compared to the PCI Express version.

General Information

The M3i.48xx is best suitable for applications that need ultra high sample rates as well as a maximum possible resolution. These boards offer a resolution 4 times higher than 14 bit boards and even 16 times higher than 12 bit boards.
On the M3i.48xx every channel has its own amplifier and A/D converter. Each input channel can be adapted to a wide variety of signal sources. This is done by software selecting a matching input path, input range, input impedance, input coupling and anti-aliasing filter. The user will easily find a matching solution from the six offered models. These versions are working with sample rates of 65 MS/s up to 180 MS/ s and have one or two channels and can also be updated to a multi-channel system using the internal synchronization bus.
Data is written in the internal up to 2 GSample large memory. This memory can also be used as a FIFO buffer. In FIFO mode data will be transferred online into the PC RAM or to hard disk.
Application examples: Automatic test systems, Supersonics, CCD imaging systems, Vibration analysis, Radar, Sonar.
8 M3i.48xx / M3i.48xx-exp Manual
Introduction Different models of the M3i.48xx series

Different models of the M3i.48xx series

The following overview shows the different available models of the M3i.48xx series. They differ in the number of available channels. You can also see the model dependent location of the input connectors.
• M3i.4830
• M3i.4840
• M3i.4860
• M3i.4830-exp
• M3i.4840-exp
• M3i.4860-exp
• M3i.4831
• M3i.4841
• M3i.4861
• M3i.4831-exp
• M3i.4841-exp
• M3i.4861-exp
(c) Spectrum GmbH 9
Additional options Introduction

Additional options

Star-Hub

The star hub piggy-back module al­lows the synchronization of up to 8 M3i cards. It is possible to synchro­nize cards of the same type with each other as well as different types.
Two different versions of the star-hub module are available. A minor one for synchronizing up to four boards of the M3i series, without the need for an additional system slot. The major version (option SH8) allows the syn­chronization of up to 8 cards with the need for an additional slot.
The module acts as a star hub for clock and trigger signals. Each board is connected with a small cable of the same length, even the master board. That minimizes the clock skew be­tween the different cards. The figure shows the piggy-back module mounted on the base board schematically without any cables to achieve a better visibility. It also shows the locations of the available connectors for the two different versions of the star-hub option.
The carrier card acts as the clock master and the same or any other card can be the trigger master. All trigger modes that are available on the master card are also available if the synchronization star-hub is used.
The cable connection of the boards is automatically recognized and checked by the driver when initializing the star-hub module. So no care must be taken on how to cable the cards. The star-hub module itself is handled as an additional device just like any other card and the pro­gramming consists of only a few additional commands.

BaseXIO (versatile digital I/O)

The option BaseXIO is simple-to-use enhancement to the cards of the M3i series. It is possible to control a wide range of external instruments or other equipment by using the eight lines as asynchronous digital I/O. The BaseXIO option is useful if an external amplifier should be control­led, any kind of signal source must be programmed, if status informati­on from an external machine has to be obtained or different test signals have to be routed to the board. In addition to the I/O features, these lines are also for special functions. One line can be used as an refe­rence time signal (RefClock) for the timestamp option. The BaseXIO MMCX connectors are mounted on-board. To gain easier access, these lines are connected to an extra bracket, that holds eight SMB male connectors. For special purposes this option can also be ordered without the extra bracket and instead with internal cables.
10 M3i.48xx / M3i.48xx-exp Manual
Introduction The Spectrum type plate

The Spectrum type plate

The Spectrum type plate, which consists of the following components, can be found on all of our boards. Please check whether the printed information is the same as the information on your delivery note. All this information can also be read out by software:
The board type, consisting of the two letters describing the bus (in this case M2i for the PCI-X bus) and the model number.
The size of the on-board installed memory in MSample or GSample. In this example there are 1 GS = 1024 MSample (2 GByte =
2048 MByte) installed.
The serial number of your Spectrum board. Every board has a unique serial number.
A list of the installed options. A complete list of all available options is shown in the order information. In this example the options
Multiple recording, Gated Sampling, Timestamp and Star-Hub 5 are installed.
The base card version, consisting of the hardware version (the part before the dot) and the firmware version (the part after the dot).
The version of the analog/digital front-end module. Consisting of the hardware version (the part before the dot) and the firmware
version (the part after the dot)
The date of production, consisting of the calendar week and the year.
The version of the extension module if one is installed. Consisting of the hardware version (the part before the dot) and the firmware
version (the part after the dot). In our example we have the Star-Hub 5 extension module installed. Therefore the version of the ex-
tension module is filled on the type plate. If no extension module is installed this part is left open.
Please always supply us with the above information, especially the serial number in case of support request. That allows us to answer your questions as soon as possible. Thank you.
(c) Spectrum GmbH 11
Hardware information Introduction

Hardware information

Block diagram

12 M3i.48xx / M3i.48xx-exp Manual
Introduction Hardware information

Technical Data

Analog Inputs
Resolution 16 bit Input Type Single-ended Programmable Input Offset not available ADC Differential non linearity (DNL) ADC only 1.0 LSB ADC Integral non linearity (INL) ADC only 4.0 LSB Channel selection software programmable 1 or 2 channels (maximum is model dependent) Bandwidth filter 4830, 4831 activate by software 10 MHz bandwidth with 3rd order Butterworth filtering Bandwidth filter 4840, 4841, 4860, 4861 activate by software 20 MHz bandwidth with 3rd order Butterworth filtering
Input Path Types software programmable Analog Input impedance software programmable
50 (HF) Path
50 1 M || 25 pF or 50
Buffered (high impedance) Path
Input Ranges software programmable ±500 mV, ±1 V, ±2.5 V, ±5 V ±200 mV, ±500 mV, ±1 V, ±2 V, ±5 V, ±10 V Input Coupling software programmable AC/DC AC/DC Offset error (full speed) after warm-up and calibration 0.1% 0.1% Gain error (full speed) after warm-up and calibration ≤ 1.0% ≤ 0.1% Over voltage protection range ±1V 2 Vrms Over voltage protection range ±2V 6 Vrms
±5 V (1 MΩ), 5 Vrms (50 Ω)
±30 V (1 MΩ), 5 Vrms (50 Ω) Max DC voltage if AC coupling active ±30 V ±30 V Relative input stage delay 0 ns 3.8 ns Crosstalk 1 MHz sine signal input range ±1 V not available -100 dB Crosstalk 20 MHz sine signal input range ±1 V not available -100 dB Crosstalk 1 MHz sine signal input range ±5 V -110 dB -92 dB Crosstalk 20 MHz sine signal input range ±5 V -102 dB -92 dB
Trigger
Available trigger modes software programmable Channel Trigger, Ext0 (Analog), Ext1 (TT), Software, Window, Re-Arm, Or/And, Delay Trigger level resolution software programmable 10 bits Trigger edge software programmable Rising edge, falling edge or both edges Trigger delay software programmable 0 to (8GSamples - 8) = 8589934584 Samples in steps of 8 samples Multi, Gate: re-arming time 32 samples (+ programmed pretrigger) Pretrigger at Multi, ABA, Gate, FIFO software programmable 8 up to [8192 Samples / number of active channels] in steps of 8 Posttrigger software programmable 8 up to 4 GSamples in steps of 8(defining pretrigger in standard scope mode) Memory depth software programmable 16 up to [installed memory / number of active channels] samples in steps of 8 Multiple Recording/ABA segment size software programmable 16 up to [installed memory / 2 / active channels] samples in steps of 16 Trigger output delay after trigger input 134 sampling clock cycles Internal/External trigger accuracy 1 sample
External trigger Ext0 (Trg) Ext1 (X0) + Ext2 (X1) External trigger impedance software programmable
50 /1 M || 25 pF 10 k to 3.3 V External trigger coupling software programmable AC or DC fixed DC Minimum trigger pulse width (DC / AC) 2 samples 2 samples External trigger bandwidth DC External trigger bandwidth AC
50 /1 M 50
DC to 200 MHz / 150 MHz DC to 125 MHz
20 kHz to 200 MHz n.a. External trigger type Window comparator, ±5 V TTL level
External trigger level software programmable 2 levels ±5V in steps of 1 mV fixed: Low: 0.8 V, High: 2.0 V External trigger maximum voltage
5V rms (50 External trigger output impedance input only
Ω), ±30V (1 MΩ)
-0.3 V to +5.5V
50
External trigger output levels input only Low: ≤0.4 V, High: ≥2.4 V External trigger output type input only 3.3 V LVTTL.TTL compatible for high impedance External trigger output drive strength input only
Capable of driving 50
loads, ±64 mA output
Clock
Clock Modes software programmable internal, external reference clock, sync Internal clock accuracy ±32 ppm Internal clock setup granularity 1 Hz (except the clock setup gaps shwon below) Clock setup range gaps clock not programmable 70 MHz to 72 MHz, 140 MHz to 144 MHz, 281 MHz to 287 MHz External reference clock range software programmable 10 MHz and 1 GHz (fix at runtime) External reference clock setup granilarity 1 kHz External clock input impedance software programmable
External clock input coupling AC coupling External clock input edge Rising edge External clock input to internal ADC clock delay 3.7 ns (8.2 ns if synchronization is used) External clock input type Single-ended, sine wave or square wave External clock input swing 0.3 V peak-peak up to 3.0 V peak-peak External clock input max DC voltage ±30 V (with max 3.0 V difference between low and high level) External clock input duty cycke requirement 40% to 60% External clock output type Single-ended, 3.3V LVPECL External clock output coupling AC coupling ABA mode clock divider for slow clock software programmable 8 up to [128k - 8] in steps of 8
50 fixed
(c) Spectrum GmbH 13
Hardware information Introduction
min sampling clock 9 MS/s 9 MS/s 9 MS/s 9 MS/s 9 MS/s 9 MS/s
M3i.4830 M3i.4831 M3i.4840 M3i.4841 M3i.4860 M3i.4861
max internal clock (1 channel active) 65 MS/s 65 MS/s 105 MS/s 105 MS/s 180 MS/s 180 MS/s max internal clock (2 channels active) n.a. 65 MS/s n.a. 105 MS/s n.a. 180 MS/s lower bandwidth limit (DC coupling) 0 Hz 0 Hz 0 Hz 0 Hz 0 Hz 0 Hz lower bandwidth limit (AC coupled, 50 Ohm) <30 kHz <30 kHz <30 kHz <30 kHz <30 kHz <30 kHz lower bandwidth limit (AC coupled, 1 MOhm) <2 Hz <2 Hz <2 Hz <2 Hz <2 Hz <2 Hz
-3 dB bandwidth (buffered path) 30 MHz 30 MHz 45 MHz 45 MHz 70 MHz 70 MHz
-3 dB bandwidth (50 ohm path) 35 MHz 35 MHz 50 MHz 50 MHz 90 MHz 90 MHz
-3 dB bandwidth (BW limit enabled) 10 MHz 10 MHz 20 MHz 20 MHz 20 MHz 20 MHz
Multi Purpose I/O lines (front-plate)
Number of multi purpose lines two, named X0, X1 Input: available signal types software programmable Trigger-In, Asynchronous Digital-In, Synchrounous Digital-In, Timestamp Reference Clock Input: impedance
10 k to 3.3 V Input: maximum voltage level -0.3 V to +5-5V Input: signal levels Low: 0.8 V, High: 2.0 V Output: available signal types software programmable Asynchronous Digital-Out, Trigger Output, Run, Arm Output: impedance
50 Output: signal levels Low: 0.4 V, High: 2.4 V Output: type 3.3 V LVTTL, TTL compatible for high impedance loads Output: drive strength
Capable of driving 50 loads, maximum strength ±64 mA
BaseXIO Option
BaseXIO modes software programmable Asynch digital I/O, 2 additional trigger, timestamp reference clock, timestamp digital inputs BaseXIO direction software programmable Each 4 lines can be programmed in direction BaseXIO input TTL compatible: Low 0.8 V, High 2.0 V BaseXIO input impedance 4.7 kOhm towards 3.3 V BaseXIO input maximum voltage -0.5 V up to +5.5 V BaseXIO output type 3.3 V LVTLL BaseXIO output levels TTL compatible: Low 0.4 V, High 2.4 V BaseXIO output drive strength
32 mA maximum current, no 50 loads
Connectors (Standard Card)
Analog Inputs 3 mm SMB male (one for each single-ended input) Cable-Type: Cab-3f-xx-xx Trigger Ext0 Input 1 x MMCX female (one connector) Cable-Type: Cab-1m-xx-xx Clock Input/Output 2 x MMCX female (two connectors) Cable-Type: Cab-1m-xx-xx Multi Purpose X0 and X1 2 x MMCX female (two connectors) Cable-Type: Cab-1m-xx-xx Option BaseXIO 8 x 3 mm SMB male on extra bracket, internally 8 x MMCX female
Connectors (Option M3i.xxxx-SMA)
Analog Inputs SMA female (one for each single-ended input) Cable-Type: Cab-3mA-xx-xx Trigger, Clock I/O, Multi Purpose X0 signals specified at order time 2 x SMA female (two connectors) Cable-Type: Cab-3mA-xx-xx Option BaseXIO 8 x 3 mm SMB male on extra bracket, internally 8 x MMCX female
Connectors (Option M3i.xxxx-SMAM)
Analog Inputs SMA female (one for each single-ended input) Cable-Type: Cab-3mA-xx-xx Trigger Ext0 Input 1 x MMCX female (one connector) Cable-Type: Cab-1m-xx-xx Clock Input/Output 2 x MMCX female (two connectors) Cable-Type: Cab-1m-xx-xx Multi Purpose X0 and X1 2 x MMCX female (two connectors) Cable-Type: Cab-1m-xx-xx Option BaseXIO 8 x 3 mm SMB male on extra bracket, internally 8 x MMCX female
Environmental and Physical Details
Dimension (PCB only) 312 mm x 107 mm (full PCI length) Width (Standard or star-hub 4) 1 full size slot Width (star-hub 8) additionally back of adjacent neighbour slots Width (with option BaseXIO) additionally extra bracket on neighbour slot Weight plain card 320 g Weight plain card + option SH4 380g Weight plain card + option SH8 400g Warm up time 10 minutes Operating temperature 0°C to 50°C Storage temperature -10°C to 70°C Humidity 10% to 90%
14 M3i.48xx / M3i.48xx-exp Manual
Introduction Hardware information
PCI/PCI-X specific details
PCI / PCI-X bus slot type 32 bit 33 MHz or 32 bit 66 MHz PCI / PCI-X bus slot compatibility 32/64 bit, 33-133 MHz, 3,3 V and 5 V I/O
PCI Express specific details
PCIe slot type x1 Generation 1 PCIe slot compatibility x1/x4/x8/x16 (Some x16 PCIe slots are for graphic cards only and can not be used)
Certification, Compliance, Warranty
EMC Immunity Compliant with CE Mark EMC Emission Compliant with CE Mark Product warranty 2 years starting with the day of delivery Software and firmware updates Life-time, free of charge
Power Consumption
PCI / PCI-X PCI EXPRESS
3.3 V 5 V Total 3.3V 12V Total
M3i.48x1 (256 MS memory) 1.9 A 2.6 A 19.3 W 0.4 A 1.9 A 24.1 W M3i.48x1 (2 GSamples memory), max power 3.0 A 2.6 A 22.9 W 0.4 A 2.5 A 31.3 W
MTBF
MTBF 200000 hours

Dynamic Parameters

Input Path HF path, AC coupled, fixed 50 Ohm Buffered path, BW limit Buffered path, full BW Test signal frequency 1 MHz 10 MHz 40 MHz 10 MHz 1 MHz 10 MHz 40 MHz Input Range ±1V ±500mV ±1V ±1V ±200mV ±500mV ±1V ±500mV ±500mV ±500mV RMS Noise (zero level) 8.0 LSB ≤ 10.0 LSB 10.0 LSB THD (typ) (dB) -80.6 -79.2 -79.3 -77.8 -77.4 -77.7 -75.3 -83.4 -77.7 -47.8 SNR (typ) (dB) 73.173.373.471.971.472.873.171.172.868.6 SFDR (typ), excl. harm. (dB) 92.4 96.0 96.8 87.8 95.8 96.8 96.7 87.6 96.4 88.2 SFDR (typ), incl. harm. (dB) 81.1 80.5 80.5 78.8 79.0 78.7 76.2 85.2 79.0 48.0 SINAD/THD+N (typ) (dB) 72.4 72.3 72.3 70.9 70.4 71.6 73.1 70.9 71.6 47.8 ENOB based on SINAD (bit)11.711.711.711.511.411.611.511.511.6 7.6 ENOB based on SNR (bit) 11.911.911.911.711.611.811.811.511.811.1
Input Path HF path, AC coupled, fixed 50 Ohm Buffered path, BW limit Buffered path, full BW Test signal frequency 1 MHz 10 MHz 10 MHz 1 MHz 10 MHz Input Range ±1V ±500mV ±1V ±200mV ±500mV ±1V ±500mV ±500mV RMS Noise (zero level) 7.0 LSB ≤ 10.0 LSB 10.0 LSB THD (typ) (dB) -86.0 -87.3 -88.0 -83.0 -82.1 -76.2 -85.0 -79.8 SNR (typ) (dB) 74.5 74.7 74.7 71.7 73.9 74.2 73.1 73.0 SFDR (typ), excl. harm. (dB) 93.0 97.0 97.1 92.8 93.5 93.1 92.5 96.3 SFDR (typ), incl. harm. (dB) 86.5 91.5 91.7 85.3 85.1 79.0 87.5 81.5 SINAD/THD+N (typ) (dB) 74.2 74.5 74.5 71.4 73.3 72.1 72.8 72.2 ENOB based on SINAD (bit) 12.0 12.1 12.1 11.6 11.9 11.7 11.8 11.7 ENOB based on SNR (bit) 12.1 12.1 12.1 11.6 12.0 12.0 11.9 11.8
Input Path HF path, AC coupled, fixed 50 Ohm Buffered path, BW limit Buffered path, full BW Test signal frequency 1 MHz 10 MHz 10 MHz 1 MHz 10 MHz Input Range ±1V ±500mV ±1V ±200mV ±500mV ±1V ±500mV ±500mV RMS Noise (zero level) 5.0 LSB 9.0 LSB 9.0 LSB THD (typ) (dB) -85.0 -86.2 -86.2 -83.5 -80.8 -76.5 -84.1 -80.4 SNR (typ) (dB) 75.0 75.4 75.2 72.3 74.6 74.8 73.8 74.2 SFDR (typ), excl. harm. (dB) 94.5 92.0 90.8 88.5 91.4 90.7 88.3 91.0 SFDR (typ), incl. harm. (dB) 81.5 87.7 87.5 84.7 83.3 78.8 85.2 81.5 SINAD/THD+N (typ) (dB) 74.6 75.1 74.9 72.0 73.7 72.6 73.4 73.4 ENOB based on SINAD (bit) 12.0 12.2 12.2 11.7 11.9 11.8 11.9 11.9 ENOB based on SNR (bit) 12.2 12.2 12.2 11.7 12.1 12.1 12.0 12.0
M3i.4861 and M3i.4860, 1 or 2 channels 180 MS/s
M3i.4841 and M3i.4840, 1 or 2 channels 105 MS/s
M3i.4831 and M3i.4830, 1 or 2 channels 65 MS/s
A pure sine wave with > 99% amplitude of input range is measured with 50 ohms termination. SNR and RMS noise parameters may differ depending on the quality of the used PC. SNR = Signal to Noise Ratio, THD = Total Harmonic Distortion, SFDR = Spurious Free Dynamic Range, SINAD = Signal Noise and Distortion, ENOB = Effective Number of Bits. Depending on the test signal frequency different filter types are used: 1 MHz signal = 7th order low pass, 10 MHz signal = 6th order band pass, 40 MHz signal = 6th order bandpass.
(c) Spectrum GmbH 15
Hardware information Introduction

Order Information

The card is delivered with 256 MSample on-board memory and supports standard acquisition (Scope), FIFO acquisition (streaming), Multiple Recording, ABA mode and Timestamps. Operating system drivers for Windows/Linux 32 bit and 64 bit, examples for C/C++, LabVIEW (Windows), MATLAB (Windows and Linux), LabWindows/CVI, IVI, .NET, Delphi, Visual Basic, Java, Python and a Base license of the oscil­loscope software SBench 6 are included. Drivers for other 3rd party products like VEE or DASYLab may be available on request.
Adapter cables are not included. Please order separately!
.
PCI/PCI-X PCI Express
.
Memory
Options
Services
Standard Cables
Low Loss Cables
Amplifiers
Software SBench6
Software Options
(1) : Just one of the options can be installed on a card at a time. (2) : Third party product with warranty differing from our export conditions. No volume rebate possible.
PCI Express PCI/PCI-X Standard mem 1 channel 2 channels
M3i.4830-exp M3i.4830 256 MSample 65 MS/s
M3i.4831-exp M3i.4831 256 MSample 65 MS/s 65 MS/s M3i.4840-exp M3i.4840 256 MSample 105 MS/s M3i.4841-exp M3i.4841 256 MSample 105 MS/s 105 MS/s M3i.4860-exp M3i.4860 256 MSample 180 MS/s M3i.4861-exp M3i.4861 256 MSample 180 MS/s 180 MS/s
Order no. Option
M3i.xxxx-512MS Memory upgrade to 512 MSample (1 GB) total memory M3i.xxxx-1GS Memory upgrade to 1 GSample (2 GB) total memory
Order no. Option
M3i.xxxx-SH4 Synchronization Star-Hub for up to 4 cards, only 1 slot width M3i.xxxx-SH8 Synchronization Star-Hub for up to 8 cards, 2 slots width M3i.xxxx-bxio Option BaseXIO: 8 digital I/O lines usable as asynchronous I/O and timestamp ref-clock, additional
M3i.xxxx-SMA Option SMA connections for all analog inputs + two control signals (fixed at order time):
M3i.xxxx-SMAM Option SMA connections for all analog inputs + MMCX connections for all control signals (clock I/O,
bracket with 8 SMB connectors
- SMA connection XA: Trigger-In or Trigger-Out/Multi Purpose X0
- SMA connection XB: Trigger-In or Clock In or Clock-Out
trigger I/O, multipurpose X0, X1)
M3i-upgrade Upgrade for M3i.xxxx: later installation of option -bxio, -SH4, SH8 or SMA connectors
Order no.
War rEx t5 Warranty extension from 2 years standard warranty to 5 years Recal Recalibration at Spectrum incl. calibration protocol
Order no.
for Connections Length to BNC male to BNC female to SMA male to SMA female to SMB female Standard inputs 80 cm Cab-3f-9m-80 Cab-3f-9f-80 Cab-3f-3mA-80 Cab-3f-3fA-80 Standard inputs 200 cm Cab-3f-9m-200 Cab-3f-9f-200 Cab-3f-3mA-200 Cab-3f-3fA-200 Probes (short) 5 cm Cab-3f-9f-5 Trigger/Clock/Extra 80 cm Cab-1m-9m-80 Cab-1m-9f-80 Cab-1m-3mA-80 Cab-1m-3fA-80 Cab-1m-3f-80 Trigger/Clock/Extra 200 cm Cab-1m-9m-200 Cab-1m-9f200 Cab-1m-3mA-200 Cab-1m-3fA-200 Cab-1m-3f-200 SMA Option 80 cm Cab-3mA-9m-80 Cab-3mA-9f-80 SMA Option 200 cm Cab-3mA-9m-200 Cab-3mA-9f-200 Information The standard adapter cables are based on RG174 cables and have a nominal attenuation of 0.3 dB/m at 100 MHz and
0.5 dB/m at 250 MHz. For high speed signals we recommend the low loss cables series CHF together with the SMA con­nector option M3i.xxxx-SMA oder M3i.xxxx-SMAM.
Order no.s Option CHF-3mA-3mA-200 Low loss cables SMA male to SMA male 200 cm CHF-3mA-9m-200 Low loss cables SMA male to BNC male 200 cm Information The low loss adapter cables are based on MF141 cables and have an attenuation of 0.3 dB/m at 500 MHz and
0.5 dB/m at 1.5 GHz. They are recommended for signal frequencies of 200 MHz and above. Card SMA connectors are needed. Make sure to order one of the options M3i.xxxx-SMA or M3i.xxxx-SMAM together with the card.
Order no. Bandwidth Connection Input Impedance Coupling Amplification
SPA.1841 (2) 2 GHz SMA 50 Ohm AC x100 (40 dB) SPA.1801 (2) 2 GHz SMA 50 Ohm AC x10 (20 dB) SPA.1601 (2) 500 MHz BNC 50 Ohm DC x10 (20 dB) SPA.1412 (2) 200 MHz BNC 1 MOhm AC/DC x10/x100 (20/40 dB) SPA.1411 (2) 200 MHz BNC 50 Ohm AC/DC x10/x100 (20/40 dB) SPA.1232 (2) 10 MHz BNC 1 MOhm AC/DC x100/x1000 (40/60 dB) SPA.1231 (2) 10 MHz BNC 50 Ohm AC/DC x100/x1000 (40/60 dB) Information External Amplifiers with one channel, BNC/SMA female connections on input and output, manually adjustable offset, man-
ually switchable settings. An external power supply for 100 to 240 VAC is included. Please be sure to order an adapter cable matching the amplifier connector type and matching the connector type for your A/D card input.
Order no.
SBench6 Base version included in delivery. Supports standard mode for one card. SBench6-Pro Professional version for one card: FIFO mode, export/import, calculation functions SBench6-Multi Option multiple cards: Needs SBench6-Pro. Handles multiple synchronized cards in one system. Volume Licenses Please ask Spectrum for details.
Order no.
Spc-RServer Remote Ser ver Software Package - LAN remote access for M2i/M3i/M4i/M4x cards
16 M3i.48xx / M3i.48xx-exp Manual
Hardware Installation System Requirements

Hardware Installation

System Requirements

All Spectrum M2i/M3i.xxxx instrumentation cards are compliant to the PCI standard and require in general one free full length slot. This can either be a standard 32 bit PCI legacy slot, a 32 bit or a 64 bit PCI-X slot. Depending on the installed options additional free slots can be necessary.
All Spectrum M2i/M3i.xxxx-exp instrumentation cards are compliant to the PCI Express 1.0 standard and require in general one free full length PCI Express slot. This can either be a x1, x4, x8 or x16 slot. Some x16 PCIe slots are for the use of graphic cards only and can not be used for other cards. Depending on the installed options additional free slots can be necessary.

Warnings

ESD Precautions

The boards of the M2i/M3i.xxxx series contain electronic components that can be damaged by electrostatic discharge (ESD).
Before installing the board in your system or even before touching it, it is absolutely necessary to bleed off any electrostatic electricity.

Cooling Precautions

The boards of the M2i/M3i.xxxx series operate with components having very high power consumption at high speeds. For this reason it is absolutely required to cool this board sufficiently.
For all M2i/M3i cards it is strongly recommended to install an additional cooling fan producing a stream of air across the boards surface. In most cases professional PC-systems are already equipped with sufficient cooling power. In that case please make sure that the air stream is not blocked.

Sources of noise

The analog acquisition and generator boards of the M2i/M3i.xxxx series should be placed far away from any noise producing source (like e.g. the power supply). It should especially be avoided to place the board in the slot directly adjacent to another fast board (like the graphics controller).
(c) Spectrum GmbH 17
Installing the board in the system Hardware Installation

Installing the board in the system

Installing a single board without any options

Before installing the board you first need to unscrew and remove the dedicated blind-bracket usually mounted to cover unused slots of your PC. Please keep the screw in reach to fasten your Spectrum card afterwards. All Spectrum cards require a full length PCI, PCI-X slot (either 32Bit or 64Bit) or PCI Express slot (either x1, x4, x8 or x16) with a track at the backside to guide the board by its retainer. Now insert the board slowly into your computer. This is done best with one hand each at both fronts of the board.
While inserting the board take care not to tilt the retainer in the track. Please take especial care to not bend the card in any direction while inserting it in the system. A bending of the card may damage the PCB totally and is not covered by the standard warranty.
Please be very carefully when inserting the board in the slot, as most of the mainboards are mounted with spacers and therefore might be damaged if they are exposed to high pressure.
After the board’s insertion fasten the screw of the bracket carefully, without overdoing.
Installing the M2i/M3i.xxxx PCI/PCI-X card in a 32 bit PCI/PCI-X slot
Installing the M2i/M3i.xxxx PCI/PCI-X card in a 64 bit PCI/PCI-X slot
18 M3i.48xx / M3i.48xx-exp Manual
Hardware Installation Installing the board in the system
Installing the M2i/M3i.xxxx-exp PCI Express card in a PCIe x1 slot
Installing the M2i/M3i.xxxx-exp PCI Express card in a PCIe x4, x8 or x16 slot
(c) Spectrum GmbH 19
Installing the board in the system Hardware Installation

Installing a board with digital inputs/outputs mounted on an extra bracket

Before installing the board you first need to unscrew and remove the dedicated blind-brackets usually mounted to cover unused slots of your PC. Please keep the screws in reach to fasten your Spectrum board and the extra bracket afterwards. All Spectrum boards require a full length PCI slot with a track at the backside to guide the board by its retainer. Now insert the board and the extra bracket slowly into your computer. This is done best with one hand each at both fronts of the board.
While inserting the board take care not to tilt the retainer in the track. Please take especial care to not bend the card in any direction while inserting it in the system. A bending of the card may damage the PCB totally and is not covered by the standard warranty.
Please be very carefully when inserting the board in the PCI slot, as most of the mainboards are mounted with spacers and therefore might be damaged they are exposed to high pressure.
After the board’s insertion fasten the screws of both brackets carefully, without overdoing. The figure shows an ex­ample of a board with two installed modules.
20 M3i.48xx / M3i.48xx-exp Manual
Hardware Installation Installing the board in the system

Installing a board with option BaseXIO

Before installing the board you first need to unscrew and remove the dedicated blind-brackets usually mounted to cover unused slots of your PC. Please keep the screws in reach to fasten your Spectrum board and the extra bracket afterwards. All Spectrum boards require a full length PCI slot with a track at the backside to guide the board by its retainer. Now insert the board and the extra bracket slowly into your computer. This is done best with one hand each at both fronts of the board.
While inserting the board take care not to tilt the retainer in the track. Please take especial care to not bend the card in any direction while inserting it in the system. A bending of the card may damage the PCB totally and is not covered by the standard warranty.
Please be very carefully when inserting the board in the PCI slot, as most of the mainboards are mounted with spacers and therefore might be damaged they are exposed to high pressure.
After the board’s insertion fasten the screws of both brackets carefully, without overdoing. The figure shows an ex­ample of a board with two installed modules.
(c) Spectrum GmbH 21
Installing the board in the system Hardware Installation

Installing multiple boards synchronized by star-hub option

Hooking up the boards
Before mounting several synchronized boards for a multi channel system into the PC you can hook up the cards with their synchronization cables first. If there is enough space in your computer’s case (e.g. a big tower case) you can also mount the boards first and hook them up afterwards. Spectrum ships the card carrying the star-hub option together with the needed amount of synchronization cables. All of them are matched to the same length, to achieve a zero clock delay between the cards.
Only use the included flat ribbon cables.
All of the cards, including the one that carries the star-hub piggy-back module, must be wired to the star-hub as the figure is showing as an example for three synchronized boards.
It does not matter which of the available connectors on the star-hub module you use for which board. The software driver will detect the types and order of the synchronized boards automatically. The figure shows the three cables mounted on the option M2i.xxxx-SH16 star-hub to achieve a better visibility. The option M3i.xxxx-SH8 is handled similar to this picture. When using the M3i.xxxx-SH4 or M2i.xxxx-SH5 version, only the connectors on the upper side of the star-hub piggy-back module are available (see figure for details on the star-hub connector loca­tions).
As some of the synchronization cables are not secured against wrong plugging you should take care to have the pin 1 markers on the multiple connectors and the cable on the same side, as the figure on the right is showing.
Mounting the wired boards
Before installing the cards you first need to unscrew and remove the dedicated blind-brackets usually mounted to cover unused slots of your PC. Please keep the screws in reach to fasten your Spectrum cards afterwards. All Spectrum boards require a full length PCI slot with a track at the backside to guide the card by its retainer. Now insert the cards slowly into your computer. This is done best with one hand each at both fronts of the board. Please keep in mind that the board carrying the star-hub piggy-back module requires the width of two slots, when the option M3i.xxxx-SH8 or M2i.xxxx-SH16 version is used.
While inserting the board take care not to tilt the retainer in the track. Please take especial care to not bend the card in any direction while inserting it in the system. A bending of the card may damage the PCB totally and is not covered by the standard warranty.
Please be very careful when inserting the cards in the slots, as most of the mainboards are mounted with spacers and therefore might be damaged if they are exposed to high pressure.
After inserting all cards fasten the screws of all brackets carefully, without overdoing. The figure shows an example of three cards with two installed modules each.
22 M3i.48xx / M3i.48xx-exp Manual
Software Driver Installation Interrupt Sharing

Software Driver Installation

Before using the board a driver must be installed that matches the operating system. The installation is done in different ways depending on the used operating system. The driver that is on CD supports all cards of the M2i/M3i series. That means that you can use the same driver for all cards of these families.
With the CD revision 3.00 (June 2010) the CD structure was revised and the root folder of the Windows driv­ers was changed from „spcm_driver“ to „Driver“. The screen shots shown in the installation chapters might still show the former version.

Interrupt Sharing

This board uses a PCI interrupt for DMA data transfer and for controlling the FIFO mode. The used interrupt line is allocated by the PC BIOS at system start and is normally depending on the selected slot. Because there is only a limited number of interrupt lines available on the PCI bus it can happen that two or more boards must use the same interrupt line. This so called interrupt sharing must be supported by all drivers of the participating equipment.
Most available drivers and also the Spectrum driver for your board can manage interrupt sharing. But there are also some drivers on the market that can only use one interrupt exclusively. If this equipment shares an interrupt with the Spectrum board, the system will hang up if the second driver is loaded (the time is depending on the operating system).
If this happens it is necessary to reconfigure the system in that way that the critical equipment has an exclusive access to an interrupt.
On most systems the BIOS shows a list of all installed PCI boards with their allocated interrupt lines directly after system start. You have to check whether an interrupt line is shared between two boards. Some BIOS allow the manual allocation of interrupt lines. Have a look in your mainboard manual for further information on this topic.
Because normally the interrupt line is fixed for one PCI slot it is simply necessary to use another slot for the critical board to force a new interrupt allocation. You have to search a configuration where all critical boards have only exclusive access to one interrupt.
Depending on the system, using the Spectrum board with a shared interrupt may degrade performance a little. Each interrupt needs to be checked by two drivers. For this reason when using time critical FIFO mode even the Spectrum board should have an exclusively access to one interrupt line.

Important Notes on Driver Versions 2.22 and Control Center 1.41 and newer

With Windows driver version V2.22 and later required internal driver changes were needed, such that Windows 2000 is no longer com­patible with the WDM driver version.
Windows 2000 users should use the driver version 2.11 (available as separate download from the Spectrum homepage), because with driver version V2.22 on, this operating system is no longer supported.
Windows 2000 users should also use the Control Center version 1.41 (available as separate download from the Spectrum homepage), because with driver version V1.42 on, this operating system is no longer support­ed.
(c) Spectrum GmbH 23
Windows 2000 Software Driver Installation

Windows 2000

Installation

When installing the board in a Windows 2000 system the Spectrum board will be rec­ognized automatically on the next start-up.
The system offers the direct in­stallation of a driver for the board.
Let Windows search automat­ically for the best driver for your system.
Select the CD that was deliv­ered with the board as instal­lation source. The driver files are located on CD in the di­rectory \Driver\win32.

Version control

The hardware assistant shows you the exact board type that has been found like the M2i.2021 in the exam­ple.
The drivers can be used di­rectly after installation. It is not necessary to restart the system. The installed drivers are linked in the device man­ager.
Below you’ll see how to ex­amine the driver version and how to update the driver with a newer version.
If you want to check which driver version is installed in the system this can be eas­ily done in the device manager. There­fore please start the device manager from the control panel and show the properties of the installed driver. On the property page Windows 2000 shows the date and the version of the in­stalled driver. After clicking the driver details button the detailed version information of the driver is shown. This information is also avail­able through the control center.
24 M3i.48xx / M3i.48xx-exp Manual
Software Driver Installation Windows 2000

Driver - Update

If a new driver version should be installed no Spectrum board is allowed to be in use by any software. So please stop and exit all software that could access the boards.
A new driver version is direct­ly installed from the device manager. Therefore please open the properties page of the driver as shown in the sec­tion before. As next step click on the update driver button and follow the steps of the driver installation in a similar way to the previous board and driver installation.
Please select the path where the new driver version was unzipped to. If you’ve got the new driver version on CD please select the \Driver\win32 path on the CD containing the new driver version.
The new driver version can be used directly after installa­tion without restarting the sys­tem. Please keep in mind to update the driver of all in­stalled Spectrum boards.
Important Notes on Driver Versions 2.22 and Control Center 1.41 and newer
With Windows driver version V2.22 and later required internal driver changes were needed, such that Windows 2000 is no longer com­patible with the WDM driver version.
Windows 2000 users should use the driver version 2.11 (available as separate dwonload from the Spectrum homepage), because with driver version V2.22 on, this operating system is no longer supported.
Windows 2000 users should also use the Control Center version 1.41 (available as separate dwonload from the Spectrum homepage), because with driver version V1.42 on, this operating system is no longer support­ed.
(c) Spectrum GmbH 25
Windows XP 32 (64 Bit discontinued) Software Driver Installation

Windows XP 32 (64 Bit discontinued)

Installation

When installing the board in a Windows XP system the Spectrum board will be rec­ognized automatically on the next start-up.
The system offers the direct installation of a driver for the board.
Do not let Windows automatically search for the best driver, be­cause sometimes the driver will not be found on the CD. Please take the option of choosing a manual installation path instead.
Allow Windows XP to search for the most suitable driver in a specific directory. Se­lect the CD that was delivered with the board as installation source. The driver files are located on CD in the directory \Driver\win32 for Windows XP 32 Bit or \Driver\win64 for Windows XP 64 Bit.
The hardware assistant shows you the exact board type that has been found like the M2i.2021 in the example.
The drivers can be used directly after installation. It is not necessary to restart the system. The installed drivers are linked in the device manager.
Below you’ll see how to examine the driver version and how to update the driver with a newer version.

Version control

If you want to check which driver version is installed in the system this can be easily done in the device manager. Therefore please start the device manager from the control panel and show the properties of the installed driver.
26 M3i.48xx / M3i.48xx-exp Manual
Software Driver Installation Windows XP 32 (64 Bit discontinued)
On the property page Windows XP shows the date and the version of the installed driver.
After clicking the driver details button the detailed version information of the driver is shown. This information is also available through the Spectrum Control Center.

Driver - Update

If a new driver version should be installed no Spectrum board is allowed to be in use by any software. So please stop and exit all software that could access the boards.
A new driver version is directly installed from the device manager. Therefore please open the properties page of the driver as shown in the section before. As next step click on the update driver button and follow the steps of the driver installation in a similar way to the previous board and driver installation.
Please select the path where the new driver version was unzipped to. If you’ve got the new driver version on CD please select either the \Driver\win32 or \Driver\win64 path on the CD containing the new driver version.
The new driver version can be used directly after installation without restarting the system. Please keep in mind to update the driver of all installed Spectrum boards.
(c) Spectrum GmbH 27
Windows 7, 32/64 Bit Software Driver Installation

Windows 7, 32/64 Bit

Installation

When installing the card in a Windows 7 system, it will be recognized auto­matically on the next start-up. The system tries at first to automatically search and install the drivers from the Microsoft homepage.
This mechanism will fail at first for the „DPIO Module“ device, as shown on the right, because the Spectrum drivers are not available via Microsoft, so simply close the dialog.
Afterwards open the device manager from the Win­dows control panel, as shown on the right.
Find the above mentioned „DPIO Module“, right­click and select „Update Driver Software...“
Do not let Windows 7 automatically search the for the best driver, be­cause it will search the internet and not find a proper driver. Please take the option of browsing the computer manually for the driver soft­ware instead. Allow Windows 7 to search for the most suitable driver in a specific directory.
Now simply select the root folder of the CD that was delivered with the board as installation source and enable the „Include subfolders“ option.
Alternatively you can browse to the installations folders. The driver files are located on CD in the directory \Driver\win32 for Windows 7 32 Bit or \Driver\win64 for Windows 7 64 Bit.
28 M3i.48xx / M3i.48xx-exp Manual
Software Driver Installation Windows 7, 32/64 Bit
On the upcoming Windows security dialog select install. To pre­vent Windows 7 to always ask this question for future updates, you can optionally select to always trust software from Spectrum.
The hardware assistant then shows you the exact board type that has been found like the M3i.2132 in the example.
The drivers can be used directly after installation. It is not necessary to restart the system. The installed drivers are linked in the device man­ager.
Below you’ll see how to examine the driver version and how to update the driver with a newer version.

Version control

If you want to check which driver version is installed in the system this can be easily done in the device manager. Therefore please start the device manager from the control panel and show the properties of the installed driver.
On the property page Windows 7 shows the date and the version of the installed driver.
After clicking the driver details button the detailed version information of the driver is shown. This information is also available through the Spectrum Control Center.

Driver - Update

The driver update under Windows 7 is exact the same procedure as the initial installation. Please follow the steps above, starting from the device manager, select the Spectrum card to be updated, right-click and select „Update Driver Software...“ and follow the steps above.
(c) Spectrum GmbH 29
Linux Software Driver Installation

Linux

Overview

The Spectrum M2i/M3i/M4i/M4x cards and digitizerNETBOX/generatorNETBOX products are delivered with Linux drivers suitable for Linux installations based on kernel 2.4, 2.6, 3.x or 4.x, single processor (non-SMP) and SMP systems, 32 bit and 64 bit systems. As each Linux distribution contains different kernel versions and different system setup it is in nearly every case necessary, to have a directly matching kernel driver for card level products to run it on a specific system. For digitizerNETBOX/generatorNETBOX products the library is suffcient and no kernel driver has to be installed.
Spectrum delivers pre-compiled kernel driver modules for a number of common distributions with the cards. You may try to use one of these kernel modules for different distributions which have a similar kernel version. Unfortunately this won’t work in most cases as most Linux system refuse to load a driver which is not exactly matching. In this case it is possible to get the kernel driver sources from Spectrum. Please contact your local sales representative to get more details on this procedure.
The Standard delivery contains the pre-compiled kernel driver modules for the most popular Linux distribu­tions, like Suse, Debian, Fedora and Ubuntu. The list with all pre-compiled and readily supported distribu­tions and their respective kernel version can be found under: http://spectrum-instrumentation.com/de/supported-linux-distributions or via the shown QR code.
The Linux drivers have been tested with all above mentioned distributions by Spectrum. Each of these distri­butions has been installed with the default setup using no kernel updates. A lot more different distributions are used by customers with self compiled kernel driver modules.

Standard Driver Installation

The driver is delivered as installable kernel modules together with libraries to access the kernel driver. The installation script will help you with the installation of the kernel module and the library.
This installation is only needed if you are operating real locally installed cards. For software emulated demo cards, remotely installed cards or for digitizerNETBOX/generatorNETBOX products it is only necessary to in­stall the libraries as explained further below.
Login as root
It is necessary to have the root rights for installing a driver.
Call the install.sh <install_path> script
This script will install the kernel module and some helper scripts to a given directory. If you do not specify a directory it will use your home directory as destination. It is possible to move the installed driver files later to any other directory.
The script will give you a list of matching kernel modules. Therefore it checks for the system width (32 bit or 64 bit) and the processor (single or smp). The script will only show matching kernel modules. Select the kernel module matching your system. The script will then do the follow­ing steps:
• copy the selected kernel module to the install directory (spcm.o or spcm.ko)
• copy the helper scripts to the install directory (spcm_start.sh and spc_end.sh)
• copy and rename the matching library to /usr/lib (/usr/lib/libspcm_linux.so)
Udev support
Once the driver is loaded it automatically generates the device nodes under /dev. The cards are automatically named to /dev/spcm0, / dev/spcm1,...
You may use all the standard naming and rules that are available with udev.
Start the driver
Starting the driver can be done with the spcm_start.sh script that has been placed in the install directory. If udev is installed the script will only load the driver. If no udev is installed the start script will load the driver and make the required device nodes /dev/spcm0... for accessing the drivers. Please keep in mind that you need root rights to load the kernel module and to make the device nodes!
Using the dedicated start script makes sure that the device nodes are matching your system setup even if new hardware and drivers have been added in between. Background: when loading the device driver it gets assigned a „major“ number that is used to access this driver. All device nodes point to this major number instead of the driver name. The major numbers are assigned first come first served. This means that installing new hardware may result in different major numbers on the next system start.
30 M3i.48xx / M3i.48xx-exp Manual
Software Driver Installation Linux
Get first driver info
After the driver has been loaded successfully some information about the installed boards can be found in the /proc/spcm_cards file. Some basic information from the on-board EEProm is listed for every card.
cat /proc/spcm_cards
Stop the driver
You may want to unload the driver and clean up all device nodes. This can be done using the spcm_end.sh script that has also been placed in the install directory

Standard Driver Update

A driver update is done with the same commands as shown above. Please make sure that the driver has been stopped before updating it. To stop the driver you may use the spcm_end.sh script.

Compilation of kernel driver sources (option)

The driver sources are only available for existing customers on special request and against a signed NDA. The driver sources are not part of the standard delivery. The driver source package contains only the sources of the kernel module, not the sources of the library.
Please do the following steps for compilation and installation of the kernel driver module:
Login as root
It is necessary to have the root rights for installing a driver.
Call the compile script make_spcm_linux_kerneldrv.sh
This script will examine the type of system you use and compile the kernel with the correct settings. If using a kernel 2.4 the makefile expects two symbolic links in your system:
• /usr/src/linux pointing to the correct kernel source directory
• /usr/src/linux/.config pointing to the currently used kernel configuration
The compile script will then automatically call the install script and install the just compiled kernel module in your home directory. The rest of the installation procedure is similar as explained above.

Update of self compiled kernel driver

If the kernel driver has changed, one simply has to perform the same steps as shown above and recompile the kernel driver module. However the kernel driver module isn’t changed very often.
Normally an update only needs new libraries. To update the libraries only you can either download the full Linux driver (spcm_linux_drv_v123b4567) and only use the libraries out of this or one downloads the library package which is much smaller and doesn’t contain the pre-compiled kernel driver module (spcm_linux_lib_v123b4567).
The update is done with a dedicated script which only updates the library file. this script is present in both driver archives:
sh install_libonly.sh

Library only

The kernel driver module only contains the basic hardware functions that are necessary to access locally installed card level products. The main part of the driver is located inside a dynamically loadable library that is delivered with the driver. This library is available in 3 different versions:
• spcm_linux_32bit_stdc++5.so - supporting libstdc++.so.5 on 32 bit systems
• spcm_linux_32bit_stdc++6.so - supporting libstdc++.so.6 on 32 bit systems
• spcm_linux_64bit_stdc++6.so - supporting libstdc++.so.6 on 64 bit systems
The matching version is installed automatically in the /usr/lib directory by the kernel driver install script for card level products. The library is renamed for easy access to libspcm_linux.so.
For digitizerNETBOXgeneratorNETBOX products and also for evaluating or using only the software simulated demo cards the library is in­stalled with a separate install script:
sh install_libonly.sh
(c) Spectrum GmbH 31
Linux Software Driver Installation
To access the driver library one must include the library in the compilation:
gcc -o test_prg -lspcm_linux test.cpp
To start programming the cards under Linux please use the standard C/C++ examples which are all running under Linux and Windows.

Control Center

The Spectrum Control Center is also available for Linux and needs to be installed separately. The features of the Control Center are de­scribed in a later chapter in deeper detail. The Control Center has been tested under all Linux distributions for which Spectrum delivers pre-compiled kernel modules. The following packages need to be in­stalled to run the Control Center:
• X-Server
• expat
• freetype
• fontconfig
• libpng
• libspcm_linux (the Spectrum linux driver library)
Installation
Use the supplied packages in either *.deb or *.rpm format found in the driver section of the CD by double clicking the package file root rights from a X-Windows window.
The Control Center is installed under KDE, Gnome or Unity in the system/system tools section. It may be located directly in this menu or under a „More Programs“ menu. The final location depends on the used Linux distribution. The program itself is installed as /usr/bin/spcmcontrol and may be started directly from here.
Manual Installation
To manually install the Control Center, first extract the files from the rpm matching your distribution:
rpm2cpio spcmcontrol-{Version}.rpm > ~/spcmcontrol-{Version}.cpio cd ~/ cpio -id < spcmcontrol-{Version}.cpio
You get the directory structure and the files contained in the rpm package. Copy the binary spcmcontrol to /usr/bin. Copy the .desktop file to /usr/share/applications. Run ldconfig to update your systems library cache. Finally you can run spcmcontrol.
Troubleshooting
If you get a message like the following after starting spcmcontrol:
spcm_control: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file
or directory
Run ldd spcm_control in the directory where spcm_control resides to see the dependencies of the program. The output may look like this:
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4019e000) libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x401ad000) libz.so.1 => not found libdl.so.2 => /lib/libdl.so.2 (0x402ba000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x402be000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x402d0000)
As seen in the output, one of the libraries isn’t found inside the library cache of the system. Be sure that this library has been properly installed. You may then run ldconfig. If this still doesn’t help please add the library path to /etc/ld.so.conf and run ldconfig again.
If the libspcm_linux.so is quoted as missing please make sure that you have installed the card driver properly before. If any other library is stated as missing please install the matching package of your distribution.
32 M3i.48xx / M3i.48xx-exp Manual
Software Software Overview

Software

This chapter gives you an overview about the structure of the drivers and the software, where to find and how to use the examples. It shows in detail, how the drivers are included using different programming languages and deals with the differences when calling the driver functions from them.
This manual only shows the use of the standard driver API. For further information on programming drivers for third-party software like LabVIEW, MATLAB or IVI an additional manual is required that is available on CD or by download on the internet.

Software Overview

The Spectrum drivers offer you a common and fast API for using all of the board hardware features. This API is the same on all supported operating systems. Based on this API one can write own programs using any programming language that can access the driver API. This manual describes in detail the driver API, providing you with the necessary information to write your own programs. The drivers for third-party products like LabVIEW or MATLAB are also based on this API. The special functionality of these drivers is not subject of this document and is described with separate manuals available on the CD or on the website.

Card Control Center

A special card control center is available on CD and from the internet for all Spec­trum M2i/M3i/M4i cards and for all digitizerNETBOX/generatorNETBOX prod­ucts. Windows user find the Control Center installer on the CD under „Install\win\spcmcontrol_install.exe“.
Linux users find the versions for the different stdc++ libraries under under /Install/ linux/spcm_control_center/ as RPM packages.
When using a digitizerNETBOX/generatorNETBOX the Card Control Center install­ers for Windows and Linux are also directly available from the integrated webserver.
The Control Center under Windows and Linux it is available as an executive pro­gram. Under Windows it is also linked as a system control and can be accessed di­rectly from the Windows control panel. Under Linux it is also available from the KDE System Settings, the Gnome or Unity Control Center. The different functions of the Spectrum card control center are explained in detail in the following passages.
To install the Spectrum Control Center you will need to be logged in with administrator rights for your oper­ating system. On all Windows versions, starting with Windows Vista, installations with enabled UAC will ask you to start the installer with administrative rights (run as administrator).
(c) Spectrum GmbH 33
Card Control Center Software

Discovery of Remote Cards and digitizerNETBOX/generatorNETBOX products

The Discovery function helps you to find and identify the Spectrum LXI in­struments like digitizerNETBOX/generatorNETBOX available to your computer on the network. The Discovery function will also locate Spectrum card products handled by an installed Spectrum Remote Servers some­where on the network. The function is not needed if you only have locally installed cards.
Please note that only remote products are found that are currently not used by another program. Therefore in a bigger network the number of Spec­trum products found may vary depending on the current usage of the products.
Execute the Discovery function by pressing the „Discovery“ button. There is no progress window shown. After the discovery function has been exe­cuted the remotely found Spectrum products are listed under the node Re­mote as separate card level products. Inhere you find all hardware information as shown in the next topic and also the needed VISA resource string to access the remote card.
Please note that these information is also stored on your system and al­lows Spectrum software like SBench 6 to access the cards directly once found with the Discovery function.
After closing the control center and re-opening it the previously found re­mote products are shown with the prefix cached, only showing the card type and the serial number. This is the stored information that allows other Spectrum products to access previously found cards. Using the „Update cached cards“ button will try to re-open these cards and gather information of it. Afterwards the remote cards may disappear if they’re in use from somewhere else or the complete information of the remote products is shown again.

Wake On LAN of digitizerNETBOX/generatorNETBOX

Cached digitizerNETBOX/generatorNETBOX products that are currently in standby mode can be waked up, by using the „Wake remote device“ entry from the context menu.
The Control Center will broadcast a standard Wake On LAN „Magic Packet“, that is send to the device’s MAC address.
It is also possible to use any other Wake On LAN software to wake a digitizerNETBOX by send­ing such a „Magic Packet“ to the MAC address, which must be then entered manually.
It is also possible to wake a digitizerNETBOX/generatorNETBOX from your own application software by using the SPC_NETBOX_WAKEONLAN register. To wake a digitizerNETBOX/generatorNETBOX with the MAC address „00:03:2d:20:48“, the following command can be issued:
spcm_dwSetParam_i64 (NULL, SPC_NETBOX_WAKEONLAN, 0x00032d2048ec);

Netbox Monitor

The Netbox Monitor permanently monitors whether the digitizerNETBOX/generatorNETBOX is still available through LAN. This tool is helpful if the digitizerNETBOX is located somewhere in the company LAN or located remotely or directly mounted inside another device. Starting the Netbox Monitor can be done in two different ways:
• Starting manually from the Spectrum Control Center using the context menu as shown above
• Starting from command line. The Netbox Monitor program is automatically installed together with the Spectrum Control Center and is located in the selected install folder. Using the command line tool one can place a simple script into the autostart folder to have the Net­box Monitor running automatically after system boot. The command line tool needs the IP address of the digitizerNETBOX/generatorNETBOX to monitor:
NetboxMonitor 192.168.169.22
The Netbox Monitor is shown as a small window with the type of digitizerNETBOX/generatorNETBOX in the title and the IP ad­dress under which it is accessed in the window itself. The Netbox Monitor runs completely independent of any other software and can be used in parallel to any application software. The background of the IP address is used to display the current status of the device. Pressing the Escape key or alt + F4 (Windows) terminates the Netbox Monitor permanently.
34 M3i.48xx / M3i.48xx-exp Manual
Software Card Control Center
After starting the Netbox Monitor it is also displayed as a tray icon under Windows. The tray icon itself shows the status of the digitizerNETBOX/generatorNETBOX as a color. Please note that the tray icon may be hidden as a Windows default and need to be set to visible using the Windows tray setup.
Left clicking on the tray icon will hide/show the small Netbox Monitor status window. Right clicking on the tray icon as shown in the picture on the right will open up a context menu. In here one can again select to hide/show the Netbox Monitor status window, one can directly open the web interface from here or quit the program (including the tray icon) completely.
The checkbox „Show Status Message“ controls whether the tray icon should emerge a status message on status change. If enabled (which is default) one is notified with a status message if for example the LAN connection to the digitizerNETBOX/generatorNETBOX is lost.
The status colors:
• Green: digitizerNETBOX/generatorNETBOX available and accessible over LAN
• Cyan: digitizerNETBOX/generatorNETBOX is used from my computer
• Yellow: digitizerNETBOX/generatorNETBOX is used from a different computer
• Red: LAN connection failed, digitizerNETBOX/generatorNETBOX is no longer accessible

Hardware information

Through the control center you can easily get the main information about all the installed Spectrum hardware. For each installed card there is a separate tree of information available. The picture shows the information for one in­stalled card by example. This given information contains:
• Basic information as the type of card, the production date and its serial number, as well as the installed memory, the hardware revision of the base card, the number of available channels and installed acquisition modules.
• Information about the maximum sampling clock and the available quartz clock sources.
• The installed features/options in a sub-tree. The shown card is equipped for example with the option Multiple Recording, Gated Sampling, Times­tamp and ABA-mode.
• Detailed Information concerning the installed acquisition modules. In case of the shown analog acquisition card the information consists of the module’s hardware revision, of the converter resolution and the last cali­bration date as well as detailed information on the available analog input ranges, offset compensation capabilities and additional features of the inputs.

Firmware information

Another sub-tree is informing about the cards firmware version. As all Spectrum cards consist of several programmable components, there is one firmware version per component.
Nearly all of the components firmware can be updated by software. The only exception is the configuration device, which only can receive a fac­tory update.
The procedure on how to update the firmware of your Spectrum card with the help of the card control center is described in a dedicated sec­tion later on.
The procedure on how to update the firmware of your digitizerNETBOX/generatorNETBOX with the help of the integrated Webserver is described in a dedicated chapter later on.
(c) Spectrum GmbH 35
Card Control Center Software

Driver information

The Spectrum card control center also offers a way to gather information on the installed and used Spectrum driver.
The information on the driver is available through a dedicated tab, as the picture is showing in the example.
The provided information informs about the used type, distinguishing be­tween Windows or Linux driver and the 32 bit or 64 bit type.
It also gives direct information about the version of the installed Spectrum kernel driver, separately for M2i/ M3i cards and M4i/M4x cards and the version of the library (which is the *.dll file under Windows).
The information given here can also be found under Windows using the de­vice manager form the control panel. For details in driver details within the control panel please stick to the section on driver installation in your hard­ware manual.

Installing and removing Demo cards

With the help of the card control center one can install demo cards in the system. A demo card is simulated by the Spectrum driver in­cluding data production for acquisition cards. As the demo card is simulated on the lowest driver level all software can be tested includ­ing SBench, own applications and drivers for third-party products like LabVIEW. The driver supports up to 64 demo cards at the same time. The simulated memory as well as the simulated software op­tions can be defined when adding a demo card to the system.
Please keep in mind that these demo cards are only meant to test soft­ware and to show certain abilities of the software. They do not sim­ulate the complete behavior of a card, especially not any timing concerning trigger, recording length or FIFO mode notification. The demo card will calculate data every time directly after been called and give it to the user application without any more delay. As the calculation routine isn’t speed optimized, generating demo data may take more time than acquiring real data and transferring them to the host PC.
Installed demo cards are listed together with the real hardware in the main information tree as described above. Existing demo cards can be deleted by clicking the related button. The demo card details can be edited by using the edit button. It is for example possible to virtually install additional feature to one card or to change the type to test with a different number of channels.
For installing demo cards on a system without real hardware simply run the Control Center installer. If the installer is not detecting the necessary driver files normally residing on a system with real hardware, it will simply install the Spcm_driver.

Feature upgrade

All optional features of the M2i/M3i/M4i/M4x cards that do not require any hardware modifications can be installed on fielded cards. After Spectrum has re­ceived the order, the customer will get a personalized upgrade code. Just start the card control center, click on „install feature“ and enter that given code. After a short moment the feature will be installed and ready to use. No restart of the host system is required.
For details on the available options and prices please contact your local Spectrum distributor.

Software License upgrade

The software license for SBench 6 Professional is installed on the hardware. If order­ing a software license for a card that has already been delivered you will get an up­grade code to install that software license. The upgrade code will only match for that
36 M3i.48xx / M3i.48xx-exp Manual
Software Card Control Center
particular card with the serial number given in the license. To install the software license please click the „Install SW License“ button and type in the code exactly as given in the license.

Performing card calibration

The card control center also provides an easy way to access the automatic card calibration routines of the Spectrum A/D convert­er cards. Depending on the used card family this can affect offset calibration only or also might include gain calibration. Please re­fer to the dedicated chapter in your hardware manual for details.

Performing memory test

The complete on-board memory of the Spectrum M2i/M3i/M4i/M4x cards can be tested by the memory test included with the card control center.
When starting the test, randomized data is generated and written to the on­board memory. After a complete write cycle all the data is read back and com­pared with the generated pattern.
Depending on the amount of installed on-board memory, and your computers performance this operation might take a while.

Transfer speed test

The control center allows to measure the bus transfer speed of an installed Spectrum card. Therefore different setup is run multiple times and the overall bus transfer speed is measured. To get reliable results it is necessary that you disable debug logging as shown above. It is also highly recommended that no other software or time-con­suming background threads are running on that system. The speed test program runs the following two tests:
• Repetitive Memory Transfers: single DMA data trans­fers are repeated and measured. This test simulates the measuring of pulse repetition frequency when doing multiple single-shots. The test is done using dif­ferent block sizes. One can estimate the transfer in relation to the transferred data size on multiple single-shots.
• FIFO mode streaming: this test measures the streaming speed in FIFO mode. The test can only use the same direction of transfer the card has been designed for (card to PC=read for all DAQ cards, PC to card=write for all generator cards and both directions for I/O cards). The streaming speed is tested without using the front-end to measure the maximum bus speed that can be reached. The Speed in FIFO mode depends on the selected notify size which is explained later in this manual in greater detail.
The results are given in MB/s meaning MByte per second. To estimate whether a desired acquisition speed is possible to reach one has to calculate the transfer speed in bytes. There are a few things that has to be put into the calculation:
• 12, 14 and 16 bit analog cards need two bytes for each sample.
• 16 channel digital cards need 2 bytes per sample while 32 channel digital cards need 4 bytes and 64 channel digital cards need 8 bytes.
• The sum of analog channels must be used to calculate the total transfer rate.
• The figures in the Speed Test Utility are given as MBytes, meaning 1024 * 1024 Bytes, 1 MByte = 1048576 Bytes
As an example running a card with 2 14 bit analog channels with 28 MHz produces a transfer rate of [2 channels * 2 Bytes/Sample * 28000000] = 112000000 Bytes/second. Taking the above figures measured on a standard 33 MHz PCI slot the system is just capable of reaching this transfer speed: 108.0 MB/s = 108 * 1024 * 1024 = 113246208 Bytes/second.
Unfortunately it is not possible to measure transfer speed on a system without having a Spectrum card installed.
(c) Spectrum GmbH 37
Card Control Center Software

Debug logging for support cases

For answering your support questions as fast as possible, the setup of the card, driver and firmware version and other information is very helpful.
Therefore the card control center provides an easy way to gather all that infor­mation automatically.
Different debug log levels are available through the graphical interface. By de­fault the log level is set to „no logging“ for maximum performance.
The customer can select different log levels and the path of the generated ASCII text file. One can also decide to delete the previous log file first before creating a new one automatically or to append different logs to one single log file.
For maximum performance of your hardware, please make sure that the debug logging is set to „no log­ging“ for normal operation. Please keep in mind that a detailed logging in append mode can quickly gener­ate huge log files.

Device mapping

Within the „Device mapping“ tab of the Spectrum Control Center, one can en­able the re-mapping of Spectrum devices, be it either local cards, remote instru­ments such as a digitizerNETBOX or generatorNETBOX or even cards in a remote PC and accessed via the Spectrum remote server option.
In the left column the re-mapped device name is visible that is given to the device in the right column with its original un-mapped device string.
In this example the two local cards „spcm0“ and „spcm1“ are re-mapped to „spcm1“ and „spcm0“ respectively, so that their names are simply swapped.
The remote digitizerNETBOX device is mapped to spcm2.
The application software can then use the re-mapped name for simplicity instead of the quite long VISA string.
Changing the order of devices within one group (either local cards or remote devices) can simply be accomplished by draging&dropping the cards to their desired position in the same table.
38 M3i.48xx / M3i.48xx-exp Manual
Software Accessing the hardware with SBench 6

Firmware upgrade

One of the major features of the card control center is the ability to update the cards firmware by an easy-to-use software. The latest firmware revi­sions can be found in the download section of our homepage under http://www.spectrum-instrumentation.com.
A new firmware version is provided there as an installer, that copies the latest firmware to your system. All files are located in a dedicated subfold­er „FirmwareUpdate“ that will be created inside the Spectrum installation folder. Under Windows this folder by default has been created in the stan­dard program installation directory.
Please do the following steps when wanting to update the firmware of your M2i/M3i/M4i card:
• Download the latest software driver for your operating system pro­vided on the Spectrum homepage.
• Install the new driver as described in the driver install section of your hardware manual provided with the card. All manuals can also be found on the Spectrum homepage in the literature download section.
• Download and run the latest Spectrum Control Center installer.
• Download the installer for the new firmware version.
• Start the installer and follow the instructions given there.
• Start the card control center, select the „card“ tab, select the card from the listbox and press the „firmware update“ button on the right side.
The dialogue then will inform you about the currently installed firmware version for the different devices on the card and the new versions that are available. All devices that will be affected with the update are marked as „update needed“. Simply start the update or cancel the operation now, as a running update cannot be aborted.
Please keep in mind that you have to start the update for each card in a system in case that you have multiple cards installed. Select one card after the other from the listbox and press the „firmware update“ button. The firmware installer on the other hand only needs to be started once prior to the update.
Do not abort or shut down the computer while the firmware update is in progress. After a successful update please shut down your PC completely. The re-powering is required to finally activate the new firmware ver­sion of your Spectrum card.

Accessing the hardware with SBench 6

After the installation of the cards and the drivers it can be useful to first test the card function with a ready to run software before starting with program­ming. If accessing a digitizerNETBOX/generatorNETBOX a full SBench 6 Professional license is installed on the system and can be used without any limitations. For plug-in card level products a base version of SBench 6 is de­livered with the card on CD also including a 30 starts Professional demo version for plain card products. If you already have bought a card prior to the first SBench 6 release please contact your local dealer to get a SBench 6 Professional demo version.
SBench 6 supports all current acquisition and generation cards and digitiz­erNETBOX/generatorNETBOX products from Spectrum. Depending on the used product and the software setup, one can use SBench as a digital stor­age oscilloscope, a spectrum analyzer, a logic analyzer or simply as a data recording front end. Different export and import formats allow the use of SBench 6 together with a variety of other programs.
On the CD you’l l find an install version of SBench 6 in the directory /Install/ SBench6. The current version of SBench 6 is available free of charge direct­ly from the Spectrum website http://www.spectrum-instrumentation.com. Please go to the download section and get the latest version there. If using
the digitizerNETBOX/generatorNETBOX, a SBench 6 version is also available on the webpages of the digitizerNETBOX/generatorNETBOX.
SBench 6 has been designed to run under Windows XP, Windows Vista, Windows 7, Windows 8 and Windows 10 as well as Linux using KDE, Gnome or Unity Desktop.
(c) Spectrum GmbH 39
C/C++ Driver Interface Software

C/C++ Driver Interface

C/C++ is the main programming language for which the drivers have been designed for. Therefore the interface to C/C++ is the best match. All the small examples of the manual showing different parts of the hardware programming are done with C. As the libraries offer a standard interface it is easy to access the libraries also with other programming languages like Delphi or Basic. Please read the following chapters for additional information on this.

Header files

The basic task before using the driver is to include the header files that are delivered on CD together with the board. The header files are found in the directory /Driver/c_header. Please don’t change them in any way because they are updated with each new driver version to include the new registers and new functionality.
dlltyp.h Includes the platform specific definitions for data types and function declarations. All data types are based on this definitions. The use of this type definition file
regs.h Defines all registers and commands which are used in the Spectrum driver for the different boards. The registers a board uses are described in the board spe-
spcm_drv.h Defines the functions of the used SpcM driver. All definitions are taken from the file dlltyp.h. The functions itself are described below. spcerr.h Contains all error codes used with the Spectrum driver. All error codes that can be given back by any of the driver functions are also described here shortly all.
allows the use of examples and programs on different platforms without changes to the program source. The header file supports Microsoft Visual C++, Bor­land C++ Builder and GNU C/C++ directly. When using other compilers it might be necessary to make a copy of this file and change the data types accord­ing to this compiler.
cific part of the documentation. This header file is common for all cards. Therefore this file also contains a huge number of registers used on other card types than the one described in this manual. Please stick to the manual to see which registers are valid for your type of card.
The error codes and their meaning are described in detail in the appendix of this manual.
Example for including the header files:
// ----- driver includes ----­#include "dlltyp.h" // 1st include #include "regs.h" // 2nd include #include "spcerr.h" // 3rd include #include "spcm_drv.h" // 4th include
Please always keep the order of including the four Spectrum header files. Otherwise some or all of the func­tions do not work properly or compiling your program will be impossible!

General Information on Windows 64 bit drivers

After installation of the Spectrum 64 bit driver there are two general ways to access the hardware and to de­velop applications. If you’re going to develop a real 64 bit application it is necessary to access the 64 bit driver dll (spcm_win64.dll) as only this driver dll is supporting the full 64 bit address range.
But it is still possible to run 32 bit applications or to develop 32 bit applications even under Windows 64 bit. Therefore the 32 bit driver dll (spcm_win32.dll) is also installed in the system. The Spectrum SBench5 software is for example running under Windows 64 bit using this driver. The 32 bit dll of course only offers the 32 bit address range and is therefore limited to access only 4 GByte of memory. Beneath both drivers the 64 bit ker­nel driver is running.
Mixing of 64 bit application with 32 bit dll or vice versa is not possible.

Microsoft Visual C++ 6.0 and 2005 32 Bit

Include Driver
The driver files can be directly included in Microsoft C++ by simply using the library file spcm_win32_msvcpp.lib that is delivered together with the drivers. The library file can be found on the CD in the path /examples/c_cpp/c_header. Please include the library file in your Visual C++ project as shown in the examples. All functions described below are now available in your program.
Examples
Examples can be found on CD in the path /examples/c_cpp. This directory includes a number of different examples that can be used with any card of the same type (e.g. A/D acquisition cards, D/A acquisition cards). You may use these examples as a base for own programming and modify them as you like. The example directories contain a running workspace file for Microsoft Visual C++ 6.0 (*.dsw) as well as project files for Microsoft Visual Studio 2005 (*.vcproj) that can be directly loaded and compiled. There are also some more board type independent examples in separate subdirectory. These examples show different aspects of the cards like programming options or synchronization and can be combined with one of the board type specific examples.
As the examples are build for a card class there are some checking routines and differentiation between cards families. Differentiation aspects can be number of channels, data width, maximum speed or other details. It is recommended to change the examples matching your card type to obtain maximum performance. Please be informed that the examples are made for easy understanding and simple showing of one aspect of programming. Most of the examples are not optimized for maximum throughput or repetition rates.
40 M3i.48xx / M3i.48xx-exp Manual
Software C/C++ Driver Interface

Microsoft Visual C++ 64 Bit

Depending on your version of the Visual Studio suite it may be necessary to install some additional 64 bit components (SDK) on your system. Please follow the instructions found on the MSDN for further information.
Include Driver
The driver files can be directly included in Microsoft C++ by simply using the library file spcm_win64_msvcpp.lib that is delivered together with the drivers. The library file can be found on the CD in the path /examples/c_cpp/c_header. All functions described below are now available in your program.

Borland C++ Builder 32 Bit

Include Driver
The driver files can be easily included in Borland C++ Builder by simply using the library file spcm_win32_bcppb.lib that is delivered together with the drivers. The library file can be found on the CD in the path /examples/c_cpp/c_header. Please include the library file in your Borland C++ Builder project as shown in the examples. All functions described below are now available in your program.
Examples
The Borland C++ Builder examples share the sources with the Visual C++ examples. Please see above chapter for a more detailed documen­tation of the examples. In each example directory are project files for Visual C++ as well as Borland C++ Builder.

Linux Gnu C/C++ 32/64 Bit

Include Driver
The interface of the linux drivers does not differ from the windows interface. Please include the spcm_linux.lib library in your makefile to have access to all driver functions. A makefile may look like this:
COMPILER = gcc EXECUTABLE = test_prg LIBS = -lspcm_linux
OBJECTS = test.o\ test2.o
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(LIBS) $(OBJECTS)
%.o: %.cpp $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp
Examples
The Gnu C/C++ examples share the source with the Visual C++ examples. Please see above chapter for a more detailed documentation of the examples. Each example directory contains a makefile for the Gnu C/C++ examples.

C++ for .NET

Please see the next chapter for more details on the .NET inclusion.

Other Windows C/C++ compilers 32 Bit

Include Driver
To access the driver, the driver functions must be loaded from the 32 bit driver dll. Most compilers offer special tools to generate a matching library (e.g. Borland offers the implib tool that generates a matching library out of the windows driver dll). If such a tool is available it is recommended to use it. Otherwise the driver functions need to loaded from the dll using standard Windows functions. There is one example in the example directory /examples/c_cpp/dll_loading that shows the process.
Example of function loading:
hDLL = LoadLibrary ("spcm_win32.dll"); // Load the 32 bit version of the Spcm driver pfn_spcm_hOpen = (SPCM_HOPEN*) GetProcAddress (hDLL, "_spcm_hOpen@4"); pfn_spcm_vClose = (SPCM_VCLOSE*) GetProcAddress (hDLL, "_spcm_vClose@4");

Other Windows C/C++ compilers 64 Bit

Include Driver
To access the driver, the driver functions must be loaded from 64 bit the driver dll. Most compiler offer special tools to generate a matching library (e.g. Borland offers the implib tool that generates a matching library out of the windows driver dll). If such a tool is available it is
(c) Spectrum GmbH 41
Driver functions Software
recommended to use it. Otherwise the driver functions need to loaded from the dll using standard Windows functions. There is one example in the example directory /examples/c_cpp/dll_loading that shows the process for 32 bit environments. The only line that needs to be mod­ified is the one loading the DLL:
Example of function loading:
hDLL = LoadLibrary ("spcm_win64.dll"); // Modified: Load the 64 bit version of the Spcm driver here pfn_spcm_hOpen = (SPCM_HOPEN*) GetProcAddress (hDLL, "spcm_hOpen"); pfn_spcm_vClose = (SPCM_VCLOSE*) GetProcAddress (hDLL, "spcm_vClose");

National Instruments LabWindows/CVI

Include Drivers
To use the Spectrum driver under LabWindows/CVI it is necessary to first load the functions from the driver dll. Please use the library file spcm_win32_cvi.lib to access the driver functions.
Examples
Examples for LabWindows/CVI can be found on CD in the directory /examples/cvi. Please mix these examples with the standard C/C++ examples to have access to all functions and modes of the cards.

Driver functions

The driver contains seven main functions to access the hardware.
Own types used by our drivers
To simplify the use of the header files and our examples with different platforms and compilers and to avoid any implicit type conversions we decided to use our own type declarations. This allows us to use platform independent and universal examples and driver interfaces. If you do not stick to these declarations please be sure to use the same data type width. However it is strongly recommended that you use our defined type declarations to avoid any hard to find errors in your programs. If you’re using the driver in an environment that is not natively supported by our examples and drivers please be sure to use a type declaration that represents a similar data width
Declaration Type Declaration Type
int8 8 bit signed integer (range from -128 to +127) uint8 8 bit unsigned integer (range from 0 to 255) int16 16 bit signed integer (range from -32768 to 32767) uint16 16 bit unsigned integer (range from 0 to 65535) int32 32 bit signed integer (range from -2147483648 to 2147483647) uint32 32 bit unsigned integer (range from 0 to 4294967295) int64 64 bit signed integer (full range) uint64 64 bit unsigned integer (full range) drv_handle handle to driver, implementation depends on operating system platform
Notation of variables and functions
In our header files and examples we use a common and reliable form of notation for variables and functions. Each name also contains the type as a prefix. This notation form makes it easy to see implicit type conversions and minimizes programming errors that results from using incorrect types. Feel free to use this notation form for your programs also-
Declaration Notation Declaration Notation
int8 byName (byte) uint8 cName (character) int16 nName uint16 wName (word) int32 lName (long) uint32 dwName (double word) int64 llName (long long) uint64 qwName (quad word) int32* plName (pointer to long) char szName (string with zero termination)
Function
spcm_hOpen
This function initializes and opens an installed card supporting the new SpcM driver interface. At the time of printing this manual this are all cards of the M2i/M3i/M4i cards and digitizerNETBOX devices. The function returns a handle that has to used for driver access. If the card can’t be found or the loading of the driver generated an error the function returns a NULL. When calling this function all card specific instal­lation parameters are read out from the hardware and stored within the driver. It is only possible to open one device by one software as concurrent hardware access may be very critical to system stability. As a result when trying to open the same device twice an error will be raised and the function returns NULL.
Function spcm_hOpen (char* szDeviceName):
drv_handle _stdcall spcm_hOpen ( // tries to open the device and returns handle or error code char* szDeviceName); // name of the device to be opened
Under Linux the device name in the function call need to be a valid device name. Please change the string according to the location of the device if you don’t use the standard Linux device names. The driver is installed as default under /dev/spcm0, /dev/spcm1 and so on. The kernel driver numbers the devices starting with 0.
42 M3i.48xx / M3i.48xx-exp Manual
Software Driver functions
Under windows the only part of the device name that is used is the tailing number. The rest of the device name is ignored. Therefore to keep the examples simple we use the Linux notation in all our examples. The tailing number gives the index of the device to open. The Windows kernel driver numbers all devices that it finds on boot time starting with 0.
Example for local installed cards
drv_handle hDrv; // returns the handle to the opended driver or NULL in case of error hDrv = spcm_hOpen ("/dev/spcm0"); // string to the driver to open if (!hDrv) printf (“open of driver failed\n”);
Example for digitizerNETBOX and remote installed cards
drv_handle hDrv; // returns the handle to the opended driver or NULL in case of error hDrv = spcm_hOpen ("TCPIP::192.168.169.14::INST0::INSTR"); if (!hDrv) printf (“open of driver failed\n”);
IIf the function returns a NULL it is possible to read out the error description of the failed open function by simply passing this NULL to the error function. The error function is described in one of the next topics.
Function spcm_vClose
This function closes the driver and releases all allocated resources. After closing the driver handle it is not possible to access this driver any more. Be sure to close the driver if you don’t need it any more to allow other programs to get access to this device.
Function spcm_vClose:
void _stdcall spcm_vClose ( // closes the device drv_handle hDevice); // handle to an already opened device
Example:
spcm_vClose (hDrv);
Function
spcm_dwSetParam
All hardware settings are based on software registers that can be set by one of the functions spcm_dwSetParam. These functions sets a register to a defined value or executes a command. The board must first be initialized by the spcm_hOpen function. The parameter lRegister must have a valid software register constant as defined in regs.h. The available software registers for the driver are listed in the board specific part of the documentation below. The function returns a 32 bit error code if an error occurs. If no error occurs the function returns ERR_OK, what is zero.
Function spcm_dwSetParam
uint32 _stdcall spcm_dwSetParam_i32 ( // Return value is an error code drv_handle hDevice, // handle to an already opened device int32 lRegister, // software register to be modified int32 lValue); // the value to be set
uint32 _stdcall spcm_dwSetParam_i64m ( // Return value is an error code drv_handle hDevice, // handle to an already opened device int32 lRegister, // software register to be modified int32 lValueHigh, // upper 32 bit of the value. Containing the sign bit ! uint32 dwValueLow); // lower 32 bit of the value.
uint32 _stdcall spcm_dwSetParam_i64 ( // Return value is an error code drv_handle hDevice, // handle to an already opened device int32 lRegister, // software register to be modified int64 llValue); // the value to be set
Example:
if (spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, 16384) != ERR_OK) printf (“Error when setting memory size\n”);
This example sets the memory size to 16 kSamples (16384). If an error occurred the example will show a short error message
Function
spcm_dwGetParam
All hardware settings are based on software registers that can be read by one of the functions spcm_dwGetParam. These functions reads an internal register or status information. The board must first be initialized by the spcm_hOpen function. The parameter lRegister must have a valid software register constant as defined in the regs.h file. The available software registers for the driver are listed in the board specific part
(c) Spectrum GmbH 43
Driver functions Software
of the documentation below. The function returns a 32 bit error code if an error occurs. If no error occurs the function returns ERR_OK, what is zero.
Function spcm_dwGetParam
uint32 _stdcall spcm_dwGetParam_i32 ( // Return value is an error code drv_handle hDevice, // handle to an already opened device int32 lRegister, // software register to be read out int32* plValue); // pointer for the return value
uint32 _stdcall spcm_dwGetParam_i64m ( // Return value is an error code drv_handle hDevice, // handle to an already opened device int32 lRegister, // software register to be read out int32* plValueHigh, // pointer for the upper part of the return value uint32* pdwValueLow); // pointer for the lower part of the return value
uint32 _stdcall spcm_dwGetParam_i64 ( // Return value is an error code drv_handle hDevice, // handle to an already opened device int32 lRegister, // software register to be read out int64* pllValue); // pointer for the return value
Example:
int32 lSerialNumber; spcm_dwGetParam_i32 (hDrv, SPC_PCISERIALNO, &lSerialNumber); printf (“Your card has serial number: %05d\n”, lSerialNumber);
The example reads out the serial number of the installed card and prints it. As the serial number is available under all circumstances there is no error checking when calling this function.
Different call types of spcm_dwSetParam and spcm_dwGetParam: _i32, _i64, _i64m
The three functions only differ in the type of the parameters that are used to call them. As some of the registers can exceed the 32 bit integer range (like memory size or post trigger) it is recommended to use the _i64 function to access these registers. However as there are some programs or compilers that don’t support 64 bit integer variables there are two functions that are limited to 32 bit integer variables. In case that you do not access registers that exceed 32 bit integer please use the _i32 function. In case that you access a register which exceeds 64 bit value please use the _i64m calling convention. Inhere the 64 bit value is split into a low double word part and a high double word part. Please be sure to fill both parts with valid information.
If accessing 64 bit registers with 32 bit functions the behavior differs depending on the real value that is currently located in the register. Please have a look at this table to see the different reactions depending on the size of the register:
Internal register read/write Function type Behaviour
32 bit register read spcm_dwGetParam_i32 value is returned as 32 bit integer in plValue 32 bit register read spcm_dwGetParam_i64 value is returned as 64 bit integer in pllValue 32 bit register read spcm_dwGetParam_i64m value is returned as 64 bit integer, the lower part in plValueLow, the upper part in plValueHigh. The upper part can
32 bit register write spcm_dwSetParam_i32 32 bit value can be directly written 32 bit register write spcm_dwSetParam_i64 64 bit value can be directly written, please be sure not to exceed the valid register value range 32 bit register write spcm_dwSetParam_i64m 32 bit value is written as llValueLow, the value llValueHigh needs to contain the sign extension of this value. In case
64 bit register read spcm_dwGetParam_i32 If the internal register has a value that is inside the 32 bit integer range (-2G up to (2G - 1)) the value is returned
64 bit register read spcm_dwGetParam_i64 value is returned as 64 bit integer value in pllValue independent of the value of the internal register. 64 bit register read spcm_dwGetParam_i64m the internal value is splitted into a low and a high part. As long as the internal value is within the 32 bit range, the
64 bit register write spcm_dwSetParam_i32 the value to be written is limited to 32 bit range. If a value higher than the 32 bit range should be written, one of
64 bit register write spcm_dwSetParam_i64 the value has to be splitted into two parts. Be sure to fill the upper part lValueHigh with the correct sign extension
64 bit register write spcm_dwSetParam_i64m the value can be written directly independent of the size.
be ignored as it’s only a sign extension
of llValueLow being a value >= 0 llValueHigh can be 0, in case of llValueLow being a value < 0, llValueHigh has to be -1.
normally. If the internal register exceeds this size an error code ERR_EXCEEDSINT32 is returned. As an example: reading back the installed memory will work as long as this memory is < 2 GByte. If the installed memory is >= 2 GByte the function will return an error.
low part plValueLow contains the 32 bit value and the upper part plValueHigh can be ignored. If the internal value exceeds the 32 bit range it is absolutely necessary to take both value parts into account.
the other function types need to used.
even if you only write a 32 bit value as the driver every time interprets both parts of the function call.
44 M3i.48xx / M3i.48xx-exp Manual
Software Driver functions
Function spcm_dwGetContBuf
This function reads out the internal continuous memory buffer in bytes, in case one has been allocated. If no buffer has been allocated the function returns a size of zero and a NULL pointer. You may use this buffer for data transfers. As the buffer is continuously allocated in memory the data transfer will speed up by 15% - 25%. Please see further details in the appendix of this manual.
uint32 _stdcall spcm_dwGetContBuf_i64 ( // Return value is an error code drv_handle hDevice, // handle to an already opened device uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX void** ppvDataBuffer, // address of available data buffer uint64* pqwContBufLen); // length of available continuous buffer
uint32 _stdcall spcm_dwGetContBuf_i64m (// Return value is an error code drv_handle hDevice, // handle to an already opened device uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX void** ppvDataBuffer, // address of available data buffer uint32* pdwContBufLenH, // high part of length of available continuous buffer uint32* pdwContBufLenL); // low part of length of available continuous buffer
These functions have been added in driver version 1.36. The functions are not available in older driver ver­sions.
These functions also only have effect on locally installed cards and are neither usefull nor usable usable with any digitizerNETBOX or generatorNETBOX products, because no local kernel driver is involved in such a set­up. For remote devices these functions will return a NULL pointer for the buffer and 0 Bytes in length.
Function
spcm_dwDefTransfer
The spcm_dwDefTransfer function defines a buffer for a following data transfer. This function only defines the buffer there is no data transfer performed when calling this function. Instead the data transfer is started with separate register commands that are documented in a later chapter. At this position there is also a detailed description of the function parameters. Please make sure that all parameters of this function match. It is especially necessary that the buffer address is a valid address pointing to memory buffer that has at least the size that is defined in the function call. Please be informed that calling this function with non valid param­eters may crash your system as these values are base for following DMA transfers.
The use of this function is described in greater detail in a later chapter.
Function spcm_dwDefTransfer
uint32 _stdcall spcm_dwDefTransfer_i64m(// Defines the transer buffer by 2 x 32 bit unsigned integer drv_handle hDevice, // handle to an already opened device uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX uint32 dwDirection, // the transfer direction as defined above uint32 dwNotifySize, // no. of bytes after which an event is sent (0=end of transfer) void* pvDataBuffer, // pointer to the data buffer uint32 dwBrdOffsH, // high part of offset in board memory uint32 dwBrdOffsL, // low part of offset in board memory uint32 dwTransferLenH, // high part of transfer buffer length uint32 dwTransferLenL); // low part of transfer buffer length
uint32 _stdcall spcm_dwDefTransfer_i64 (// Defines the transer buffer by using 64 bit unsigned integer values drv_handle hDevice, // handle to an already opened device uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX uint32 dwDirection, // the transfer direction as defined above uint32 dwNotifySize, // no. of bytes after which an event is sent (0=end of transfer) void* pvDataBuffer, // pointer to the data buffer uint64 qwBrdOffs, // offset for transfer in board memory uint64 qwTransferLen); // buffer length
This function is available in two different formats as the spcm_dwGetParam and spcm_dwSetParam functions are. The background is the same. As long as you’re using a compiler that supports 64 bit integer values please use the _i64 function. Any other platform needs to use the _i64m function and split offset and length in two 32 bit words.
Example:
int16* pnBuffer = new int16[8192]; if (spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, (void*) pnBuffer, 0, 16384) != ERR_OK) printf (“DefTransfer failed\n”);
The example defines a data buffer of 8 kSamples of 16 bit integer values = 16 kByte (16384 byte) for a transfer from card to PC memory. As notify size is set to 0 we only want to get an event when the transfer has finished.
Function spcm_dwInvalidateBuf
The invalidate buffer function is used to tell the driver that the buffer that has been set with spcm_dwDefTransfer call is no longer valid. It is necessary to use the same buffer type as the driver handles different buffers at the same time. Call this function if you want to delete the buffer memory after calling the spcm_dwDefTransfer function. If the buffer already has been transferred after calling spcm_dwDefTransfer it is not necessary to call this function. When calling spcm_dwDefTransfer any further defined buffer is automatically invalidated.
(c) Spectrum GmbH 45
Driver functions Software
Function spcm_dwInvalidateBuf
uint32 _stdcall spcm_dwInvalidateBuf ( // invalidate the transfer buffer drv_handle hDevice, // handle to an already opened device uint32 dwBufType); // type of the buffer to invalidate as // listed above under SPCM_BUF_XXXX
Function spcm_dwGetErrorInfo
The function returns complete error information on the last error that has occurred. The error handling itself is explained in a later chapter in greater detail. When calling this function please be sure to have a text buffer allocated that has at least ERRORTEXTLEN length. The error text function returns a complete description of the error including the register/value combination that has raised the error and a short description of the error details. In addition it is possible to get back the error generating register/value for own error handling. If not needed the buffers for register/value can be left to NULL.
Note the the timeout event (ERR_TIMEOUT) is not counted as an error internally as it is not locking the driver but as a valid event. Therefore the GetErrorInfo function won’t return the timeout event even if it had occurred in between. You can only recognize the ERR_TIMEOUT as a direct return value of the wait function that was called.
Function spcm_dwGetErrorInfo
uint32 _stdcall spcm_dwGetErrorInfo_i32 ( drv_handle hDevice, // handle to an already opened device uint32* pdwErrorReg, // adress of the error register (can zero if not of interest) int32* plErrorValue, // adress of the error value (can zero if not of interest) char pszErrorTextBuffer[ERRORTEXTLEN]); // text buffer for text error
Example:
char szErrorBuf[ERRORTEXTLEN]; if (spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, -1)) { spcm_dwGetErrorInfo_i32 (hDrv, NULL, NULL, szErrorBuf); printf (“Set of memsize failed with error message: %s\n”, szErrorBuf); }
46 M3i.48xx / M3i.48xx-exp Manual
Software Borland Delphi (Pascal) Programming Interface

Borland Delphi (Pascal) Programming Interface

Driver interface

The driver interface is located in the sub-directory d_header and contains the following files. The files need to be included in the delphi project and has to be put into the „uses“ section of the source files that will access the driver. Please do not edit any of these files as they’re regularly updated if new functions or registers have been included.
file spcm_win32.pas
The file contains the interface to the driver library and defines some needed constants and variable types. All functions of the delphi library are similar to the above explained standard driver functions:
// ----- device handling functions ----­function spcm_hOpen (strName: pchar): int32; stdcall; external 'spcm_win32.dll' name '_spcm_hOpen@4'; procedure spcm_vClose (hDevice: int32); stdcall; external 'spcm_win32.dll' name '_spcm_vClose@4';
function spcm_dwGetErrorInfo_i32 (hDevice: int32; var lErrorReg, lErrorValue: int32; strError: pchar): uint32; stdcall; external 'spcm_win32.dll' name '_spcm_dwGetErrorInfo_i32@16'
// ----- register access functions ----­function spcm_dwSetParam_i32 (hDevice, lRegister, lValue: int32): uint32; stdcall; external 'spcm_win32.dll' name '_spcm_dwSetParam_i32@12';
function spcm_dwSetParam_i64 (hDevice, lRegister: int32; llValue: int64): uint32; stdcall; external 'spcm_win32.dll' name '_spcm_dwSetParam_i64@16';
function spcm_dwGetParam_i32 (hDevice, lRegister: int32; var plValue: int32): uint32; stdcall; external 'spcm_win32.dll' name '_spcm_dwGetParam_i32@12';
function spcm_dwGetParam_i64 (hDevice, lRegister: int32; var pllValue: int64): uint32; stdcall; external 'spcm_win32.dll' name '_spcm_dwGetParam_i64@12';
// ----- data handling ----­function spcm_dwDefTransfer_i64 (hDevice, dwBufType, dwDirection, dwNotifySize: int32; pvDataBuffer: Pointer; llBrdOffs, llTransferLen: int64): uint32; stdcall; external 'spcm_win32.dll' name '_spcm_dwDefTransfer_i64@36';
function spcm_dwInvalidateBuf (hDevice, lBuffer: int32): uint32; stdcall; external 'spcm_win32.dll' name '_spcm_dwInvalidateBuf@8';
The file also defines types used inside the driver and the examples. The types have similar names as used under C/C++ to keep the examples more simple to understand and allow a better comparison.
file SpcRegs.pas
The SpcRegs.pas file defines all constants that are used for the driver. The constant names are the same names as used under the C/C++ examples. All constants names will be found throughout this hardware manual when certain aspects of the driver usage are explained. It is recommended to only use these constant names for better visibility of the programs:
const SPC_M2CMD = 100; { write a command } const M2CMD_CARD_RESET = $00000001; { hardware reset } const M2CMD_CARD_WRITESETUP = $00000002; { write setup only } const M2CMD_CARD_START = $00000004; { start of card (including writesetup) } const M2CMD_CARD_ENABLETRIGGER = $00000008; { enable trigger engine } ...
file SpcErr.pas
The SpeErr.pas file contains all error codes that may be returned by the driver.
Including the driver files
To use the driver function and all the defined constants it is necessary to include the files into the project as shown in the picture on the right. The project overview is taken from one of the examples delivered on CD. Besides including the driver files in the project it is also necessary to include them in the uses section of the source files where functions or constants should be used:
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
SpcRegs, SpcErr, spcm_win32;
(c) Spectrum GmbH 47
Borland Delphi (Pascal) Programming Interface Software

Examples

Examples for Delphi can be found on CD in the directory /examples/delphi. The directory contains the above mentioned delphi header files and a couple of universal examples, each of them working with a certain type of card. Please feel free to use these examples as a base for your programs and to modify them in any kind.
spcm_scope
The example implements a very simple scope program that makes single acquisitions on button pressing. A fixed setup is done inside the example. The spcm_scope example can be used with any analog data acquisition card from Spectrum. It covers cards with 1 byte per sample (8 bit resolution) as well as cards with 2 bytes per sample (12, 14 and 16 bit resolution)
The program shows the following steps:
• Initialization of a card and reading of card information like type, function and serial number
• Doing a simple card setup
• Performing the acquisition and waiting for the end interrupt
• Reading of data, re-scaling it and displaying waveform on screen
48 M3i.48xx / M3i.48xx-exp Manual
Software Visual Basic Programming Interface and Examples

Visual Basic Programming Interface and Examples

Driver interface

The driver interface is located in the sub-directory b_header and contains the following files. The files need to be included in the basic project. Please do not edit any of these files as they’re regularly updated if new functions or registers have been included.
file spcm_win32_decl.bas
The file contains the interface to the driver library and defines some needed constants. All functions of the visual basic library are similar to the above explained standard driver functions:
' ----- card handling functions ----­Public Declare Function spcm_hOpen Lib "spcm_win32.dll" Alias "_spcm_hOpen@4" (ByVal szDeviceName As String) As Long
Public Declare Function spcm_vClose Lib "spcm_win32.dll" Alias "_spcm_vClose@4" (ByVal hDevice As Long) As Long
Public Declare Function spcm_dwGetErrorInfo_i32 Lib "spcm_win32.dll" Alias "_spcm_dwGetErrorInfo_i32@16" (ByVal hDevice As Long, ByRef lErrorReg, ByRef lErrorValue, ByVal szErrorText As String) As Long
' ----- software register handling ----­Public Declare Function spcm_dwGetParam_i32 Lib "spcm_win32.dll" Alias "_spcm_dwGetParam_i32@12" (ByVal hDevice As Long, ByVal lRegister As Long, ByRef lValue As Long) As Long
Public Declare Function spcm_dwGetParam_i64m Lib "spcm_win32.dll" Alias "_spcm_dwGetParam_i64m@16" (ByVal hDevice As Long, ByVal lRegister As Long, ByRef lValueHigh As Long, ByRef lValueLow As Long) As Long
Public Declare Function spcm_dwSetParam_i32 Lib "spcm_win32.dll" Alias "_spcm_dwSetParam_i32@12" (ByVal hDevice As Long, ByVal lRegister As Long, ByVal lValue As Long) As Long
Public Declare Function spcm_dwSetParam_i64m Lib "spcm_win32.dll" Alias "_spcm_dwSetParam_i64m@16" (ByVal hDevice As Long, ByVal lRegister As Long, ByVal lValueHigh As Long, ByVal lValueLow As Long) As Long
' ----- data handling ----­Public Declare Function spcm_dwDefTransfer_i64m Lib "spcm_win32.dll" Alias "_spcm_dwDefTransfer_i64m@36" (ByVal hDevice As Long, ByVal dwBufType As Long, ByVal dwDirection As Long, ByVal dwNotifySize As Long, ByRef pvDataBuffer As Any, ByVal dwBrdOffsH As Long, ByVal dwBrdOffsL As Long, ByVal dwTransferLenH As Long, ByVal dwTransferLenL As Long) As Long
Public Declare Function spcm_dwInvalidateBuf Lib "spcm_win32.dll" Alias "_spcm_dwInvalidateBuf@8" (ByVal hDevice As Long, ByVal lBuffer As Long) As Long
file SpcRegs.bas
The SpcRegs.bas file defines all constants that are used for the driver. The constant names are the same names as used under the C/C++ examples. All constants names will be found throughout this hardware manual when certain aspects of the driver usage are explained. It is recommended to only use these constant names for better visibility of the programs:
Public Const SPC_M2CMD = 100 ' write a command Public Const M2CMD_CARD_RESET = &H1& ' hardware reset Public Const M2CMD_CARD_WRITESETUP = &H2& ' write setup only Public Const M2CMD_CARD_START = &H4& ' start of card (including writesetup) Public Const M2CMD_CARD_ENABLETRIGGER = &H8& ' enable trigger engine ...
file SpcErr.bas
The SpcErr.bas file contains all error codes that may be returned by the driver.
Including the driver files
To use the driver function and all the defined constants it is necessary to include the files into the project as shown in the picture on the right. The project overview is taken from one of the examples delivered on CD.
(c) Spectrum GmbH 49
Visual Basic Programming Interface and Examples Software

Examples

Examples for Visual Basic can be found on CD in the directory /examples/basic. The directory contains the above mentioned basic header files and a couple of universal examples, each of them working with a certain type of card. Please feel free to use these examples as a base for your programs and to modify them in any kind.
spcm_scope
The example implements a very simple scope program that makes single acquisitions on button pressing. A fixed setup is done inside the example. The spcm_scope example can be used with any analog data acquisition card from Spectrum. It covers cards with 1 byte per sample (8 bit resolution) as well as cards with 2 bytes per sample (12, 14 and 16 bit resolution)
The program shows the following steps:
• Initialization of a card and reading of card information like type, function and serial number
• Doing a simple card setup
• Performing the acquisition and waiting for the end interrupt
• Reading of data, re-scaling it and displaying waveform on screen
50 M3i.48xx / M3i.48xx-exp Manual
Software .NET programming languages

.NET programming languages

Library

For using the driver with a .NET based language Spectrum delivers a special library that encapsulates the driver in a .NET object. By adding this object to the project it is possible to access all driver functions and constants from within your .NET environment.
There is one small console based example for each supported .NET language that shows how to include the driver and how to access the cards. Please combine this example with the different standard examples to get the different card functionality.

Declaration

The driver access methods and also all the type, register and error declarations are combined in the object Spcm and are located in the DLL SpcmDrv.NET.dll delivered with the .NET examples. Spectrum also delivers the source code of the DLL as a C# project. Theses sources are located in the directory SpcmDrv.NET.
namespace Spcm { public class Drv { [DllImport("spcm_win32.dll")]public static extern IntPtr spcm_hOpen (string szDeviceName); [DllImport("spcm_win32.dll")]public static extern void spcm_vClose (IntPtr hDevice); ... public class CardType { public const int TYP_M2I2020 = unchecked ((int)0x00032020); public const int TYP_M2I2021 = unchecked ((int)0x00032021); public const int TYP_M2I2025 = unchecked ((int)0x00032025); ... public class Regs { public const int SPC_M2CMD = unchecked ((int)100); public const int M2CMD_CARD_RESET = unchecked ((int)0x00000001); public const int M2CMD_CARD_WRITESETUP = unchecked ((int)0x00000002); ...

Using C#

The SpcmDrv.NET.dll needs to be included within the Solution Explorer in the References section. Please use right mouse and select „AddRef­erence“. After this all functions and constants of the driver object are available.
Please see the example in the directory CSharp as a start:
// ----- open card ----­hDevice = Drv.spcm_hOpen("/dev/spcm0"); if ((int)hDevice == 0) { Console.WriteLine("Error: Could not open card\n"); return 1; }
// ----- get card type ----­dwErrorCode = Drv.spcm_dwGetParam_i32(hDevice, Regs.SPC_PCITYP, out lCardType); dwErrorCode = Drv.spcm_dwGetParam_i32(hDevice, Regs.SPC_PCISERIALNR, out lSerialNumber);
Example for digitizerNETBOX and remotely installed cards:
// ----- open card ----­hDevice = Drv.spcm_hOpen("TCPIP::192.168.169.14::INST0::INSTR");
(c) Spectrum GmbH 51
.NET programming languages Software

Using Managed C++/CLI

The SpcmDrv.NET.dll needs to be included within the project options. Please select „Project“ - „Properties“ - „References“ and finally „Add new Reference“. After this all functions and constants of the driver object are available.
Please see the example in the directory CppCLR as a start:
// ----- open card ----­hDevice = Drv::spcm_hOpen("/dev/spcm0"); if ((int)hDevice == 0) { Console::WriteLine("Error: Could not open card\n"); return 1; }
// ----- get card type ----­dwErrorCode = Drv::spcm_dwGetParam_i32(hDevice, Regs::SPC_PCITYP, lCardType); dwErrorCode = Drv::spcm_dwGetParam_i32(hDevice, Regs::SPC_PCISERIALNR, lSerialNumber);
Example for digitizerNETBOX and remotely installed cards:
// ----- open card ----­hDevice = Drv::spcm_hOpen("TCPIP::192.168.169.14::INST0::INSTR");

Using VB.NET

The SpcmDrv.NET.dll needs to be included within the project options. Please select „Project“ - „Properties“ - „References“ and finally „Add new Reference“. After this all functions and constants of the driver object are available.
Please see the example in the directory VB.NET as a start:
' ----- open card ----­hDevice = Drv.spcm_hOpen("/dev/spcm0")
If (hDevice = 0) Then Console.WriteLine("Error: Could not open card\n") Else
' ----- get card type ----­ dwError = Drv.spcm_dwGetParam_i32(hDevice, Regs.SPC_PCITYP, lCardType) dwError = Drv.spcm_dwGetParam_i32(hDevice, Regs.SPC_PCISERIALNR, lSerialNumber)
Example for digitizerNETBOX and remotely installed cards:
' ----- open card ----­hDevice = Drv.spcm_hOpen("TCPIP::192.168.169.14::INST0::INSTR")

Using J#

The SpcmDrv.NET.dll needs to be included within the Solution Explorer in the References section. Please use right mouse and select „AddRef­erence“. After this all functions and constants of the driver object are available.
Please see the example in the directory JSharp as a start:
// ----- open card ----­hDevice = Drv.spcm_hOpen("/dev/spcm0");
if (hDevice.ToInt32() == 0) System.out.println("Error: Could not open card\n"); else { // ----- get card type ----­ dwErrorCode = Drv.spcm_dwGetParam_i32(hDevice, Regs.SPC_PCITYP, lCardType); dwErrorCode = Drv.spcm_dwGetParam_i32(hDevice, Regs.SPC_PCISERIALNR, lSerialNumber);
Example for digitizerNETBOX and remotely installed cards:
' ----- open card ----­hDevice = Drv.spcm_hOpen("TCPIP::192.168.169.14::INST0::INSTR")
52 M3i.48xx / M3i.48xx-exp Manual
Software Python Programming Interface and Examples

Python Programming Interface and Examples

Driver interface

The driver interface contains the following files. The files need to be included in the python project. Please do not edit any of these files as they are regularily updated if new functions or registers have been included. To use pyspcm you need either python 2 (2.4, 2.6 or 2.7) or python 3 (3.x) and ctype, which is included in python 2.6 and newer and needs to be installed separately for Python 2.4.
file pyspcm.py
The file contains the interface to the driver library and defines some needed constants. All functions of the python library are similar to the above explained standard driver functions and use ctypes as input and return parameters:
# ----- Windows ----­spcmDll = windll.LoadLibrary ("c:\\windows\\system32\\spcm_win32.dll")
# load spcm_hOpen spcm_hOpen = getattr (spcmDll, "_spcm_hOpen@4") spcm_hOpen.argtype = [c_char_p] spcm_hOpen.restype = drv_handle
# load spcm_vClose spcm_vClose = getattr (spcmDll, "_spcm_vClose@4") spcm_vClose.argtype = [drv_handle] spcm_vClose.restype = None
# load spcm_dwGetErrorInfo spcm_dwGetErrorInfo_i32 = getattr (spcmDll, "_spcm_dwGetErrorInfo_i32@16") spcm_dwGetErrorInfo_i32.argtype = [drv_handle, ptr32, ptr32, c_char_p] spcm_dwGetErrorInfo_i32.restype = uint32
# load spcm_dwGetParam_i32 spcm_dwGetParam_i32 = getattr (spcmDll, "_spcm_dwGetParam_i32@12") spcm_dwGetParam_i32.argtype = [drv_handle, int32, ptr32] spcm_dwGetParam_i32.restype = uint32
# load spcm_dwGetParam_i64 spcm_dwGetParam_i64 = getattr (spcmDll, "_spcm_dwGetParam_i64@12") spcm_dwGetParam_i64.argtype = [drv_handle, int32, ptr64] spcm_dwGetParam_i64.restype = uint32
# load spcm_dwSetParam_i32 spcm_dwSetParam_i32 = getattr (spcmDll, "_spcm_dwSetParam_i32@12") spcm_dwSetParam_i32.argtype = [drv_handle, int32, int32] spcm_dwSetParam_i32.restype = uint32
# load spcm_dwSetParam_i64 spcm_dwSetParam_i64 = getattr (spcmDll, "_spcm_dwSetParam_i64@16") spcm_dwSetParam_i64.argtype = [drv_handle, int32, int64] spcm_dwSetParam_i64.restype = uint32
# load spcm_dwSetParam_i64m spcm_dwSetParam_i64m = getattr (spcmDll, "_spcm_dwSetParam_i64m@16") spcm_dwSetParam_i64m.argtype = [drv_handle, int32, int32, int32] spcm_dwSetParam_i64m.restype = uint32
# load spcm_dwDefTransfer_i64 spcm_dwDefTransfer_i64 = getattr (spcmDll, "_spcm_dwDefTransfer_i64@36") spcm_dwDefTransfer_i64.argtype = [drv_handle, uint32, uint32, uint32, c_void_p, uint64, uint64] spcm_dwDefTransfer_i64.restype = uint32
spcm_dwInvalidateBuf = getattr (spcmDll, "_spcm_dwInvalidateBuf@8") spcm_dwInvalidateBuf.argtype = [drv_handle, uint32] spcm_dwInvalidateBuf.restype = uint32
# ----- Linux ----­# use cdll because all driver access functions use cdecl calling convention under linux spcmDll = cdll.LoadLibrary ("libspcm_linux.so")
# the loading of the driver access functions is similar to windows:
# load spcm_hOpen spcm_hOpen = getattr (spcmDll, "spcm_hOpen") spcm_hOpen.argtype = [c_char_p] spcm_hOpen.restype = drv_handle
# ...
(c) Spectrum GmbH 53
Python Programming Interface and Examples Software
file regs.py
The regs.py file defines all constants that are used for the driver. The constant names are the same names compared to the C/C++ examples. All constant names will be found throughout this hardware manual when certain aspects of the driver usage are explained. It is recommended to only use these constant names for better readability of the programs:
SPC_M2CMD = 100l # write a command M2CMD_CARD_RESET = 0x00000001l # hardware reset M2CMD_CARD_WRITESETUP = 0x00000002l # write setup only M2CMD_CARD_START = 0x00000004l # start of card (including writesetup) M2CMD_CARD_ENABLETRIGGER = 0x00000008l # enable trigger engine ...
file spcerr.py
The spcerr.py file contains all error codes that may be returned by the driver.

Examples

Examples for Python can be found on CD in the directory /examples/python. The directory contains the above mentioned header files and a some examples, each of them working with a certain type of card. Please feel free to use these examples as a base for your programs and to modify them in any kind.
When allocating the buffer for DMA transfers, use the following function to get a mutable character buffer: ctypes.create_string_buffer(init_or_size[, size])
54 M3i.48xx / M3i.48xx-exp Manual
Programming the Board Overview

Programming the Board

Overview

The following chapters show you in detail how to program the different aspects of the board. For every topic there’s a small example. For the examples we focused on Visual C++. However as shown in the last chapter the differences in programming the board under different programming languages are marginal. This manual describes the programming of the whole hardware family. Some of the topics are similar for all board versions. But some differ a little bit from type to type. Please check the given tables for these topics and examine carefully which settings are valid for your special kind of board.

Register tables

The programming of the boards is totally software register based. All software registers are described in the following form:
The name of the software regis­ter as found in the regs.h file. Could directly be used by C/ C++, Delphi and Basic compiler
The decimal value of the software register. Also found in the regs.h file. This value must be used with all programs or compilers that cannot use the header file directly.
Describes whether the register can be read (r) and/or writ­ten (w).
Short description of the function­ality of the register. A more de­tailed description is found above or below the register ta­bles.
Register Value Direction Description
SPC_M2CMD 100 w Command register of the board.
M2CMD_CARD_START 4h Starts the board with the current register settings.
M2CMD_CARD_STOP 40h Stops the board manually.
Any constants that can be used to program the register directly are shown inserted beneath the register table.
The decimal or hexadecimal value of the constant, also found in the regs.h file. Hexa­decimal values are indicated with an „h“ at the end. This value must be used with all
Short description of the use of this con­stant.
programs or compilers that cannot use the header file directly.
If no constants are given below the register table, the dedicated register is used as a switch. All such registers are activated if written with a “1“ and deactivated if written with a “0“.

Programming examples

In this manual a lot of programming examples are used to give you an impression on how the actual mentioned registers can be set within your own program. All of the examples are located in a separated colored box to indicate the example and to make it easier to differ it from the describing text.
All of the examples mentioned throughout the manual are written in C/C++ and can be used with any C/C++ compiler for Windows or Linux.
Complete C/C++ Example
#include “../c_header/dlltyp.h” #include “../c_header/regs.h” #include “../c_header/spcm_drv.h”
#include <stdio.h>
int main() { drv_handle hDrv; // the handle of the device int32 lCardType; // a place to store card information
hDrv = spcm_hOpen ("/dev/spcm0"); // Opens the board and gets a handle if (!hDrv) // check whether we can access the card return -1;
spcm_dwGetParam_i32 (hDrv, SPC_PCITYP, &lCardType); // simple command, read out of card type printf (“Found card M2i/M3i/M4i.%04x in the system\n”, lCardType & TYP_VERSIONMASK); spcm_vClose (hDrv);
return 0; }
(c) Spectrum GmbH 55
Initialization Programming the Board

Initialization

Before using the card it is necessary to open the kernel device to access the hardware. It is only possible to use every device exclusively using the handle that is obtained when opening the device. Opening the same device twice will only generate an error code. After ending the driver use the device has to be closed again to allow later re-opening. Open and close of driver is done using the spcm_hOpen and spcm_vClose function as described in the “Driver Functions” chapter before.
Open/Close Example
drv_handle hDrv; // the handle of the device
hDrv = spcm_hOpen ("/dev/spcm0"); // Opens the board and gets a handle if (!hDrv) // check whether we can access the card { printf “Open failed\n”); return -1; }
... do any work with the driver
spcm_vClose (hDrv); return 0;

Initialization of Remote Products

The only step that is different when accessing remotely controlled cards or digitizerNETBOXes is the initialization of the driver. Instead of the local handle one has to open the VISA string that is returned by the discovery function. Alternatively it is also possible to access the card directly without discovery function if the IP address of the device is known.
drv_handle hDrv; // the handle of the device
hDrv = spcm_hOpen ("TCPIP::192.168.169.14::INSTR"); // Opens the remote board and gets a handle if (!hDrv) // check whether we can access the card { printf “Open of remote card failed\n”); return -1; }
...
Multiple cards are opened by indexing the remote card number:
hDrv = spcm_hOpen ("TCPIP::192.168.169.14::INSTR"); // Opens the remote board #0 // or alternatively hDrv = spcm_hOpen ("TCPIP::192.168.169.14::INST0::INSTR"); // Opens the remote board #0 // all other boards require an index: hDrv = spcm_hOpen ("TCPIP::192.168.169.14::INST1::INSTR"); // Opens the remote board #1 hDrv = spcm_hOpen ("TCPIP::192.168.169.14::INST2::INSTR"); // Opens the remote board #2

Error handling

If one action caused an error in the driver this error and the register and value where it occurs will be saved.
The driver is then locked until the error is read out using the error function spcm_dwGetErrorInfo_i32. Any calls to other functions will just return the error code ERR_LASTERR showing that there is an error to be read out.
This error locking functionality will prevent the generation of unseen false commands and settings that may lead to totally unexpected behav­ior. For sure there are only errors locked that result on false commands or settings. Any error code that is generated to report a condition to the user won’t lock the driver. As example the error code ERR_TIMEOUT showing that the a timeout in a wait function has occurred won’t lock the driver and the user can simply react to this error code without reading the complete error function.
As a benefit from this error locking it is not necessary to check the error return of each function call but just checking the error function once at the end of all calls to see where an error occurred. The enhanced error function returns a complete error description that will lead to the call that produces the error.
56 M3i.48xx / M3i.48xx-exp Manual
Programming the Board Gathering information from the card
Example for error checking at end using the error text from the driver:
char szErrorText[ERRORTEXTLEN];
spcm_dwSetParam_i64 (hDrv, SPC_SAMPLERATE, 1000000); // correct command spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, -345); // faulty command spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, 1024); // correct command if (spcm_dwGetErrorInfo_i32 (hDrv, NULL, NULL, szErrorText) != ERR_OK) // check for an error { printf (szErrorText); // print the error text spcm_vClose (hDrv); // close the driver exit (0); // and leave the program }
This short program then would generate a printout as:
Error ocurred at register SPC_MEMSIZE with value -345: value not allowed
All error codes are described in detail in the appendix. Please refer to this error description and the descrip­tion of the software register to examine the cause for the error message.
Any of the parameters of the spcm_dwGetErrorInfo_i32 function can be used to obtain detailed information on the error. If one is not interested in parts of this information it is possible to just pass a NULL (zero) to this variable like shown in the example. If one is not interested in the error text but wants to install its own error handler it may be interesting to just read out the error generating register and value.
Example for error checking with own (simple) error handler:
uint32 dwErrorReg; int32 lErrorValue; uint32 dwErrorCode;
spcm_dwSetParam_i64 (hDrv, SPC_SAMPLERATE, 1000000); // correct command spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, -345); // faulty command spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, 1024); // correct command dwErrorCode = spcm_dwGetErrorInfo_i32 (hDrv, &dwErrorReg, &lErrorValue, NULL); if (dwErrorCode) // check for an error { printf (“Errorcode: %d in register %d at value %d\n”, lErrorCode, dwErrorReg, lErrorValue); spcm_vClose (hDrv); // close the driver exit (0); // and leave the program }

Gathering information from the card

When opening the card the driver library internally reads out a lot of information from the on-board eeprom. The driver also offers additional information on hardware details. All of this information can be read out and used for programming and documentation. This chapter will show all general information that is offered by the driver. There is also some more information on certain parts of the card, like clock machine or trigger machine, that is described in detail in the documentation of that part of the card.
All information can be read out using one of the spcm_dwGetParam functions. Please stick to the “Driver Functions” chapter for more details on this function.

Card type

The card type information returns the specific card type that is found under this device. When using multiple cards in one system it is highly recommended to read out this register first to examine the ordering of cards. Please don’t rely on the card ordering as this is based on the BIOS, the bus connections and the operating system.
Register Value Direction Description
SPC_PCITYP 2000 read Type of board as listed in the table below.
One of the following values is returned, when reading this register. Each card has its own card type constant defined in regs.h. Please note that when reading the card information as a hex value, the lower word shows the digits of the card name while the upper word is a indication for the used bus type.
(c) Spectrum GmbH 57
Gathering information from the card Programming the Board
.
Card type Card type
M3i.4830 TYP_M3I4830 54830h 346160 M3i.4141 TYP_M3I4841 54841h 346177
M3i.4831 TYP_M3I4831 54831h 346161 M3i.4160 TYP_M3I4860 54860h 346208
M3i.4840 TYP_M3I4840 54840h 346176 M3i.4161 TYP_M3I4861 54861h 346209
M3i.4830-exp TYP_M3I4830EXP 64830h 411696 M3i.4841-exp TYP_M3I4841EXP 64841h 411713
M3i.4831-exp TYP_M3I4831EXP 64831h 411697 M3i.4860-exp TYP_M3I4860EXP 64860h 411744
M3i.4840-exp TYP_M3I4840EXP 64840h 411712 M3i.4861-exp TYP_M3I4861EXP 64861h 411745
as defined in regs.h
Value hexadecimal
Value decimal
Card type Card type
as defined in regs.h
Val ue hexadecimal
Val ue decimal

Hardware version

Since all of the boards from Spectrum are modular boards, they consist of one base board and one or two piggy-back front-end modules and eventually of an extension module like the star-hub. Each of these three kinds of hardware has its own version register. Normally you do not need this information but if you have a support question, please provide the revision together with it.
Register Value Direction Description
SPC_PCIVERSION 2010 read Base card version: the upper 16 bit show the hardware (PCB) version, the lower 16 bit show the firm-
SPC_PCIMODULEVERSION 2012 read Module version: the upper 16 bit show the hardware (PCB) version, the lower 16 bit show the firm-
If your board has a additional piggy-back extension module mounted you can get the hardware version with the following register.
Register Value Direction Description
SPC_PCIEXTVERSION 2011 read Extension module version: the upper 16 bit show the hardware (PCB) version, the lower 16 bit show
ware version.
ware version.
the firmware version.

Production date

This register informs you about the production date, which is returned as one 32 bit long word. The upper word is holding the information about the year, while the lower byte informs about the week of the year.
Register Value Direction Description
SPC_PCIDATE 2020 read Production date: week in bit 31 to 16, year in bit 15 to 0
The following example shows how to read out a date and how to interpret the value:
spcm_dwGetParam_i32 (hDrv, SPC_PCIDATE, &lProdDate); printf ("Production: week &d of year &d\n“, (lProdDate >> 16) & 0xffff, lProdDate & 0xffff);

Last calibration date (analog cards only)

This register informs you about the date of the last factory calibration. When receiving a new card this date is similar to the delivery date when the production calibration is done. When returning the card to calibration this information is updated. This date is not updated when just doing an on-board calibration by the user. The date is returned as one 32 bit long word. The upper word is holding the information about the year, while the lower byte informs about the week of the year.
Register Value Direction Description
SPC_CALIBDATE 2025 read Last calibration date: week in bit 31 to 16, year in bit 15 to 0

Serial number

This register holds the information about the serial number of the board. This number is unique and should always be sent together with a support question. Normally you use this information together with the register SPC_PCITYP to verify that multiple measurements are done with the exact same board.
Register Value Direction Description
SPC_PCISERIALNO 2030 read Serial number of the board
58 M3i.48xx / M3i.48xx-exp Manual
Programming the Board Gathering information from the card

Maximum possible sampling rate

This register gives you the maximum possible sampling rate the board can run. The information provided here does not consider any restric­tions in the maximum speed caused by special channel settings. For detailed information about the correlation between the maximum sam­pling rate and the number of activated channels please refer to the according chapter.
Register Value Direction Description
SPC_PCISAMPLERATE 2100 read Maximum sampling rate in Hz as a 32 bit integer value

Installed memory

This register returns the size of the installed on-board memory in bytes as a 64 bit integer value. If you want to know the amount of samples you can store, you must regard the size of one sample of your card. All 8 bit A/D and D/A cards use only one byte per sample, while all other A/D and D/A cards with 12, 14 and 16 bit resolution use two bytes to store one sample. All digital cards need one byte to store 8 data bits.
Register Value Direction Description
SPC_PCIMEMSIZE 2110 read _i32 Installed memory in bytes as a 32 bit integer value. Maximum return value will 1 GByte. If more mem-
SPC_PCIMEMSIZE 2110 read _i64 Installed memory in bytes as a 64 bit integer value
The following example is written for a „two bytes“ per sample card (12, 14 or 16 bit board), on any 8 bit card memory in MSamples is similar to memory in MBytes.
spcm_dwGetParam_i64 (hDrv, SPC_PCIMEMSIZE, &llInstMemsize); printf ("Memory on card: %d MBytes\n", (int32) (llInstMemsize /1024/1024)); printf (" : %d MSamples\n", (int32) (llInstMemsize /1024/1024/2));
ory is installed this function will return the error code ERR_EXCEEDINT32.

Installed features and options

The SPC_PCIFEATURES register informs you about the features, that are installed on the board. If you want to know about one option being installed or not, you need to read out the 32 bit value and mask the interesting bit. In the table below you will find every feature that may be installed on a M2i/M3i/M4i card. Please refer to the ordering information to see which of these features are available for your card series.
Register Value Direction Description
SPC_PCIFEATURES 2120 read PCI feature register. Holds the installed features and options as a bitfield. The read value must be
SPCM_FEAT_MULTI 1h Is set if the feature Multiple Recording / Multiple Replay is available.
SPCM_FEAT_GATE 2h Is set if the feature Gated Sampling / Gated Replay is available.
SPCM_FEAT_DIGITAL 4h Is set if the feature Digital Inputs / Digital Outputs is available.
SPCM_FEAT_TIMESTAMP 8h Is set if the feature Timestamp is available.
SPCM_FEAT_STARHUB8_EXTM 20h Is set on the card, that carries the star-hub extension or piggy-back module for synchronizing up to 8 cards (M4i)
SPCM_FEAT_STARHUB4 20h Is set on the card, that carries the star-hub piggy-back module for synchronizing up to 4 cards (M3i)
SPCM_FEAT_STARHUB5 20h Is set on the card, that carries the star-hub piggy-back module for synchronizing up to 5 cards (M2i)
SPCM_FEAT_STARHUB8 40h Is set on the card, that carries the star-hub piggy-back module for synchronizing up to 8 cards (M3i)
SPCM_FEAT_STARHUB16 40h Is set on the card, that carries the star-hub piggy-back module for synchronizing up to 16 cards (M2i)
SPCM_FEAT_ABA 80h Is set if the feature ABA mode is available.
SPCM_FEAT_BASEXIO 100h Is set if the extra BaseXIO option is installed. The lines can be used for asynchronous digital I/O, extra trigger or
SPCM_FEAT_AMPLIFIER_10V 200h Arbitrary Waveform Generators only: card has additional set of calibration values for amplifier card
SPCM_FEAT_STARHUBSYSMASTER 400h Is set in the card that carries a System Star-Hub Master card to connect multiple systems (M2i)
SPCM_FEAT_DIFFMODE 800h M2i.30xx series only: card has option -diff installed for combining two SE channels to one differential channel
SPCM_FEAT_SEQUENCE 1000h Only available for output cards or I/O cards: Replay sequence mode available.
SPCM_FEAT_AMPMODULE_10V 2000h Is set on the card that has a special amplifier module for mounted (M2i.60xx/61xx only)
SPCM_FEAT_STARHUBSYSSLAVE 4000h Is set in the card that carries a System Star-Hub Slave module to connect with System Star-Hub master systems (M2i)
SPCM_FEAT_NETBOX 8000h The card is physically mounted within a digitizerNETBOX.
SPCM_FEAT_REMOTESERVER 10000h Support for the Spectrum Remote Server option is installed on this card.
SPCM_FEAT_CUSTOMMOD_MASK F0000000h The upper 4 bit of the feature register is used to mark special custom modifications. This is only used if the card has
timestamp reference signal input
been specially customized. Please refer to the extra documentation for the meaning of the custom modification mark.
masked out with one of the masks below to get information about one certain feature.
The following example demonstrates how to read out the information about one feature.
spcm_dwGetParam_i32 (hDrv, SPC_PCIFEATURES, &lFeatures); if (lFeatures & SPCM_FEAT_DIGITAL) printf("Option digital inputs/outputs is installed on your card");
(c) Spectrum GmbH 59
Gathering information from the card Programming the Board
The following example demonstrates how to read out the custom modification code.
spcm_dwGetParam_i32 (hDrv, SPC_PCIFEATURES, &lFeatures); lCustomMod = (lFeatures >> 28) & 0xF; if (lCustomMod != 0) printf("Custom modification no. %d is installed.", lCustomMod);
Installed extended Options and Features
Starting with the cards of the M4i series, some cards can optionally have advanced features installed. This can be read out with with the following register:
Register Value Direction Description
SPC_PCIEXTFEATURES 2121 read PCI extended feature register. Holds the installed extended features and options as a bitfield. The
SPCM_FEAT_EXTFW_SEGSTAT 1h Is set if the firmware option „Block Statistics“ is installed on the board, which allows certain statistics to be on-board
SPCM_FEAT_EXTFW_SEGAVERAGE 2h Is set if the firmware option „Block Average“ is installed on the board, which allows on-board hardware averaging of
calculated for data being recorded in segmented memory modes, such as Multiple Recording or ABA.
data being recorded in segmented memory modes, such as Multiple Recording or ABA.
read value must be masked out with one of the masks below to get information about one certain fea­ture.

Miscellaneous Card Information

Some more detailed card information, that might be useful for the application to know, can be read out with the following registers:
Register Value Direction Description
SPC_MIINST_MODULES 1100 read Number of the installed front-end modules on the card.
SPC_MIINST_CHPERMODULE 1110 read Number of channels installed on one front-end module.
SPC_MIINST_BYTESPERSAMPLE 1120 read Number of bytes used in memory by one sample.
SPC_MIINST_BITSPERSAMPLE 1125 read Resolution of the samples in bits.
SPC_MIINST_MAXADCVALUE 1126 read Decimal code of the full scale value.
SPC_MIINST_MINEXTCLOCK 1145 read Minimum external clock that can be fed in for direct external clock (if available for card model).
SPC_MIINST_MAXEXTCLOCK 1146 read Maximum external clock that can be fed in for direct external clock (if available for card model).
SPC_MIINST_MINEXTREFCLOCK 1148 read Minimum external clock that can be fed in as a reference clock.
SPC_MIINST_MAXEXTREFCLOCK 1149 read Maximum external clock that can be fed in as a reference clock.
SPC_MIINST_ISDEMOCARD 1175 read Returns a value other than zero, if the card is a demo card.

Function type of the card

This register register returns the basic type of the card:
Register Value Direction Description
SPC_FNCTYPE 2001 read Gives information about what type of card it is.
SPCM_TYPE_AI 1h Analog input card (analog acquisition; the 4028 and 4038 also return this value)
SPCM_TYPE_AO 2h Analog output card (arbitrary waveform generators)
SPCM_TYPE_DI 4h Digital input card (logic analyzer card)
SPCM_TYPE_DO 8h Digital output card (pattern generators)
SPCM_TYPE_DIO 10h Digital I/O (input/output) card, where the direction is software selectable.

Used type of driver

This register holds the information about the driver that is actually used to access the board. Although the driver interface doesn’t differ be­tween Windows and Linux systems it may be of interest for a universal program to know on which platform it is working.
Register Value Direction Description
SPC_GETDRVTYPE 1220 read Gives information about what type of driver is actually used
DRVTYP_LINUX32 1 Linux 32bit driver is used
DRVTYP_WDM32 4 Windows WDM 32bit driver is used (XP/Vista/Windows 7/Windows 8/Windows 10).
DRVTYP_WDM64 5 Windows WDM 64bit driver is used by 64bit application (XP64/Vista/Windows 7/Windows 8/Windows 10).
DRVTYP_WOW64 6 Windows WDM 64bit driver is used by 32bit application (XP64/Vista/Windows 7/Windows 8/ Windows 10).
DRVTYP_LINUX64 7 Linux 64bit driver is used
Driver version
This register holds information about the currently installed driver library. As the drivers are permanently improved and maintained and new features are added user programs that rely on a new feature are requested to check the driver version whether this feature is installed.
Register Value Direction Description
SPC_GETDRVVERSION 1200 read Gives information about the driver librar y version
60 M3i.48xx / M3i.48xx-exp Manual
Programming the Board Gathering information from the card
The resulting 32 bit value for the driver version consists of the three version number parts shown in the table below:
Driver Major Version Driver Minor Version Driver Build
8 Bit wide: bit 24 to bit 31 8 Bit wide, bit 16 to bit 23 16 Bit wide, bit 0 to bit 15
Kernel Driver version
This register informs about the actually used kernel driver. Windows users can also get this information from the device manager. Please refer to the „Driver Installation“ chapter. On Linux systems this information is also shown in the kernel message log at driver start time.
Register Value Direction Description
SPC_GETKERNELVERSION 1210 read Gives information about the kernel driver version.
The resulting 32 bit value for the driver version consists of the three version number parts shown in the table below:
Driver Major Version Driver Minor Version Driver Build
8 Bit wide: bit 24 to bit 31 8 Bit wide, bit 16 to bit 23 16 Bit wide, bit 0 to bit 15
The following example demonstrates how to read out the kernel and library version and how to print them.
spcm_dwGetParam_i32 (hDrv, SPC_GETDRVVERSION, &lLibVersion); spcm_dwGetParam_i32 (hDrv, SPC_GETKERNELVERSION, &lKernelVersion); printf("Kernel V %d.%d build %d\n”,lKernelVersion >> 24, (lKernelVersion >> 16) & 0xff, lKernelVersion & 0xffff); printf("Library V %d.%d build %d\n”,lLibVersion >> 24, (lLibVersion >> 16) & 0xff, lLibVersion & 0xffff);
This small program will generate an output like this:
Kernel V 1.11 build 817 Library V 1.1 build 854
(c) Spectrum GmbH 61
Reset Programming the Board

Reset

Every Spectrum card can be reset by software. Concerning the hardware, this reset is the same as the power-on reset when starting the host computer. In addition to the power-on reset, the reset command also brings all internal driver settings to a defined default state. A software reset is automatically performed, when the driver is first loaded after starting the host system.
It is recommended, that every custom written program performs a software reset first, to be sure that the driver is in a defined state independent from possible previous setting.
Performing a board reset can be easily done by the related board command mentioned in the following table.
Register Value Direction Description
SPC_M2CMD 100 w Command register of the board.
M2CMD_CARD_RESET 1h A software and hardware reset is done for the board. All settings are set to the default values. The data in the board’s
on-board memory will be no longer valid. Any output signals like trigger or clock output will be disabled.
62 M3i.48xx / M3i.48xx-exp Manual
Analog Inputs Channel Selection

Analog Inputs

Channel Selection

One key setting that influences all other possible settings is the channel enable register. An unique feature of the Spectrum cards is the pos­sibility to program the number of channels you want to use. All on-board memory can then be used by these activated channels.
This description shows you the channel enable register for the complete card family. However, your specific board may have less channels depending on the card type that you have purchased and therefore does not allow you to set the maximum number of channels shown here.
.
Register Value Direction Description
SPC_CHENABLE 11000 read/write Sets the channel enable information for the next board run.
CHANNEL0 1 Activates channel 0
CHANNEL1 2 Activates channel 1
The channel enable register is set as a bitmap. That means one bit of the value corresponds to one channel to be activated. To activate more than one channel the values have to be combined by a bitwise OR.
Example showing how to activate 2 channels:
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0 | CHANNEL1);
The following table shows all allowed settings for the channel enable register.
Channels to activate Ch0 Ch1 Values to program Value as hex Value as decimal X CHANNEL0 1h 1
X X CHANNEL0 | CHANNEL1 3h 3
X CHANNEL1 2h 2
Any channel activation mask that is not shown here is not valid. If programming another channel activation the driver will return with an error.
To help user programs it is also possible to read out the number of activated channels that correspond to the currently programmed bitmap.
Register Value Direction Description
SPC_CHCOUNT 11001 read Reads back the number of currently activated channels.
Reading out the channel enable information can be done directly after setting it or later like this:
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0 | CHANNEL1); spcm_dwGetParam_i32 (hDrv, SPC_CHENABLE, &lActivatedChannels); spcm_dwGetParam_i32 (hDrv, SPC_CHCOUNT, &lChCount);
printf ("Activated channels bitmask is: 0x%08x\n", lActivatedChannels); printf ("Number of activated channels with this bitmask: %d\n", lChCount);
Assuming that the two channels are available on your card the program will have the following output:
Activated channels bitmask is: 0x00000003 Number of activated channels with this bitmask: 2

Important note on channels selection

As some of the manuals passages are used in more than one hardware manual most of the registers and channel settings throughout this handbook are described for the maximum number of possible channels that are available on one card of the actual series. There can be less channels on your actual type of board or bus-system. Please refer to the table(s) above to get the actual number of available channels.
(c) Spectrum GmbH 63
Setting up the inputs Analog Inputs

Setting up the inputs

This analog acquisition board uses separate input stages and converters on each channel. This gives you the possibility to set up the desired and concerning your application best suiting input range also separately for each channel. All input stage related settings can easily be set by the corresponding input registers. The table below shows the available input stage registers and possible standard values for your type of board. As there are also modified versions available with different input ranges it is recommended to read out the currently available input ranges as shown later in this chapter.

Input Path

Each input stage consists of different input paths each with different available set­tings and features. Please refer to the technical data section to get details on the differences of the input paths.
Offering different input paths gives the choice to adopt the cards input stage to the specific application in the best technical way by either using a high frequency 50 ohm path to have full bandwidth and best dynamic performance or by using a buffered path with all features but limited bandwidth and dynamic performance.
All following settings are related to the selected input path. To read available features like input ranges or termination settings it is first nec­essary to set the input path for which the features are to be read.
Register Value Direction Description
SPC_READAIPATHCOUNT 3120 read Returns the number of available analog input paths
SPC_READAIPATH 3121 read/write Selects the input path which is used to read out the features. Please note that this settings does not
change the current path selection.
The following registers show the available input path settings
Register Value Direction Description
SPC_PATH0 30090 read/write Selects the analog input path for channel 0 (default path is path 0)
SPC_PATH1 30190 read/write Selects the analog input path for channel 1 (default path is path 0)
0 Input Path 0: Buffered inputs
1 Input Path 1: HF input with fixed 50 ohm termination

Input ranges

This analog acquisition board has several different input ranges for each channel. This gives you the possibility to set up the desired and concerning your application best suiting input range also separately for each channel. The input ranges can easily be set by the corresponding input registers. The table below shows the avail­able input registers and possible standard ranges for your type of board. As there are also modified versions available with different input ranges it is recommended to read out the currently available input ranges as shown later in this chapter.
Please note that the available ranges need to be read out separately for each input path. Please set the register SPC_READAIPATH as shown above to select the input path for which the settings should be read. The available Input rages are read out using the following registers.
Register Value Direction Description
SPC_READAIPATH 3121 read/write Selects the input path which is used to read out the features.
SPC_READIRCOUNT 3000 read Returns the number of available input ranges for the input path selected by SPC_READAIPATH
SPC_READRANGEMIN0 4000 read Reads the lower border of input range 0 in mV
SPC_READRANGEMIN1 4001 read Reads the lower border of input range 1 in mV
... ... ...
SPC_READRANGEMAX0 4100 read Reads the upper border of input range 0 in mV
SPC_READRANGEMAX1 4101 read Reads the upper border of input range 1 in mV
... ... ...
64 M3i.48xx / M3i.48xx-exp Manual
Analog Inputs Setting up the inputs
The following example reads out the number of available input ranges and reads and prints the minimum and maximum value of all input ranges.
spcm_dwGetParan_i32 (hDrv, SPC_READAIPATHCOUNT, &lNumOfPaths); for (lPath = 0; lPath < lNumOfPaths; lPath++) { spcm_dwSetParan_i32 (hDrv, SPC_READAIPATH, lPath) spcm_dwGetParam_i32 (hDrv, READIRCOUNT, &lNumberOfRanges); for (i = 0; i < lNumberOfRanges; i++) { spcm_dwGetParam_i32 (hDrv, SPC_READRANGEMIN0 + i, &lMinimumInputRage); spcm_dwGetParam_i32 (hDrv, SPC_READRANGEMAX0 + i, &lMaximumInputRange); printf („Path %d Range %d: %d mV to %d mV\n“, lPath, i, lMinimumInputRange, lMaximumInputRange); } }
The input range is selected individually for each channel. Please note that the correct input path needs to be set
Register Value Direction Description
SPC_AMP0 30010 read/write Defines the input range of channel0.
SPC_AMP1 30110 read/write Defines the input range of channel1.
Standard Input ranges of path 0 (Buffered):
200 ± 200 mV calibrated input range for the appropriate channel.
500 ± 500 mV calibrated input range for the appropriate channel.
1000 ± 1 V calibrated input range for the appropriate channel.
2000 ± 2 V calibrated input range for the appropriate channel.
5000 ± 5 V calibrated input range for the appropriate channel.
10000 ± 10 V calibrated input range for the appropriate channel.
Standard Input ranges of path 1 (HF, 50 ohm terminated):
500 ± 500 mV calibrated input range for the appropriate channel.
1000 ± 1 V calibrated input range for the appropriate channel.
2500 ± 2.5 V calibrated input range for the appropriate channel.
5000 ± 5 V calibrated input range for the appropriate channel.

Read out of input features

Each input path has different features that can be read out to make the software more general. If you only operate one single card type in your software it is not necessary to read out these features.
Please note that the input features are read out for the currently selected read AI path done by register SPC_READAIPATH. Please also note that the following table shows all input features settings that are available throughout all Spectrum acquisition cards. Some of these features are not installed on your specific hardware. The columns for the input paths show which settings are available for which input path on a standard card:
Register Value Direction Description
SPC_READAIPATH 3121 read/write Selects the input path which is used to read out the features. Please note that this settings does not
SPC_READAIFEATURES 3101 read Returns a bit map with the available features of that input path. The possible return values are listed
Value Path 0 Path 1 Description
SPCM_AI_TERM 00000001h x fixed Programmable input termination available
SPCM_AI_SE 00000002h fixed fixed Input is single-ended. If available together with SPC_AI_DIFF: input type is software selectable
SPCM_AI_DIFF 00000004h Input is differential. If available together with SPC_AI_SE: input type is software selectable
SPCM_AI_OFFSPERCENT 00000008h x x Input offset programmable in per cent of input range
SPCM_AI_OFFSMV 00000010h Input offset programmable in mV
SPCM_AI_OVERRANGEDETECT 00000020h Programmable overrange detection available
SPCM_AI_DCCOUPLING 00000040h x x Input is DC coupled. If available together with AC coupling: coupling is software selectable
SPCM_AI_ACCOUPLING 00000080h x x Input is AC coupled. If available together with DC coupling: coupling is software selectable
SPCM_AI_LOWPASS 00000100h x x Input has a selectable low pass filter (bandwidth limit)
SPCM_AI_ACDC_OFFS_COMP 00000200h Input has a selectable offset compensation for HF-Path with AC/DC coupling/source missmatch.
SPCM_AI_AUTOCALOFFS 00001000h x x Input offset can be auto calibrated on the card
SPCM_AI_AUTOCALGAIN 00002000h x Input gain can be auto calibrated on the card
SPCM_AI_AUTOCALOFFSNOIN 00004000h Input offset can auto calibrated on the card if inputs are left open
SPCM_AI_INDIVPULSEWIDTH 00010000h Trigger pulsewidth is individually per channel programmable
change the current path selection.
below.
(c) Spectrum GmbH 65
Setting up the inputs Analog Inputs
The following example shows a setup of path and input range of a two channel card.
Please note that this is a general example and the number of input channels may not match your card channels.
spcm_dwSetParam_i32 (hDrv, SPC_PATH0 , 0); // Set up channel0 to input path 0 (buffered) spcm_dwSetParam_i32 (hDrv, SPC_AMP0 , 1000); // Set up channel0 to the range of ± 1.0 V spcm_dwSetParam_i32 (hDrv, SPC_PATH1 , 1); // Set up channel1 to input path 1 (HF, 50 ohm terminated) spcm_dwSetParam_i32 (hDrv, SPC_AMP1 , 500); // Set up channel1 to the range of ± 0.5 V

Input termination

The Spectrum analog acquisition cards of the M3i series offer an input path with fixed 50 ohm termination (HF path, 50 ohm path) as well as a second input path with all features to be programmed by the user (buffered path). If the HF path with fixed 50 ohm termination is activated this register will have no functionality.
The buffered input path can be terminated separately with 50 Ohm by software programming. If you do so, please make sure that your signal source is able to deliver the higher output currents. If no termination is used, the inputs have an im­pedance of 1 Megaohm. The following table shows the corresponding register to set the input termination.
Register Value Direction Description
SPC_50OHM0 30030 read/write A „1“ sets the 50 ohm termination for channel0. A „0“ sets the termination to1 MOhm.
SPC_50OHM1 30130 read/write A „1“ sets the 50 ohm termination for channel1. A „0“ sets the termination to1 MOhm.

Input coupling

All inputs can be set separately switched to AC or DC coupling. Please refer to the technical data section to see the signal frequency range that is available for the different settings.
Using the AC coupling will eliminate all DC and low frequency parts of the input signal and allows best quality measurings in the frequency domain even if the DC level of the signal varies over the time.
The following table shows the corresponding register to set the input coupling.
Register Value Direction Description
SPC_ACDC0 30020 read/write A „1“ sets the AC coupling for channel0. A „0“ sets the DC coupling (default is DC)
SPC_ACDC1 30120 read/write A „1“ sets the AC coupling for channel1. A „0“ sets the DC coupling (default is DC)

AC/DC offset compensation

When using the HF-Path of the input channel, an offset voltage will be visible in case DC coupling is selected for the channel and the signal source is externally AC coupled. This offset can be compensated for by setiing the compensation registers:
Register Value Direction Description
SPC_ACDC_OFFS_COMPENSATION0 30021 read/write A „1“ enables the compensation. A „0“ disables the compensation (default).
SPC_ACDC_OFFS_COMPENSATION1 30121 read/write A „1“ enables the compensation. A „0“ disables the compensation (default).

Anti aliasing filter (Bandwidth limit)

All inputs have a separate selectable anti aliasing filter (bandwidth limit) that will cut of any aliasing effectes and that will reduce signal noise.
Please note that this bandwidth limit filter will also cut of any distortion or high frequency spurious signals parts that are within the frequency spectrum of the input.
Please refer to the technical data section to see the cut off frequency and the type of filter used. The following table shows the corresponding register to activate the bandwidth limit.
66 M3i.48xx / M3i.48xx-exp Manual
Analog Inputs Setting up the inputs
Register Value Direction Description
SPC_FILTER0 30080 read/write A „1“ selects the bandwidth limit for channel 0. A „0“ set the channel to full bandwidth (default is full)
SPC_FILTER1 30180 read/write A „1“ selects the bandwidth limit for channel 1. A „0“ set the channel to full bandwidth (default is full

Enhanced Status Register

The enhanced status register shows detected channel overrange events during the last acquisition. It can only be read out after the acquisition has stopped. If the input signal on the channel exceeds the programmed input range even for just one time the overrange register is set in hardware.
Register Value Direction Description
SPC_ENHANCEDSTATUS 20900 read Reads out the enhanced status information of the card.
SPC_ENHSTAT_OVERRANGE0 00000001h Bit is set if an overrange event has occurred on channel 0.
SPC_ENHSTAT_OVERRANGE1 00000002h Bit is set if an overrange event has occurred on channel 1.

Automatic on-board calibration of the offset and gain settings

All of the channels are calibrated in factory before the board is shipped. These values are stored in the on-board EEProm under the default settings. If you have asymmetrical signals, you can adjust the offset easily with the corresponding registers of the inputs as shown before.
To start the automatic offset adjustment, simply write the register, mentioned in the following table.
Before you start an automatic offset adjustment make sure, that no signal is connected to any input. Leave all the input connectors open and then start the adjustment. All the internal settings of the driver are changed, while the automatic offset compensation is in progress.
Register Value Direction Description
SPC_ADJ_AUTOADJ 50020 write Performs the automatic offset compensation in the driver either for all input ranges or only the actual.
ADJ_ALL 0 Automatic offset adjustment for all input ranges.
As all settings are temporarily stored in the driver, the automatic adjustment will only affect these values. After exiting your program, all cal­ibration information will be lost. To give you a possibility to save your own settings, most Spectrum card have at least one set of user settings that can be saved within the on-board EEPROM. The default settings of the offset and gain values are then read-only and cannot be written to the EEPROM by the user. If the card has no user settings the default settings may be overwritten.
You can easily either save adjustment settings to the EEPROM with SPC_ADJ_SAVE or recall them with SPC_ADJ_LOAD. These two registers are shown in the table below. The values for these EEPROM access registers are the sets that can be stored within the EEPROM. The amount of sets available for storing user offset settings depends on the type of board you use. The table below shows all the EEPROM sets, that are available for your board.
Register Value Direction Description
SPC_ADJ_LOAD 50000 write Loads the specified set of settings from the EEPROM. The default settings are automatically loaded,
read Reads out, what kind of settings have been loaded last.
SPC_ADJ_SAVE 50010 write Stores the actual settings to the specified set in the EEPROM.
read Reads out, what kind of settings have been saved last.
ADJ_DEFAULT 0 Default settings, no user settings available
when the driver is started.
If you want to make an offset and gain adjustment on all the channels and store the data to the ADJ_DEFAULT set of the EEPROM you can do this the way, the following example shows.
spcm_dwSetParam_i32 (hDrv, SPC_ADJ_AUTOADJ, ADJ_ALL ); // Activate offset/gain adjustment on all channels spcm_dwSetParam_i32 (hDrv, SPC_ADJ_SAVE , ADJ_DEFAULT); // and store values to DEFAULT set in the EEPROM
(c) Spectrum GmbH 67
Overview Acquisition modes

Acquisition modes

Your card is able to run in different modes. Depending on the selected mode there are different registers that each define an aspect of this mode. The single modes are explained in this chapter. Any further modes that are only available if an option is installed on the card is doc­umented in a later chapter.

Overview

This chapter gives you a general overview on the related registers for the different modes. The use of these registers throughout the different modes is described in the following chapters.

Setup of the mode

The mode register is organized as a bitmap. Each mode corresponds to one bit of this bitmap. When defining the mode to use, please be sure just to set one of the bits. All other settings will return an error code.
The main difference between all standard and all FIFO modes is that the standard modes are limited to on-board memory and therefore can run with full sampling rate. The FIFO modes are designed to transfer data continuously over the bus to PC memory or to hard disk and can therefore run much longer. The FIFO modes are limited by the maximum bus transfer speed the PC can use. The FIFO mode uses the complete installed on-board memory as a FIFO buffer.
However as you’ll see throughout the detailed documentation of the modes the standard and the FIFO mode are similar in programming and behavior and there are only a very few differences between them.
Register Value Direction Description
SPC_CARDMODE 9500 read/write Defines the used operating mode, a read command will return the currently used mode.
SPC_AVAILCARDMODES 9501 read Returns a bitmap with all available modes on your card. The modes are listed below.
Acquisition modes
Mode Value Available
SPC_REC_STD_SINGLE 1h M2i/M3i Data acquisition to on-board memory for one single trigger event.
SPC_REC_STD_MULTI 2h M2i/M3i Data acquisition to on-board memory for multiple trigger events. Each recorded segment has the same size. This
SPC_REC_STD_ABA 8h M2i/M3i Data acquisition to on-board memory for multiple trigger events. While the multiple trigger events are stored with pro-
SPC_REC_FIFO_SINGLE 10h M2i/M3i Continuous data acquisition for one single trigger event. The on-board memory is used completely as FIFO buffer.
SPC_REC_FIFO_MULTI 20h M2i/M3i Continuous data acquisition for multiple trigger events.
SPC_REC_FIFO_ABA 80h M2i/M3i Continuous data acquisition for multiple trigger events together with continuous data acquisition with a slower sam-
for series
Description
mode is described in greater detail in a special chapter about the Multiple Recording option.
grammed sampling rate the inputs are sampled continuously with a slower sampling speed. The mode is described in a special chapter about ABA mode option.
pling clock.

Commands

The data acquisition/data replay is controlled by the command register. The command register controls the state of the card in general and also the state of the different data transfers. Data transfers are explained in an extra chapter later on.
The commands are split up into two types of commands: execution commands that fulfill a job and wait commands that will wait for the occurrence of an interrupt. Again the commands register is organized as a bitmap allowing you to set several commands together with one call. As not all of the command combinations make sense (like the combination of reset and start at the same time) the driver will check the given command and return an error code ERR_SEQUENCE if one of the given commands is not allowed in the current state.
Register Value Direction Description
SPC_M2CMD 100 write only Executes a command for the card or data transfer.
68 M3i.48xx / M3i.48xx-exp Manual
Acquisition modes Commands
Card execution commands
M2CMD_CARD_RESET 1h Performs a hard and software reset of the card as explained further above.
M2CMD_CARD_WRITESETUP 2h Writes the current setup to the card without starting the hardware. This command may be useful if changing some
M2CMD_CARD_START 4h Starts the card with all selected settings. This command automatically writes all settings to the card if any of the set-
M2CMD_CARD_ENABLETRIGGER 8h The trigger detection is enabled. This command can be either send together with the start command to enable trigger
M2CMD_CARD_FORCETRIGGER 10h This command forces a trigger even if none has been detected so far. Sending this command together with the start
M2CMD_CARD_DISABLETRIGGER 20h The trigger detection is disabled. All further trigger events are ignored until the trigger detection is again enabled.
M2CMD_CARD_STOP 40h Stops the current run of the card. If the card is not running this command has no effect.
internal settings like clock frequency and enabling outputs.
tings has been changed since the last one was written. After card has been started none of the settings can be changed while the card is running.
immediately or in a second call after some external hardware has been started.
command is similar to using the software trigger.
When starting the card the trigger detection is started disabled.
Card wait commands
These commands do not return until either the defined state has been reached which is signaled by an interrupt from the card or the timeout counter has expired. If the state has been reached the command returns with an ERR_OK. If a timeout occurs the command returns with ERR_TIMEOUT. If the card has been stopped from a second thread with a stop or reset command, the wait function returns with ERR_ABORT.
M2CMD_CARD_WAITPREFULL 1000h Acquisition modes only: the command waits until the pretrigger area has once been filled with data. After pretrigger
M2CMD_CARD_WAITTRIGGER 2000h Waits until the first trigger event has been detected by the card. If using a mode with multiple trigger events like Multi-
M2CMD_CARD_WAITREADY 4000h Waits until the card has completed the current run. In an acquisition mode receiving this command means that all data
area has been filled the internal trigger engine starts to look for trigger events if the trigger detection has been enabled.
ple Recording or Gated Sampling there only the first trigger detection will generate an interrupt for this wait com­mand.
has been acquired. In a generation mode receiving this command means that the output has stopped.
Wait command timeout
If the state for which one of the wait commands is waiting isn’t reached any of the wait commands will either wait forever if no timeout is defined or it will return automatically with an ERR_TIMEOUT if the specified timeout has expired.
Register Value Direction Description
SPC_TIMEOUT 295130 read/write Defines the timeout for any following wait command in a milli second resolution. Writing a zero to
this register disables the timeout.
As a default the timeout is disabled. After defining a timeout this is valid for all following wait commands until the timeout is disabled again by writing a zero to this register.
A timeout occurring should not be considered as an error. It did not change anything on the board status. The board is still running and will complete normally. You may use the timeout to abort the run after a certain time if no trigger has occurred. In that case a stop command is necessary after receiving the timeout. It is also possible to use the timeout to update the user interface frequently and simply call the wait function afterwards again.
Example for card control:
// card is started and trigger detection is enabled immediately spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER);
// we wait a maximum of 1 second for a trigger detection. In case of timeout we force the trigger spcm_dwSetParam_i32 (hDrv, SPC_TIMEOUT, 1000); if (spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_WAITTRIGGER) == ERR_TIMEOUT) { printf (“No trigger detected so far, we force a trigger now!\n”); spcm_dwSetParam (hdrv, SPC_M2CMD, M2CMD_CARD_FORCETRIGGER); }
// we disable the timeout and wait for the end of the run spcm_dwSetParam_i32 (hDrv, SPC_TIMEOUT, 0); spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_WAITREADY); printf (“Card has stopped now!\n”);

Card Status

In addition to the wait for an interrupt mechanism or completely instead of it one may also read out the current card status by reading the SPC_M2STATUS register. The status register is organized as a bitmap showing the status of the card and also of the different data transfers.
Register Value Direction Description
SPC_M2STATUS 110 read only Reads out the current status information
M2STAT_CARD_PRETRIGGER 1h Acquisition modes only: the pretrigger area has been filled.
M2STAT_CARD_TRIGGER 2h The first trigger has been detected.
M2STAT_CARD_READY 4h The card has finished its run and is ready.
(c) Spectrum GmbH 69
Commands Acquisition modes

Acquisition cards status overview

The following drawing gives you an overview of the card commands and card status information. After start of card with M2CMD_CARD_START the card is acquiring pretrigger data until one time complete pretrigger data has been acquired. Then the status M2STAT_CARD_PRETRIGGER is set. Either the trigger has been enabled together with the start command or the card now waits for trigger enable command M2CMD_CARD_ENABLETRIGGER. After receiving this command the trigger engine is enabled and card checks for a trig­ger event. As soon as the trigger event is received the status changes to M2STAT_CARD_TRIGGER and the card acquires the programmed posttrigger data. After all post trigger data has been acquired the status changes to M2STAT_CARD_READY and data can be read out:

Generation card status overview

This drawing gives an overview of the card commands and status information for a simple generation mode. After start of card with the M2CMD_CARD_START the card is armed and waiting. Either the trigger has been enabled together with the start command or the card now waits for trigger enable command M2CMD_CARD_ENABLETRIGGER. After receiving this command the trigger engine is enabled and card checks for a trigger event. As soon as the trigger event is received the status changes to M2STAT_CARD_TRIGGER and the card starts with the data replay. After replay has been finished - depending on the programmed mode - the status changes to M2STAT_CARD_READY and the card stops.

Data Transfer

Data transfer consists of two parts: the buffer definition and the commands/status information that controls the transfer itself. Data transfer shares the command and status register with the card control commands and status information. In general the following details on the data transfer are valid for any data transfer in any direction:
• The memory size register (SPC_MEMSIZE) must be programmed before starting the data transfer.
• Before starting a data transfer the buffer must be defined using the spcm_dwDefTransfer function.
• Each defined buffer is only used once. After transfer has ended the buffer is automatically invalidated.
• If a buffer has to be deleted although the data transfer is in progress or the buffer has at least been defined it is necessary to call the spcm_dwInvalidateBuf function.
Definition of the transfer buffer
Before any data transfer can start it is necessary to define the transfer buffer with all its details. The definition of the buffer is done with the spcm_dwDefTransfer function as explained in an earlier chapter.
uint32 _stdcall spcm_dwDefTransfer_i64 (// Defines the transfer buffer by using 64 bit unsigned integer values drv_handle hDevice, // handle to an already opened device uint32 dwBufType, // type of the buffer to define as listed below under SPCM_BUF_XXXX uint32 dwDirection, // the transfer direction as defined below uint32 dwNotifySize, // number of bytes after which an event is sent (0=end of transfer) void* pvDataBuffer, // pointer to the data buffer uint64 qwBrdOffs, // offset for transfer in board memory uint64 qwTransferLen); // buffer length
70 M3i.48xx / M3i.48xx-exp Manual
Acquisition modes Commands
This function is used to define buffers for standard sample data transfer as well as for extra data transfer for additional ABA or timestamp information. Therefore the dwBufType
SPCM_BUF_DATA 1000 Buffer is used for transfer of standard sample data
SPCM_BUF_ABA 2000 Buffer is used to read out slow ABA data. Details on this mode are described in the chapter about the ABA mode
SPCM_BUF_TIMESTAMP 3000 Buffer is used to read out timestamp information. Details on this mode are described in the chapter about the
parameter can be one of the following:
option
timestamp option.
The dwDirection
parameter defines the direction of the following data transfer:
SPCM_DIR_PCTOCARD 0 Transfer is done from PC memory to on-board memory of card
SPCM_DIR_CARDTOPC 1 Transfer is done from card on-board memory to PC memory.
The direction information used here must match the currently used mode. While an acquisition mode is used there’s no transfer from PC to card allowed and vice versa. It is possible to use a special memory test mode to come beyond this limit. Set the SPC_MEMTEST register as defined further below.
The dwNotifySize
parameter defines the amount of bytes after which an interrupt should be generated. If leaving this parameter zero, the transfer will run until all data is transferred and then generate an interrupt. Filling in notify size > zero will allow you to use the amount of data that has been transferred so far. The notify size is used on FIFO mode to implement a buffer handshake with the driver or when trans­ferring large amount of data where it may be of interest to start data processing while data transfer is still running. Please see the chapter on handling positions further below for details.
The Notify size sticks to the page size which is defined by the PC hardware and the operating system. There­fore the notify size must be a multiple of 4 kByte. For data transfer it may also be a fraction of 4k in the range of 16, 32, 64, 128, 256, 512, 1k or 2k. No other values are allowed. For ABA and timestamp the notify size can be 2k as a minimum. If you need to work with ABA or timestamp data in smaller chunks please use the polling mode as described later.
The pvDataBuffer
must point to an allocated data buffer for the transfer. Please be sure to have at least the amount of memory allocated that you program to be transferred. If the transfer is going from card to PC this data is overwritten with the current content of the card on-board memory.
When not doing FIFO mode one can also use the qwBrdOffs
parameter. This parameter defines the starting position for the data transfer as byte value in relation to the beginning of the card memory. Using this parameter allows it to split up data transfer in smaller chunks if one has acquired a very large on-board memory.
The qwTransferLen
parameter defines the number of bytes that has to be transferred with this buffer. Please be sure that the allocated memory has at least the size that is defined in this parameter. In standard mode this parameter cannot be larger than the amount of data defined with memory size.
Memory test mode
In some cases it might be of interest to transfer data in the opposite direction. Therefore a special memory test mode is available which allows random read and write access of the complete on-board memory. While memory test mode is activated no normal card commands are pro­cessed:
Register Value Direction Description
SPC_MEMTEST 200700 read/write Writing a 1 activates the memory test mode, no commands are then processed.
Writing a 0 deactivates the memory test mode again.
Invalidation of the transfer buffer
The command can be used to invalidate an already defined buffer if the buffer is about to be deleted by user. This function is automatically called if a new buffer is defined or if the transfer of a buffer has completed
uint32 _stdcall spcm_dwInvalidateBuf ( // invalidate the transfer buffer drv_handle hDevice, // handle to an already opened device uint32 dwBufType); // type of the buffer to invalidate as listed above under SPCM_BUF_XXXX
The dwBufType
parameter need to be the same parameter for which the buffer has been defined:
SPCM_BUF_DATA 1000 Buffer is used for transfer of standard sample data
SPCM_BUF_ABA 2000 Buffer is used to read out slow ABA data. Details on this mode are described in the chapter about the ABA mode
SPCM_BUF_TIMESTAMP 3000 Buffer is used to read out timestamp information. Details on this mode are described in the chapter about the times-
option. The ABA mode is only available on analog acquisition cards.
tamp option. The timestamp mode is only available on analog or digital acquisition cards.
(c) Spectrum GmbH 71
Standard Single acquisition mode Acquisition modes
Commands and Status information for data transfer buffers.
As explained above the data transfer is performed with the same command and status registers like the card control. It is possible to send commands for card control and data transfer at the same time as shown in the examples further below.
Register Value Direction Description
SPC_M2CMD 100 write only Executes a command for the card or data transfer
M2CMD_DATA_STARTDMA 10000h Starts the DMA transfer for an already defined buffer. In acquisition mode it may be that the card hasn’t received a
M2CMD_DATA_WAITDMA 20000h Waits until the data transfer has ended or until at least the amount of bytes defined by notify size are available. This
M2CMD_DATA_STOPDMA 40000h Stops a running DMA transfer. Data is invalid afterwards.
trigger yet, in that case the transfer start is delayed until the card receives the trigger event
wait function also takes the timeout parameter described above into account.
The data transfer can generate one of the following status information:
Register Value Direction Description
SPC_M2STATUS 110 read only Reads out the current status information
M2STAT_DATA_BLOCKREADY 100h The next data block as defined in the notify size is available. It is at least the amount of data available but it also can
M2STAT_DATA_END 200h The data transfer has completed. This status information will only occur if the notify size is set to zero.
M2STAT_DATA_OVERRUN 400h The data transfer had on overrun (acquisition) or underrun (replay) while doing FIFO transfer.
M2STAT_DATA_ERROR 800h An internal error occurred while doing data transfer.
be more data.
Example of data transfer
void* pvData = (void*) new int8[1024];
// transfer data from PC memory to card memory spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD , 0, pvData, 0, 1024); spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA);
// transfer the same data back to PC memory spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC , 0, pvData, 0, 1024); spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA);
// explicitely stop DMA tranfer prior to invalidating buffer spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STOPDMA); delete [] (int8*) pvData;
To keep the example simple it does no error checking. Please be sure to check for errors if using these command in real world programs!
Users should take care to explicitly send the M2CMD_DATA_STOPDMA command prior to invalidating the buffer, to avoid crashes due to race conditions when using higher-latency data transportation layers, such as to remote Ethernet devices.

Standard Single acquisition mode

The standard single mode is the easiest and mostly used mode to acquire analog data with a Spectrum acquisition card. In standard single recording mode the card is working totally independent from the PC, after the card setup is done. The advantage of the Spectrum boards is that regardless to the system usage the card will sample with equidistant time intervals. The sampled and converted data is stored in the on-board memory and is held there for being read out after the acquisition. This mode allows sampling at very high conversion rates without the need to transfer the data into the memory of the host system at high speed. After the recording is done, the data can be read out by the user and is transferred via the bus into PC memory.
This standard recording mode is the most common mode for all an­alog and digital acquisition and oscilloscope boards. The data is written to a programmed amount of the on-board memory (mem­size). That part of memory is used as a ring buffer, and recording is done continuously until a trigger event is detected. After the trig­ger event, a certain programmable amount of data is recorded (post trigger) and then the recording finishes. Due to the continuous ring buffer recording, there are also samples prior to the trigger event in the memory (pretrigger).
When the card is started the pre trigger area is filled up with data first. While doing this the board’s trigger detection is not armed. If you use a huge pre trigger size and a slow sample rate it can take up some time after starting the board before a trigger event will be detected.
72 M3i.48xx / M3i.48xx-exp Manual
Acquisition modes FIFO Single acquisition mode

Card mode

The card mode has to be set to the correct mode SPC_REC_STD_SINGLE.
Register Value Direction Description
SPC_CARDMODE 9500 read/write Defines the used operating mode, a read command will return the currently used mode.
SPC_REC_STD_SINGLE 1h Data acquisition to on-board memory for one single trigger event.

Memory, Pre- and Posttrigger

At first you have to define, how many samples are to be recorded at all and how many of them should be acquired after the trigger event has been detected.
Register Value Direction Description
SPC_MEMSIZE 10000 read/write Sets the memory size in samples per channel.
SPC_POSTTRIGGER 10100 read/write Sets the number of samples to be recorded after the trigger event has been detected.
You can access these settings by the registers SPC_MEMSIZE, which sets the total amount of data that is recorded, and the register SPC_POSTTRIGGER, that defines the number of samples to be recorded after the trigger event has been detected. The size of the pretrigger results on the simple formula:
pretrigger = memsize - posttrigger
The maximum memsize that can be use for recording is of course limited by the installed amount of memory and by the number of channels to be recorded. Please have a look at the topic "Limits of pre, post memsize, loops" later in this chapter.

Example

The following example shows a simple standard single mode data acquisition setup with the read out of data afterwards. To keep this example simple there is no error checking implemented.
int32 lMemsize = 16384; // recording length is set to 16 kSamples
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0); // only one channel activated spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_SINGLE); // set the standard single recording mode spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, lMemsize); // recording length spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, 8192); // samples to acquire after trigger = 8k
// now we start the acquisition and wait for the interrupt that signalizes the end spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY);
void* pvData = new int16[lMemsize];
// read out the data spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC , 0, pvData, 0, 2 * lMemsize); spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA);

FIFO Single acquisition mode

The FIFO single mode does a continuous data acquisition using the on-board memory as a FIFO buffer and transferring data continuously to PC memory. One can make on-line calculations with the acquired data, store the data continuously to disk for later use or even have a data logger functionality with on-line data display.

Card mode

The card mode has to be set to the correct mode SPC_REC_FIFO_SINGLE.
Register Value Direction Description
SPC_CARDMODE 9500 read/write Defines the used operating mode, a read command will return the currently used mode.
SPC_REC_FIFO_SINGLE 10h Continuous data acquisition to PC memor y. Complete on-board memory is used as FIFO buffer.

Length and Pretrigger

Even in FIFO mode it is possible to program a pretrigger area. In general FIFO mode can run forever until it is stopped by an explicit user command or one can program the total length of the transfer by two counters Loop and Segment size
Register Value Direction Description
SPC_PRETRIGGER 10030 read/write Programs the number of samples to be acquired before the trigger event detection
SPC_SEGMENTSIZE 10010 read/write Length of segments to acquire.
SPC_LOOPS 10020 read/write Number of segments to acquire in total. If set to zero the FIFO mode will run continuously until it is
stopped by the user.
(c) Spectrum GmbH 73
FIFO Single acquisition mode Acquisition modes
The total amount of samples per channel that is acquired can be calculated by [SPC_LOOPS * SPC_SEGMENTSIZE]. Please stick to the below mentioned limitations of the registers.

Difference to standard single acquisition mode

The standard modes and the FIFO modes differ not very much from the programming side. In fact one can even use the FIFO mode to get the same behavior like the standard mode. The buffer handling that is shown in the next chapter is the same for both modes.
Pretrigger
When doing standard single acquisition memory is used as a circular buffer and the pre trigger can be up to the [installed memory] - [minimum post trigger]. Compared to this the pre trigger in FIFO mode is limited by a special pre trigger FIFO and can only be much less.
Length of acquisition.
In standard mode the acquisition length is defined before the start and is limited to the installed on-board memory whilst in FIFO mode the acquisition length can either be defined or it can run continuously until user stops it.

Example FIFO acquisition

The following example shows a simple FIFO single mode data acquisition setup with the read out of data afterwards. To keep this example simple there is no error checking implemented.
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0); // only one channel activated spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_FIFO_SINGLE); // set the FIFO single recording mode spcm_dwSetParam_i32 (hDrv, SPC_PRETRIGGER, 1024); // 1 kSample of data before trigger
// in FIFO mode we need to define the buffer before starting the transfer int16* pnData = new int16[lBufsizeInSamples]; spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 4096, (void*) pnData, 0, 2 * lBufsizeInSamples);
// now we start the acquisition and wait for the first block dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA);
// we acquire data in a loop. As we defined a notify size of 4k we’ll get the data in >=4k chuncks llTotalBytes = 0; while (!dwError) { // read out the available bytes spcm_dwGetParam_i64 (hDrv, SPC_DATA_AVAIL_USER_LEN, &llAvailBytes); llTotalBytes += llAvailBytes;
// here is the right position to do something with the data (printf is limited to 32 bit variables) printf ("Currently Available: %d, total: %d\n", (int32) llAvailBytes, (int32) llTotalBytes);
// now we free the number of bytes and wait for the next buffer spcm_dwSetParam_i64 (hDrv, SPC_DATA_AVAIL_CARD_LEN, llAvailBytes); dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_WAITDMA); }

Limits of pre trigger, post trigger, memory size

The maximum memory size parameter is only limited by the number of activated channels and by the amount of installed memory. Please keep in mind that each samples needs 2 bytes of memory to be stored. Minimum memory size as well as minimum and maximum post trigger limits are independent of the activated channels or the installed memory.
Due to the internal organization of the card memory there is a certain stepsize when setting these values that has to be taken into account. The following table gives you an overview of all limits concerning pre trigger, post trigger, memory size, segment size and loops. The table shows all values in relation to the installed memory size in samples. If more memory is installed the maximum memory size figures will increase according to the complete installed memory
Activated Used Memory size Pre trigger Post trigger Segment size Loops Channels Mode SPC_MEMSIZE SPC_PRETRIGGER SPC_POSTTRIGGER SPC_SEGMENTSIZE SPC_LOOPS
1 channel Standard Single 16 Mem 8 defined by post trigger 8 8G - 8 8 not used not used
Standard Multi/ABA 16 Mem 8 8 8k 8 8 Mem/2 8 16 Mem/2 8 not used FIFO Single not used 8 8k 8 not used 16 8G - 8 8 0 ()4G - 1 1 FIFO Multi/ABA not used 8 8k 8 8 8G - 8 8 16 pre+post 8 0 ()4G - 1 1
2 channels Standard Single 16 Mem/2 8 defined by post trigger 8 8G - 8 8 not used not used
Standard Multi/ABA 16 Mem/2 8 8 4k 8 8 Mem/4 8 16 Mem/4 8 not used FIFO Single not used 8 4k 8 not used 16 8G - 8 8 0 ()4G - 1 1 FIFO Multi/ABA not used 8 4k 8 8 8G - 8 8 16 pre+post 8 0 ()4G - 1 1
All figures listed here are given in samples. An entry of [32G - 8] means [32 GSamples - 8 ] = 34,359,738,360 samples.
74 M3i.48xx / M3i.48xx-exp Manual
Min Max Step Min Max Step Min Max Step Min Max Step Min Max Step
Acquisition modes Buffer handling
The given memory and memory / divider figures depend on the installed on-board memory as listed below:
Mem 128 MSample 256 MSample 512 MSample 1 GSample 2 GSample
128 MSample 256 MSample 512 MSample 1 GSample 2 GSample
Mem / 2 64 MSample 128 MSample 256 MSample 512 MSample 1 GSample Mem / 4 32 MSample 64 MSample 128 MSample 256 MSample 512 MSample
Installed Memory
Please keep in mind that this table shows all values at once. Only the absolute maximum and minimum values are shown. There might be additional limitations. Which of these values is programmed depends on the used mode. Please read the detailed documentation of the mode.

Buffer handling

To handle the huge amount of data that can possibly be acquired with the M2i/M3i series cards, there is a very reliable two step buffer strategy set up. The on-board memory of the card can be completely used as a real FIFO buffer. In addition a part of the PC memory can be used as an additional software buffer. Transfer between hardware FIFO and software buffer is performed interrupt driven and automatically by the driver to get best performance. The following drawing will give you an overview of the structure of the data transfer handling:
A data buffer handshake is implemented in the driver which allows to run the card in different data transfer modes. The software transfer buffer is handled as one large buffer which is on the one side controlled by the driver and filled automatically by busmaster DMA from/to the hardware FIFO buffer and on the other hand it is handled by the user who set’s parts of this software buffer available for the driver for further transfer. The handshake is fulfilled with the following 3 software registers:
Register Value Direction Description
SPC_DATA_AVAIL_USER_LEN 200 read Returns the number of currently to the user available bytes inside a sample data transfer.
SPC_DATA_AVAIL_USER_POS 201 read Returns the position as byte index where the currently available data samples start.
SPC_DATA_AVAIL_CARD_LEN 202 write Writes the number of bytes that the card can now use for sample data transfer again
Internally the card handles two counters, a user counter and a card counter. Depending on the transfer direction the software registers have slightly different meanings:
Transfer direction Register Direction Description
Write to card SPC_DATA_AVAIL_USER_LEN read This register contains the currently available number of bytes that are free to write new data to the
SPC_DATA_AVAIL_CARD_LEN write After filling an amount of the buffer with new data to transfer to card, the user tells the driver with this
Read from card SPC_DATA_AVAIL_USER_LEN read This register contains the currently available number of bytes that are filled with newly transferred
SPC_DATA_AVAIL_CARD_LEN write After finishing the job with the new available data the user needs to tell the driver that this amount of
Any direction SPC_DATA_AVAIL_USER_POS read The register holds the current byte index position where the available bytes start. The register is just
Any direction SPC_FILLSIZEPROMILLE read The register holds the current fill size of the on-board memory (FIFO buffer) in promille (1/1000) of
card. The user can now fill this amount of bytes with new data to be transferred.
register that the amount of data is now ready to transfer.
data. The user can now use this data for own purposes, copy it, write it to disk or start calculations with this data.
bytes is again free for new data to be transferred.
intended to help you and to avoid own position calculation
the full on-board memory. Please note that the hardware reports the fill size only in 1/16 parts of the full memory. The reported fill size is therefore only shown in 1000/16 = 63 promille steps.
(c) Spectrum GmbH 75
Buffer handling Acquisition modes
Directly after start of transfer the SPC_DATA_AVAIL_USER_LEN is every time zero as no data is available for the user and the SPC_DATA_AVAIL_CARD_LEN is every time identical to the length of the defined buffer as the complete buffer is available for the card for transfer.
The counter that is holding the user buffer available bytes (SPC_DATA_AVAIL_USER_LEN) is sticking to the de­fined notify size at the DefTransfer call. Even when less bytes already have been transferred you won’t get notice of it if the notify size is programmed to a higher value.
Remarks
• The transfer between hardware FIFO buffer and application buffer is done with scatter-gather DMA using a busmaster DMA controller
located on the card. Even if the PC is busy with other jobs data is still transferred until the application data buffer is completely used.
• Even if application data buffer is completely used there’s still the hardware FIFO buffer that can hold data until the complete on-board
memory is used. Therefore a larger on-board memory will make the transfer more reliable against any PC dead times.
• As you see in the above picture data is directly transferred between application data buffer and on-board memory. Therefore it is abso-
lutely critical to delete the application data buffer without stopping any DMA transfers that are running actually. It is also absolutely criti­cal to define the application data buffer with an unmatching length as DMA can than try to access memory outside the application data area.
• As shown in the drawing above the DMA control will announce new data to the application by sending an event. Waiting for an event is
done internally inside the driver if the application calls one of the wait functions. Waiting for an event does not consume any CPU time and is therefore highly desirable if other threads do a lot of calculation work. However it is not necessary to use the wait functions and one can simply request the current status whenever the program has time to do so. When using this polling mode the announced avail­able bytes still stick to the defined notify size!
• If the on-board FIFO buffer has an overrun (card to PC) or an underrun (PC to card) data transfer is stopped. However in case of transfer
from card to PC there is still a lot of data in the on-board memory. Therefore the data transfer will continue until all data has been trans­ferred although the status information already shows an overrun.
• Getting best bus transfer performance is done using a „continuous buffer“. This mode is explained in the appendix in greater detail.
The Notify size sticks to the page size which is defined by the PC hardware and the operating system. There­fore the notify size must be a multiple of 4 kByte. For data transfer it may also be a fraction of 4k in the
range of 16, 32, 64, 128, 256, 512, 1k or 2k. No other values are allowed. For ABA and timestamp the notify size can be 2k as a minimum. If you need to work with ABA or timestamp data in smaller chunks please use the polling mode as described later.
The following graphs will show the current buffer positions in different states of the transfer. The drawings have been made for the transfer from card to PC. However all the block handling is similar for the opposite direction, just the empty and the filled parts of the buffer are inverted.
Step 1: Buffer definition
Directly after buffer definition the complete buffer is empty (card to PC) or completely filled (PC to card). In our example we have a notify size which is 1/4 of complete buffer memory to keep the example simple. In real world use it is recommended to set the notify size to a smaller stepsize.
Step 2: Start and first data available
In between we have started the transfer and have waited for the first data to be available for the user. When there is at least one block of notify size in the memory we get an interrupt and can proceed with the data. Al­though there is more data already transferred we only get announced to have the notify size of data available. The USER_POS is still zero as we are right at the beginning of the complete transfer.
Step 3: set the first data available for card
Now the data can be processed. If transfer is going from card to PC that may be storing to hard disk or calculation of any figures. If transfer is go­ing from PC to card that means we have to fill the available buffer again with data. After this the amount of data is set available for the card and for the next step.
Step 4: next data available
After reaching the next border of the notify size we get the next part of the data buffer to be available. In our example this part of data is again only of one notify size length. The user position will now be at the position [1 x notify size].
Step 5: set data available again
Again after processing the data we set it free for the card use.
In our example we now make something else and don’t react to the inter­rupt for a longer time. In the background the buffer is filled with more da­ta.
76 M3i.48xx / M3i.48xx-exp Manual
Acquisition modes Buffer handling
Step 6: roll over the end of buffer
Now nearly the complete buffer is filled. Please keep in mind that our cur­rent user position is still at the end of the data part that we got in step 4. Therefore the data to process now is split in two parts. Part 1 is at the end of the buffer while part 2 is starting with address 0.
Step 7: set the rest of the buffer available
Feel free to process the complete data or just the part 1 until the end of the buffer as we do in this example. If you decide to process complete buffer please keep in mind the roll over at the end of the buffer.
This buffer handling can now continue endless as long as we manage to set the data available for the card fast enough.
Buffer handling example for transfer from card to PC
char* pcData = new char[lBufferSizeInBytes];
// we now define the transfer buffer with the minimum notify size of on page = 4 kByte spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC , 4096, (void*) pcData, 0, lBufferSizeInBytes);
// we start the DMA transfer dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA);
do { if (!dwError) { // we wait for the next data to be available. Afte this call we get at least 4k of data to proceed dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_WAITDMA);
// if there was no error we can proceed and read out the available bytes that are free again spcm_dwGetParam_i32 (hDrv, SPC_DATA_AVAIL_USER_LEN, &lAvailBytes); spcm_dwGetParam_i32 (hDrv, SPC_DATA_AVAIL_USER_POS, &lBytePos);
printf (“We now have %d new bytes available\n”, lAvailBytes); printf (“The available data starts at position %d\n”, lBytesPos);
// we take care not to go across the end of the buffer if ((lBytePos + lAvailBytes) >= lBufferSizeInBytes) lAvailBytes = lBufferSizeInBytes - lBytePos;
// our do function gets a pointer to the start of the available data section and the length vDoSomething (&pcData[lBytesPos], lAvailBytes);
// the buffer section is now immediately set available for the card spcm_dwSetParam_i32 (hDrv, SPC_DATA_AVAIL_CARD_LEN, lAvailBytes); } } while (!dwError); // we loop forever if no error occurs
(c) Spectrum GmbH 77
Buffer handling Acquisition modes
Buffer handling example for transfer from PC to card
char* pcData = new char[lBufferSizeInBytes];
// before starting transfer we ned to once fill complete buffer memory with data vDoGenerateData (&pcData[0], lBufferSizeInBytes);
// we now define the transfer buffer with the minimum notify size of on page = 4 kByte spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD , 4096, (void*) pcData, 0, lBufferSizeInBytes);
// before start we once have to fill some data in for the start of the output spcm_dwSetParam_i32 (hDrv, SPC_DATA_AVAIL_CARD_LEN, lBufferSizeInBytes); dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA);
do { if (!dwError) { // if there was no error we can proceed and read out the current amount of available data spcm_dwGetParam_i32 (hDrv, SPC_DATA_AVAIL_USER_LEN, &lAvailBytes); spcm_dwGetParam_i32 (hDrv, SPC_DATA_AVAIL_USER_POS, &lBytePos);
printf (“We now have %d free bytes available\n”, lAvailBytes); printf (“The available data starts at position %d\n”, lBytesPos);
// we take care not to go across the end of the buffer if ((lBytePos + lAvailBytes) >= lBufferSizeInBytes) lAvailBytes = lBufferSizeInBytes - lBytePos;
// our do function gets a pointer to the start of the available data section and the length vDoGenerateData (&pcData[lBytesPos], lAvailBytes);
// now we mark the number of bytes that we just generated for replay // and wait for the next free buffer spcm_dwSetParam_i32 (hDrv, SPC_DATA_AVAIL_CARD_LEN, lAvailBytes); dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_WAITDMA); } } while (!dwError); // we loop forever if no error occurs
Please keep in mind that you are using a continuous buffer writing/reading that will start again at the zero
position if the buffer length is reached. However the DATA_AVAIL_USER_LEN register will give you the com-
plete amount of available bytes even if one part of the free area is at the end of the buffer and the second half at the beginning of the buffer.
78 M3i.48xx / M3i.48xx-exp Manual
Acquisition modes Data organisation

Data organisation

Data is organized in a multiplexed way in the transfer buffer. If using 2 channels data of first activated channel comes first, then data of second channel.
Activated Channels Ch0 Ch1 Samples ordering in buffer memory starting with data offset zero 1 channel X A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 1 channel X B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 B16 2 channels X X A0 B0 A1 B1 A2 B2 A3 B3 A4 B4 A5 B5 A6 B6 A7 B7 A8
The samples are re-named for better readability. A0 is sample 0 of channel 0, B4 is sample 4 of channel 1, and so on

Sample format

The 16 bit A/D samples are stored in twos complement in the 16 bit data word. 16bit resolution means that data is ranging from ­32768…to…-32767.
Bit Standard Mode
D15 ADx Bit 15 (MSB)
D14 ADx Bit 14
D13 ADx Bit 13
D12 ADx Bit 12
D11 ADx Bit 11
D10 ADx Bit 10
D9 ADx Bit 9
D8 ADx Bit 8
D7 ADx Bit 7
D6 ADx Bit 6
D5 ADx Bit 5
D4 ADx Bit 4
D3 ADx Bit 3
D2 ADx Bit 2
D1 ADx Bit 1
D0 ADx Bit 0 (LSB)

Converting ADC samples to voltage values

The Spectrum driver also contains a register that holds the value of the decimal value of the full scale representation of the installed ADC. This value should be used when converting ADC values (in LSB) into real-world voltage values, because this register also automatically takes any specialities into account, such as slightly reduced ADC resolution with reserved codes for gain/offset compensation.
Register Value Direction Description
SPC_MIINST_MAXADCVALUE 1126 r Contains the decimal code (in LSB) of the ADC full scale value.
In case of a board that uses an 8 bit ADC that provides the full ADC code (with­out reserving any bits) the returned value would be 128. The the peak value for a ±1.0 V input range would be 1.0 V (or 1000 mv).
A returned sample value of for example +49 (decimal, two’s complement, signed representation) would then convert to:
Vin49
A returned sample value of for example -55 (decimal) would then convert to:
V
in
When converting samples that contain any additional data such as for example additional digital channels or overrange bits, the extra information must be masked out and a proper sign-extension must be per­formed, before these values can be used as a signed two’s complement value for above formulars.
1000 mV
----------------------------------------------
× 382.81 mV==
128
1000 mV
----------------------------------------------
55
× 427.69 mV==
128
(c) Spectrum GmbH 79
Overview Clock generation

Clock generation

Overview

The different clock modes

The Spectrum M3i/M4i cards offer a wide variety of different clock modes to match all the customers needs. All of the clock modes are described in de­tail with programming examples in this chapter.
The figure is showing an overview of the complete engine used on all M3i/ M4i cards for clock generation.
The purpose of this chapter is to give you a guide to the best matching clock settings for your specific application and needs.
Standard internal sample rate (programmable reference quartz 1)
This is the easiest and most common way to generate a sample rate with no need for additional external clock signals. The sample rate has a very fine resolution, low jitter and a high accuracy. The Quartz 1 is a high quality software programmable clock device acting as a refer­ence to the internal PLL. The specification is found in the technical data section of this manual.
Quartz2 with PLL (option)
This optional second Quartz 2 is for special customer needs, either for a special direct sampling clock or as a very precise reference for the PLL. Please feel free to contact Spectrum for your special needs. The Quarz 2 clock footprint can be equipped with a wide variety of clock sources that are available on the market.
External Clock (reference clock)
Any clock can be fed in that matches the specification of the board. The external clock signal can be used to synchronize the board on a system clock or to feed in an exact matching sample rate. The external clock is divided/multiplied using a PLL allowing a wide range of external clock modes.
Synchronization clock (option Star-Hub)
The star-hub option allows the synchronization of up to 8 cards of the M3i/M4i series from Spectrum with a minimal phase delay between the different cards. The clock is distributed from the master card to all connected cards. As a source it is possible to either use the program­mable Quarz 1 clock or the external clock input of the master card. For details on the synchronization option please take a look at the ded­icated chapter later in this manual.

Clock Mode Register

The selection of the different clock modes has to be done by the SPC_CLOCKMODE register. All available modes, can be read out by the help of the SPC_AVAILCLOCKMODES register.
Register Value Direction Description
SPC_AVAILCLOCKMODES 20201 read Bitmask, in which all bits of the below mentioned clock modes are set, if available.
SPC_CLOCKMODE 20200 read/write Defines the used clock mode or reads out the actual selected one.
SPC_CM_INTPLL 1 Enables internal programmable high precision Quartz 1 for sample clock generation
SPC_CM_QUARTZ2 4 Enables optional Quartz 2 as reference for sample clock generation
SPC_CM_EXTREFCLOCK 32 Enables internal PLL with external reference for sample clock generation
The different clock modes and all other related or required register settings are described on the following pages.
80 M3i.48xx / M3i.48xx-exp Manual
Clock generation Details on the different clock modes

Details on the different clock modes

Standard internal sampling clock (PLL)

The internal sampling clock is generated in default mode by a programmable high precision quartz. You need to select the clock mode by the dedicated register shown in the table below:
Register Value Direction Description
SPC_CLOCKMODE 20200 read/write Defines the used clock mode
SPC_CM_INTPLL 1 Enables internal programmable high precision Quartz 1 for sample clock generation
The user does not have to care on how the desired sampling rate is generated by multiplying and dividing internally. You simply write the desired sample rate to the according register shown in the table below and the driver makes all the necessary calculations. If you want to make sure the sample rate has been set correctly you can also read out the register and the driver will give you back the sampling rate that is matching your desired one best.
Register Value Direction Description
SPC_SAMPLERATE 20000 write Defines the sample rate in Hz for internal sample rate generation.
read Read out the internal sample rate that is nearest matching to the desired one.
Independent of the used clock source it is possible to enable the clock output. The clock will be available on the external clock output connector and can be used to synchronize external equipment with the board.
Register Value Direction Description
SPC_CLOCKOUT 20110 read/write Writing a „1“ enables clock output on external clock output connector. Writing a „0“ disables the
clock output (tristate)
Example on writing and reading internal sampling rate
spcm_dwSetParam_i32 (hDrv, SPC_CLOCKMODE, SPC_CM_INTPLL); // Enables internal programmable quartz 1 spcm_dwSetParam_i64 (hDrv, SPC_SAMPLERATE, 62500000); // Set internal sampling rate to 62.5 MHz spcm_dwSetParam_i32 (hDrv, SPC_CLOCKOUT, 1); // enable the clock output of the card spcm_dwGetParam_i64 (hDrv, SPC_SAMPLERATE, &lSamplerate); // Read back the programmed sample rate and print printf („Sample rate = %d\n“, lSamplerate); // it. Output should be „Sample rate = 62500000“
Minimum internal sampling rate
The minimum and the maximum internal sampling rates depend on the specific type of board. Both values can be found in the technical data section of this manual.

Using Quartz2 with PLL (optional, M4i cards only)

In some cases it is necessary to use a special high precision frequency for sampling rate generation. For these applications all cards of the M3i/M4i series can be equipped with a special customer quartz. Please contact Spectrum for details on available oscillators. If your card is equipped with a second oscillator you can enable it for sampling rate generation with the following register:
Register Value Direction Description
SPC_CLOCKMODE 20200 read/write Defines the used clock mode
SPC_CM_QUARTZ2 4 Enables optional quartz2 for sample clock generation
The quartz 2 clock is routed through a PLL to allow the generation of sampling rates based on this reference clock. As with internal PLL mode it’s also possible to program the clock mode first, set a desired sampling rate with the SPC_SAMPLERATE register and to read it back. The result will then again be the best matching sampling rate.
Independent of the used clock source it is possible to enable the clock output. The clock will be available on the external clock output connector and can be used to synchronize external equipment with the board.
Register Value Direction Description
SPC_CLOCKOUT 20110 read/write Writing a „1“ enables clock output on external clock output connector. Writing a „0“ disables the
clock output (tristate)
(c) Spectrum GmbH 81
Details on the different clock modes Clock generation

External clock (reference clock)

The external clock input is fed through a PLL to the clock system. Therefore the input will act as a reference clock input thus allowing to either use a copy of the external clock or to generate any sampling clock within the allowed range from the reference clock. Please note the limited setup granularity in comparison to the internal sampling clock generation. Details are found in the technical data section.
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
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 then automatically 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.
Register Value Direction Description
SPC_REFERENCECLOCK 20140 read/write Programs the external reference clock in the range stated in the technical data section.
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.
Example of reference 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_i64 (hDrv, SPC_SAMPLERATE, 65200000); // We want to have 62.5 MHz as sampling rate
PLL Locking Error
The external clock signal is routed to a PLL to generate any sampling clock from this external clock. Due to the internal structure of the card the PLL is even used if a copy of the clock fed in externally is used for sampling (SPC_REFERENCECLOCK = SPC_SAMPLERATE). The PLL needs a stable and defined external clock with no gaps and no variation in the frequency. The external clock must be present when issuing the start command. It is not possible to start the card with external clock activated and no external clock available.
When starting the card all settings are written to hardware and the PLL is programmed to generate the desired sampling clock. If there has been any change to the clock setting the PLL then tries to lock on the external clock signal to generate the sampling clock. This locking will normally need 10 to 20 ms until the sampling clock is stable. Some clock settings may also need 200 ms to lock the PLL. This waiting time is automatically added at card start.
However if the PLL can not lock on the external clock either because there is no clock available or it hasn’t sufficient signal levels or the clock is not stable the driver will return with an error code ERR_CLOCKNOTLOCKED. In that case it is necessary to check the external clock con­nection. Please see the example below:
// settings done to external clock like shown above. if (spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER) == ERR_CLOCKNOTLOCKED) { printf („External clock not locked. Please check connection\n“); return -1; }
82 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers General Description

Trigger modes and appendant registers

General Description

The trigger modes of the Spectrum M3i series A/D cards are very extensive and give you the possibility to detect nearly any trigger event you can think of.
You can choose between more than 10 external trigger modes and up to 20 internal trigger modes (on analog acquisition cards) including software and channel trigger, depending on your type of board. Many of the channel trigger modes can be independently set for each input channel (on A/D boards only) resulting in a even bigger variety of modes. This chapter is about to explain all of the different trigger modes and setting up the card’s registers for the desired mode.

Trigger Engine Overview

The trigger engine of the M3i card series allows to combine several different trigger sources with OR and AND combination, with a trigger delay or even with an OR combination across several cards when using the Star-Hub option. The above drawing gives a complete overview of the trigger engine and shows all possible features that are available.
Each analog input channel has two trigger level comparators to detect edges as well as windowed triggers. The card has a total of three different additional external trigger sources. One main trigger source which also has two analog level comparators also allowing to use edge and windowed trigger detection and two multi purpose in/outputs that can be software programmed to either additional trigger inputs or trigger outputs or to some extended status signals.
The Enable trigger allows the user to enable or disable all trigger sources (including channel trigger and external trigger) with a single soft­ware command. The enable trigger command will not work on force trigger.
When the card is waiting for a trigger event, either a channel trigger or an external trigger the force trigger command allows to force a trigger event with a single software command. The force trigger overrides the enable trigger command.
Before the trigger event is finally generated, it is wired through a programmable trigger delay. This trigger delay will also work when used in a synchronized system thus allowing each card to individually delay its trigger recognition.
(c) Spectrum GmbH 83
Multi Purpose I/O Lines Trigger modes and appendant registers

Multi Purpose I/O Lines

The M3i series has two multi purpose I/O lines that can be used for a wide variety of functions to help the interconnection with external equipment. The functionality of these multi purpose I/O lines can be software programmed and each of these lines can either be used for input or output.
The multi purpose I/O lines may be used for additional trigger inputs allowing to combine and gate external triggers, for trigger output, for internal arm/run signals output, for asynchronous I/O to control external equipment or as additional digital input lines that are sampled synchronously with the analog data.
The multi purpose I/O lines are available on the front plate and labelled with X0 (line 0 = X0 = Ext1) and X1 (line 1 = X1 = Ext2). As default these lines are switched off.
Please be careful when programming these lines as an output signal being connected with an external signal
source may damage components either on the external equipment or on the card itself.

Programming the behaviour

Each multi purpose I/O line can be individually programmed. Please check the available modes by reading the SPCM_X0_AVAILMODES and SPCM_X1_AVAILMODES register first. The available modes may differ from card to card and may be enhanced with new driver/firm­ware versions to come.
Register Value Direction Description
SPCM_X0_AVAILMODES 47210 read Bitmask with all bits of the below mentioned modes showing the available modes for (X0 = Ext1)
SPCM_X1_AVAILMODES 47211 read Bitmask with all bits of the below mentioned modes showing the available modes for (X1 = Ext2)
SPCM_X0_MODE 47200 read/write Defines the mode for (X0 = Ext1). Only one mode selection is possible to be set at a time
SPCM_X1_MODE 47201 read/write Defines the mode for (X1 = Ext2). Only one mode selection is possible to be set at a time
SPCM_XMODE_DISABLE 00000000h No mode selected. Output is tristate (default setup)
SPCM_XMODE_ASYNCIN 00000001h Connector is programmed for asynchronous input. Use SPCM_XX_ASYNCIO to read data asynchronous as shown in
SPCM_XMODE_ASYNCOUT 00000002h Connector is programmed for asynchronous output. Use SPCM_XX_ASYNCIO to write data asynchronous as shown
SPCM_XMODE_DIGIN 00000004h Connector is programmed for digital input. Digital channel X0/X1 is written as D14/D15 of data stream during
SPCM_XMODE_TRIGIN 00000010h Connector is programmed as additional TTL trigger input. X0/X1 is available as Ext1/Ext2 trigger input. Please be
SPCM_XMODE_TRIGOUT 00000020h Connector is programmed as trigger output and shows the trigger detection. The trigger output is HIGH as long as
SPCM_XMODE_OVROUT 00000040h Shows the overrange status of the channels at the output. If the analog data of one channel exceeds the input range
SPCM_XMODE_RUNSTATE 00000100h Connector shows the current run state of the card. If acquisition/output is running the signal is HIGH. If card has
SPCM_XMODE_ARMSTATE 00000200h Connector shows the current ARM state of the card. If the card is armed and ready to receive a trigger the signal is
SPCM_XMODE_DIRECTTRIGOUT 00000400h Connector is programmed as direct trigger output and shows the trigger recognition of an fed in trigger event which
SPCM_XMODE_DIRECTTRIGOUT_LR 00000800h Nearly identical to SPCM_XMODE_DIRECTTRIGOUT, but in contrast the above mode, this mode does not make sure
next chapter.
in next chapter.
acquisition (12 and 14 bit analog input cards only). Please check the data format chapter to see more details. Please note that automatic sign extension of analog data is switched off as soon as one digital input line is activated.
sure to also set the corresponding trigger OR/AND masks to use this trigger input for trigger detection.
postcounter is running. After reaching postcounter zero it will become LOW again. In standard FIFO mode the trigger output is HIGH until FIFO mode is stopped.
the overrange signal is set to high level for that time. The overrange status of channel 0 is output on X0 and the over­range status of channel 1 is output on X1.
stopped the signal is LOW.
HIGH. If the card isn’t running or the card is still acquiring pretrigger data or the trigger has been detected the signal is LOW.
will lead to a card trigger event. This mode shows the upcoming detection even before the card itself will have trig­gered. The trigger output is HIGH as long as postcounter is running. After reaching postcounter zero it will become LOW again. This mode ensures that the card is armed and therefor the signaled event trigger event will lead to a card trigger. Please see below for a usage example for this mode.
that the card is armed. The user has to take care that the repetition time of the fed in trigger event is longer than the recording and re-arm time, otherwise the direct trigger might be generated although this event cannot be a properly detected card trigger. Please see below for a usage example for this mode.
Please note that a change to the SPCM_X0_MODE or SPCM_X1_MODE will only be updated with the next call
to either the M2CMD_CARD_START or M2CMD_CARD_WRITESETUP register. For further details please see the
relating chapter on the M2CMD_CARD registers.

Using asynchronous I/O

To use asynchronous I/O on the multi purpose I/O lines it is first necessary to switch these lines to the desired asynchronous mode by pro­gramming the above explained mode registers. As a special feature asynchronous input can also be read if the mode is set to trigger input or digital input.
Register Value Direction Description
SPCM_XX_ASYNCIO 47220 read/write Connector X0 is linked to bit 0 of the register while connector X1 is linked to bit 1 of this register.
84 M3i.48xx / M3i.48xx-exp Manual
Data is written/read immediately without any relation to the currently used sampling rate or mode. If a line is programmed to output, reading this line asynchronously will return the current output level.
Trigger modes and appendant registers Multi Purpose I/O Lines
Example of asynchronous write and read. We write a high pulse on output X1 and wait for a high level answer on input X0:
spcm_dwSetParam_i32 (hDrv, SPCM_X0_MODE, SPCM_XMODE_ASYNCIN); // X0 set to asynchronous input spcm_dwSetParam_i32 (hDrv, SPCM_X1_MODE, SPCM_XMODE_ASYNCOUT); // X1 set to asynchronous output
spcm_dwSetParam_i32 (hDrv, SPCM_XX_ASYNCIO, 0); // programming a high pulse on output spcm_dwSetParam_i32 (hDrv, SPCM_XX_ASYNCIO, 2); spcm_dwSetParam_i32 (hDrv, SPCM_XX_ASYNCIO, 0);
do { spcm_dwGetParam_i32 (hDrv, SPCM_XX_ASYNCIO, &lAsyncIn); // read input in a loop } while ((lAsyncIn & 1) == 0) // until X0 is going to high level

Special behaviour of trigger output

As the driver of the M3i series is the same as the driver for the M2i series and some old software may rely on register structure of the M2i card series there is a special compatible trigger output register that will work according to the M2i series style. It is not recommended to use this register unless you’re writing software for both card series:
Register Value Direction Description
SPC_TRIG_OUTPUT 40100 read/write M2i style trigger output programming. Write a „1“ to enable X1 trigger output (SPCM_X1_MODE =
The SPC_TRIG_OUTPUT register overrides the multi purpose I/O settings done by SPCM_X0_MODE and SPCM_X1_MODE and vice versa. Please do not use both methods in one program.
SPCM_XMODE_TRIGOUT) and X0 run state (SPCM_X0_MODE = SPCM_XMODE_RUNSTATE). Write a „0“ to disable both outputs (SPCM_X0_MODE = SPCM_X1_MODE = SPCM_XMODE_DISABLE)

Special direct trigger output modes

The trigger output of the cards can be used to start external equipment. To cope requirements for different applications, all M3i cards support different output modes.
„Standard“ Trigger Output
In this mode the output signal indicates the internal trigger event after the trigger delay, and therefore the begin of post trigger area. The trigger output and the recording can be de­layed by programming the user trigger delay.
For details on the trigger delay, please see the related chapter in this manual.
„Direct“ Trigger Output
In this mode the output signal indicates that the external fed in trigger event (external or channel trigger) will lead to a re­cording after a fix delay and the optional programmed trig­ger delay. The start of the recording can be delayed by programming the user trigger delay. This can be useful when the trigger output is to be used to start the device under test, whilst avoiding the need to record un­needed data in the pre-trigger area.
For details on the trigger delay, please see the related chapter in this manual.
Using the direct trigger output modes requires the following driver and firmware version depending on your card. Please update your system to the newest versions to run these modes mode.
• Driver version V2.06 (or newer)
• Base Ctrl firmware version V6 (or newer)
• M3i.21xx cards : Modul Ctrl firmware version V1 (or newer)
• M3i.32xx cards : Modul Ctrl firmware version V6 (or newer)
• M3i.41xx cards : Modul Ctrl firmware version V6 (or newer)
(c) Spectrum GmbH 85
Trigger masks Trigger modes and appendant registers

Trigger masks

Trigger OR mask

The purpose of this passage is to explain the trigger OR mask (see left figure) and all the appendant software registers in detail.
The OR mask shown in the overview before as one object, is separat­ed into two parts: a general OR mask for external trigger (external analog and multi purpose TTL trigger) and software trigger and a channel OR mask.
Every trigger source of the M3i series cards is wired to one of the above men­tioned OR masks. The user then can program which trigger source will be rec­ognized, and which one won’t.
This selection for the general mask is realized with the SPC_TRIG_ORMASK register in combination with constants for every possible trigger source.
This selection for the channel mask is realized with the SPC_TRIG_CH_ORMASK0 register in combination with constants for every possible channel trigger source.
In either case the sources are coded as a bitfield, so that they can be combined by one access to the driver with the help of a bitwise OR.
The table below shows the relating register for the general OR mask and the possible constants that can be written to it.
Register Value Direction Description
SPC_TRIG_AVAILORMASK 40400 read Bitmask, in which all bits of the below mentioned sources for the OR mask are set, if available.
SPC_TRIG_ORMASK 40410 read/write Defines the events included within the trigger OR mask of the card.
SPC_TMASK_NONE 0 No trigger source selected
SPC_TMASK_SOFTWARE 1h Enables the software trigger for the OR mask. The card will trigger immediately after start.
SPC_TMASK_EXT0 2h Enables the external (analog) trigger 0 for the OR mask. The card will trigger when the programmed condition for this
SPC_TMASK_EXT1 4h Enables the external (TTL) trigger 1 for the OR mask. Please note that the mode of the multi purpose connector X0 must
SPC_TMASK_EXT2 8h Enables the external (TTL) trigger 2 for the OR mask. Please note that the mode of the multi purpose connector X1 must
input is valid.
be programmed to trigger input if using the Ext1 trigger (SPCM_X0_MODE=SPCM_XMODE_TRIGIN). The card will trigger when the programmed condition for this input is valid.
be programmed to trigger input if using the Ext2 trigger (SPCM_X1_MODE=SPCM_XMODE_TRIGIN). The card will trigger when the programmed condition for this input is valid.
The following example shows, how to setup the OR mask, for an external trigger. As an example a simple edge detection has been chosen. The explanation and a detailed description of the different trigger modes for the external trigger inputs will be shown in the dedicated passage within this chapter.
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); // Enable external trigger within the OR mask spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_LEVEL0, 1800); // Trigger level set to 1.8 V spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_POS); // Setting up external trigger for rising edges
86 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers Trigger masks
The table below is showing the registers for the channel OR mask and the possible constants that can be written to it.
Register Value Direction Description
SPC_TRIG_CH_AVAILORMASK0 40450 read Bitmask, in which all bits of the below mentioned sources/channels (0…31) for the channel OR mask
SPC_TRIG_CH_ORMASK0 40460 read/write Includes the analog or digital channels (0…31) within the channel trigger OR mask of the card.
SPC_TMASK0_CH0 00000001h Enables channel0 for recognition within the channel OR mask.
SPC_TMASK0_CH1 00000002h Enables channel1 for recognition within the channel OR mask.
SPC_TMASK0_CH2 00000004h Enables channel2 for recognition within the channel OR mask.
SPC_TMASK0_CH3 00000008h Enables channel3 for recognition within the channel OR mask.
……
SPC_TMASK0_CH28 10000000h Enables channel28 for recognition within the channel OR mask.
SPC_TMASK0_CH29 20000000h Enables channel29 for recognition within the channel OR mask.
SPC_TMASK0_CH30 40000000h Enables channel30 for recognition within the channel OR mask.
SPC_TMASK0_CH31 80000000h Enables channel31 for recognition within the channel OR mask.
are set, if available.
The following example shows, how to setup the OR mask for channel trigger. As an example a simple edge detection has been chosen. The explanation and a detailed description of the different trigger modes for the external TTL trigger inputs will be shown in the dedicated passage within this chapter.
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH_ORMASK0, SPC_TMASK_CH0); // Enable channel0 trigger within the OR mask spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH0_LEVEL0, 0); // Trigger level is zero crossing spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_POS); // Setting up external trigger for rising edges

Trigger AND mask

The purpose of this passage is to explain the trigger AND mask (see left figure) and all the appendant software registers in detail.
The AND mask shown in the overview before as one object, is sepa­rated into two parts: a general AND mask for external trigger and software trigger and a channel AND mask.
Every trigger source of the M3i series cards except the software trigger is wired to one of the above mentioned AND masks. The user then can program which trigger source will be recognized, and which one won’t.
This selection for the general mask is realized with the SPC_TRIG_ANDMASK register in combination with constants for every possible trigger source.
This selection for the channel mask is realized with the SPC_TRIG_CH_ANDMASK0 register in combination with constants for every possible channel trigger source. In either case the sources are coded as a bit­field, so that they can be combined by one access to the driver with the help of a bitwise OR.
The table below shows the relating register for the general AND mask and the possible constants that can be written to it.
Register Value Direction Description
SPC_TRIG_AVAILANDMASK 40420 read Bitmask, in which all bits of the below mentioned sources for the AND mask are set, if available.
SPC_TRIG_ANDMASK 40430 read/write Defines the events included within the trigger AND mask of the card.
SPC_TMASK_NONE 0 No trigger source selected
SPC_TMASK_EXT0 2h Enables the external (analog) trigger 0 for the AND mask. The card will trigger when the programmed condition for
SPC_TMASK_EXT1 4h Enables the external (TTL) trigger 1 for the AND mask. Please note that the mode of the multi purpose connector X0
SPC_TMASK_EXT2 8h Enables the external (TTL) trigger 1 for the AND mask. Please note that the mode of the multi purpose connector X1
this input is valid.
must be programmed to trigger input if using the Ext1 trigger (SPCM_X0_MODE=SPCM_XMODE_TRIGIN). The card will trigger when the programmed condition for this input is valid.
must be programmed to trigger input if using the Ext2 trigger (SPCM_X1_MODE=SPCM_XMODE_TRIGIN). The card will trigger when the programmed condition for this input is valid.
The following example shows, how to setup the AND mask, for an external trigger. As an example a simple high level detection has been
(c) Spectrum GmbH 87
Software trigger Trigger modes and appendant registers
chosen. The explanation and a detailed description of the different trigger modes for the external trigger inputs will be shown in the dedicated passage within this chapter.
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ANDMASK, SPC_TMASK_EXT0); // Enable external trigger within the AND mask spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_LEVEL0, 2000); // Trigger level is 2.0 V (2000 mV) spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_HIGH );// Setting up external trigger for HIGH level
The table below is showing the constants for the channel AND mask and all the constants for the different channels.
Register Value Direction Description
SPC_TRIG_CH_AVAILANDASK0 40470 read Bitmask, in which all bits of the below mentioned sources/channels (0…31) for the channel AND
SPC_TRIG_CH_ANDMASK0 40480 read/write Includes the analog or digital channels (0…31) within the channel trigger AND mask of the card.
SPC_TMASK0_CH0 00000001h Enables channel0 for recognition within the channel OR mask.
SPC_TMASK0_CH1 00000002h Enables channel1 for recognition within the channel OR mask.
SPC_TMASK0_CH2 00000004h Enables channel2 for recognition within the channel OR mask.
SPC_TMASK0_CH3 00000008h Enables channel3 for recognition within the channel OR mask.
……
SPC_TMASK0_CH28 10000000h Enables channel28 for recognition within the channel OR mask.
SPC_TMASK0_CH29 20000000h Enables channel29 for recognition within the channel OR mask.
SPC_TMASK0_CH30 40000000h Enables channel30 for recognition within the channel OR mask.
SPC_TMASK0_CH31 80000000h Enables channel31 for recognition within the channel OR mask.
mask are set, if available.
The following example shows, how to setup the AND mask for a channel trigger. As an example a simple level detection has been chosen. The explanation and a detailed description of the different trigger modes for the channel trigger inputs will be shown in the dedicated passage within this chapter.
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH_ANDMASK0, SPC_TMASK_CH0); // Enable channel0 trigger within the AND mask spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH0_LEVEL0, 0); // channel level to detect is zero level spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH0_MODE, SPC_TM_HIGH); // Setting up ch0 trigger for HIGH levels

Software trigger

The software trigger is the easiest way of triggering any Spectrum board. The acquisition or replay of data will start immediately af­ter starting the board. The only delay results from the time the board needs for its setup. For enabling the software trigger one simply has to include the software event within the trigger OR mask, as the following table is showing:
Register Value Direction Description
SPC_TRIG_ORMASK 40410 read/write Defines the events included within the trigger OR mask of the card.
SPC_TMASK_SOFTWARE 1h Sets the trigger mode to software, so that the recording/replay starts immediately.
Example for setting up the software trigger:
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); // Internal software trigger mode is used

Force- and Enable trigger

In addition to the software trigger (free run) it is also possible to force a trigger event by software while the board is waiting for an internal or external trigger event. The forcetrigger command will only have any effect, when the board is waiting for a trigger event. The command for forcing a trigger event is shown in the table below.
Issuing the forcetrigger command will every time only generate one trigger event. If for example using Multiple Recording that will result in only one segment being acquired by forcetrigger. After execution of the forcetrigger command the trigger engine will fall back to the trigger mode that was originally programmed and will again wait for a trigger event.
Register Value Direction Description
SPC_M2CMD 100 write Command register of the M2i/M3i/M4i series cards.
M2CMD_CARD_FORCETRIGGER 10h Forces a trigger event if the hardware is still waiting for a trigger event.
88 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers Trigger delay
The example shows, how to use the forcetrigger command:
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_FORCETRIGGER); // Force trigger is used.
It is also possible to enable (arm) or disable (disarm) the card’s whole triggerengine by software. By default the trigger engine is disabled.
Register Value Direction Description
SPC_M2CMD 100 write Command register of the M2i/M3i/M4i series cards.
M2CMD_CARD_ENABLETRIGGER 8h Enables the trigger engine. Any trigger event will now be recognized.
M2CMD_CARD_DISABLETRIGGER 20h Disables the trigger engine. No trigger events will be recognized.
The example shows, how to arm and disarm the card’s trigger engine properly:
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_ENABLETRIGGER); // Trigger engine is armed. ... spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_DISABLETRIGGER); // Trigger engine is disarmed.

Trigger delay

All of the Spectrum M3i series cards allow the user to program an additional trigger delay. As shown in the trigger overview section, this delay is the last element in the trigger chain. Therefore the user does not have to care for the sources when programming the trigger delay.
As shown in the overview the trigger delay is located after the star­hub connection meaning that every M3i card being synchronized can still have its own trigger delay programmed. The Star-Hub will combine the original trigger events before the result is being delayed.
The delay is programmed in samples. The resulting time delay will therefore be [Programmed Delay] / [Sampling Rate].
The following table shows the related register and the possible values. A value of 0 disables the trigger delay.
Register Value Direction Description
SPC_TRIG_AVAILDELAY 40800 read Contains the maximum available delay as a decimal integer value.
SPC_TRIG_DELAY 40810 read/write Defines the delay for the detected trigger events.
0 No additional delay will be added. The resulting internal delay is mentioned in the technical data section.
8…[8G -8] in steps of 8 (12, 14 and 16 bit cards) Defines the additional trigger delay in number of sample clocks. The trigger delay is a full 33 bit counter and can
16…[8G -16] in steps of 16 (8 bit cards) Defines the additional trigger delay in number of sample clocks. The trigger delay is a full 33 bit counter and can
therefore be programmed up to (8GSamples - 8) = 8589934584. Stepsize is 8 samples for 12, 14 and 16 bit cards.
therefore be programmed up to (8GSamples - 16) = 8589934576. Stepsize is 16 samples for 8 bit cards.
The example shows, how to use the trigger delay command:
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_DELAY, 2000); // A detected trigger event will be // delayed for 2000 sample clocks.
Using the delay trigger does not affect the ratio between pre trigger and post trigger recorded number of samples, but only shifts the trigger event itself. For changing these values, please take a look in the relating chapter about „Acquisition Modes“.
(c) Spectrum GmbH 89
External (analog) trigger Trigger modes and appendant registers

External (analog) trigger

The M3i series has one main external trigger input consisting of an input stage with programmable termination and programmable AC/ DC coupling and two comparators that can be programmed in the range of +/- 5000 mV. Using two comparators offers a wide range of different trigger modes that are support like edge, level, re-arm and window trigger.
The external analog trigger can be easily combined with channel trig­ger or with one or two of the multi purpose connectors being pro­grammed as additional external TTL trigger inputs. The programming of the masks and the multi purpose I/O behaviour is shown in the chapters above.

Trigger Mode

Please find the external (analog) trigger input modes below. A detailed description of the modes follows in the next chapters..
Register Value Direction Description
SPC_TRIG_EXT0_AVAILMODES 40500 read Bitmask shoeing all available trigger modes for external 0 (Ext0) = main analog trigger input
SPC_TRIG_EXT0_MODE 40510 read/write Defines the external trigger mode for the external MMCX connector trigger input. The trigger need to
SPC_TM_NONE 00000000h Channel is not used for trigger detection. This is as with the trigger masks another possibility for disabling channels.
SPC_TM_POS 00000001h Trigger detection for positive edges (crossing level 0 from below to above)
SPC_TM_NEG 00000002h Trigger detection for negative edges (crossing level 0 from above to below)
SPC_TM_POS | SPC_TM_REARM 01000001h Trigger detection for positive edges on lebel 0. Trigger is armed when crossing level 1 to avoid false trigger on noise
SPC_TM_NEG | SPC_TM_REARM 01000002h Trigger detection for negative edges on lebel 1. Trigger is armed when crossing level 0 to avoid false trigger on noise
SPC_TM_BOTH 00000004h Trigger detection for positive and negative edges (any crossing of level 0)
SPC_TM_HIGH 00000008h Trigger detection for HIGH levels (signal above level 0)
SPC_TM_LOW 00000010h Trigger detection for LOW levels (signal below level 0)
SPC_TM_WINENTER 00000020h Window trigger for entering area between level 0 and level 1
SPC_TM_WINLEAVE 00000040h Window trigger for leaving area between level 0 and level 1
SPC_TM_INWIN 00000080h Window trigger for signal inside window between level 0 and level 1
SPC_TM_OUTSIDEWIN 00000100h Window trigger for signal outside window between level 0 and level 1
be added to either OR or AND mask input to be activated.
For all external edge and level trigger modes, the OR mask must contain the corresponding input, as the following table shows:
Register Value Direction Description
SPC_TRIG_ORMASK 40410 read/write Defines the OR mask for the different trigger sources.
SPC_TMASK_EXT0 2h Enable external trigger input for the OR mask
SPC_TMASK_XIO0 100h Enable extra TTL input 0 for the OR mask. On plain cards this input is only available if the option BaseXIO is installed.
SPC_TMASK_XIO1 200h Enable extra TTL input 1 for the OR mask. These trigger inputs are only available, when option BaseXIO is installed.
As part of the digitizerNETBOX this input is available as connector Trigger B.
Trigger Input Termination
The external trigger input is a high impedance input with 1 MOhm termination aginst GND. It is possible to program a 50 Ohm termination by software to terminate fast trigger signals correctly. If you enable the termination, please make sure, that your trigger source is capable to deliver the needed current. Please check carefully whether the source is able to fulfil the trigger input specification given in the technical data section.
Register Value Direction Description
SPC_TRIG_TERM 40110 read/write A „1“ sets the 50 Ohm termination for external trigger signals. A „0“ sets the high impedance termi-
nation
Please note that the signal levels will drop by 50% if using the 50 ohm termination and your source also has 50 ohm output impedance (both terminations will then work as a 1:2 divider). In that case it will be necessary to reprogram the trigger levels to match the new signal levels. In case of problems receiving a trigger please check the signal level of your source while connected to the terminated input.
90 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers External (analog) trigger

Trigger Input Coupling

The external trigger input can be switched by software between AC and DC coupling. Please see the technical data section for details on the AC bandwidth.
Register Value Direction Description
SPC_TRIG_EXT0_ACDC 40120 read/write A „1“ sets the AC coupling for the external trigger input. A „0“ sets the DC coupling (default)

Trigger level

All of the external (analog) trigger modes listed above require at least one trigger level to be set (except SPC_TM_NONE of course). Some like the window or the re-arm triggers require even two levels (upper and lower level) to be set. The meaning of the trigger levels is depending on the selected mode and can be found in the detailled trigger mode description that follows.
Trigger levels for the external (analog) trigger to be programmed in mV:
Register Value Direction Description Range
SPC_TRIG_EXT_AVAIL0_MIN 42340 read returns the minimum trigger level to be programmed in mV
SPC_TRIG_EXT_AVAIL0_MAX 42341 read returns the maximum trigger level to be programmed in mV
SPC_TRIG_EXT_AVAIL0_STEP 42342 read returns the step size of trigger level to be programmed in mV
SPC_TRIG_EXT0_LEVEL0 42320 read/write Trigger level 0 for external trigger -5000 mV to +5000 mV
SPC_TRIG_EXT0_LEVEL1 42321 read/write Trigger level 1 for external trigger -5000 mV to +5000 mV

Detailed description of the external analog trigger modes

For all external analog trigger modes shown below, either the OR mask or the AND must contain the external trigger to activate the external input as trigger source:.
Register Value Direction Description
SPC_TRIG_ORMASK 40410 read/write Defines the events included within the trigger OR mask of the card.
SPC_TRIG_ANDMASK 40430 read/write Defines the events included within the trigger AND mask of the card.
SPC_TMASK_EXT0 2h Enables the external (analog) trigger 0 for the mask.
Trigger on positive edge
The trigger input is continuously sampled with the selected sample rate. If the programmed trigger level is crossed by the trigger signal from lower values to higher values (rising edge) then the trigger event will be detected.
This edge triggered external trigger mode correspond to the trigger possibilities of usual oscilloscopes.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_POS 1h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the desired trigger level in mV mV
(c) Spectrum GmbH 91
External (analog) trigger Trigger modes and appendant registers
Trigger on negative edge
The trigger input is continuously sampled with the selected sample rate. If the programmed trigger level is crossed by the trigger signal from higher values to lower values (falling edge) then the trigger event will be detected.
This edge triggered external trigger mode correspond to the trigger possibilities of usual oscilloscopes.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_NEG 2h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the desired trigger level in mV mV
92 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers External (analog) trigger
Trigger on positive and negative edge
The trigger input is continuously sampled with the selected sample rate. If the programmed trigger level is crossed by the trigger signal (either rising or falling edge) the trigger event will be detected.
Thise edge triggered external trigger mode correspond to the trigger possibilities of usual oscilloscopes.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_BOTH 4h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the desired trigger level in mV mV
Re-arm trigger on positive edge
The trigger input is continuously sampled with the selected sample rate. If the programmed re-arm level is crossed from lower to higher values, the trigger engine is armed and waiting for trigger. If the programmed trigger level is crossed by the trigger signal from lower values to higher values (rising edge) then the trigger event will be detected and the trigger engine will be disarmed. A new trigger event is only detected if the trigger engine is armed again.
The re-arm trigger modes can be used to prevent the board from triggering on wrong edges in noisy signals.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_POS | SPC_TM_REARM 01000001h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the desired trigger level in mV mV
SPC_TRIG_EXT0_LEVEL1 42330 read/write Defines the re-arm level in mV mV
Re-arm trigger on negative edge
The trigger input is continuously sampled with the selected sample rate. If the programmed re-arm level is crossed from higher to lower values, the trigger engine is armed and waiting for trigger. If the programmed trigger level is crossed by the trigger signal from higher values to lower values (falling edge) then the trigger event will be detected and the trigger engine will be disarmed. A new trigger event is only detected, if the trigger engine is armed again.
The re-arm trigger modes can be used to prevent the board from triggering on wrong edges in noisy signals.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_NEG | SPC_TM_REARM 01000002h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Defines the re-arm level in mV mV
SPC_TRIG_EXT0_LEVEL1 42330 read/write Set it to the desired trigger level in mV mV
(c) Spectrum GmbH 93
External (analog) trigger Trigger modes and appendant registers
Window trigger for entering signals
The trigger input is continuously sampled with the selected sample rate. The upper and the lower level define a win­dow. Every time the signal enters the window from the out­side, a trigger event will be detected.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_WINENTER 00000020h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the upper trigger level in mV mV
SPC_TRIG_EXT0_LEVEL1 42330 read/write Set it to the lower trigger level in mV mV
Window trigger for leaving signals
The trigger input is continuously sampled with the selected sample rate. The upper and the lower level define a win­dow. Every time the signal leaves the window from the in­side, a trigger event will be detected.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_WINLEAVE 00000040h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the upper trigger level in mV mV
SPC_TRIG_EXT0_LEVEL1 42330 read/write Set it to the lower trigger level in mV mV
High level trigger
This trigger mode will generate an internal gate signal that can be useful in conjunction with a second trigger mode to gate that second trigger. If using this mode as a single trigger source the card will detect a trigger event at the time when entering the high level (acting like positive edge trigger) or if the trigger signal is already above the programmed level at the start it will immediately detect a trigger event.
The trigger input is continuously sampled with the selected sample rate. The trigger event will be detected if the trigger input is above the programmed trigger level.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_HIGH 00000008h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the upper trigger level in mV mV
94 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers External (analog) trigger
Low level trigger
This trigger mode will generate an internal gate signal that can be useful in conjunction with a second trigger mode to gate that second trigger. If using this mode as a single trigger source the card will detect a trigger event at the time when entering the low level (acting like negative edge trigger) or if the trigger signal is already above the programmed level at the start it will immediately detect a trigger event.
The trigger input is continuously sampled with the selected sample rate. The trigger event will be detected if the trigger input is below the programmed trigger level.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_LOW 00000010h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the upper trigger level in mV mV
In window trigger
This trigger mode will generate an internal gate signal that can be useful in conjunction with a second trigger mode to gate that second trigger. If using this mode as a single trigger source the card will detect a trigger event at the time when entering the window defined by the two trigger levels (acting like window enter trigger) or if the trigger signal is already inside the programmed window at the start it will immediately detect a trigger event.
The trigger input is continuously sampled with the selected sample rate. The trigger event will be detected if the trigger input is inside the programmed trigger window.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_INWIN 00000080h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the upper trigger level in mV mV
SPC_TRIG_EXT0_LEVEL1 42330 read/write Set it to the lower trigger level in mV mV
Outside window trigger
This trigger mode will generate an internal gate signal that can be useful in conjunction with a second trigger mode to gate that second trigger. If using this mode as a single trigger source the card will detect a trigger event at the time when leaving the window defined by the two trigger levels (acting like leaving window trigger) or if the trigger signal is already outside the programmed windo at the start it will immediately detect a trigger event.
The trigger input is continuously sampled with the selected sample rate. The trigger event will be detected if the trigger input is outside the programmed trigger window.
Register Value Direction set to Value
SPC_TRIG_EXT0_MODE 40510 read/write SPC_TM_OUTSIDEWIN 00000100h
SPC_TRIG_EXT0_LEVEL0 42320 read/write Set it to the upper trigger level in mV mV
SPC_TRIG_EXT0_LEVEL1 42330 read/write Set it to the lower trigger level in mV mV
(c) Spectrum GmbH 95
External (TTL) trigger using multi purpose I/O connectors Trigger modes and appendant registers

External (TTL) trigger using multi purpose I/O connectors

The M3i card series has two additional multi purpose lines that can be programmed as additional TTL trigger inputs to be combined ei­ther with the main (analog) external trigger or with some of the chan­nel trigger modes explained later in this manual.
Please keep in mind that the multi purpose I/O lines need to be switched to trigger input prior to being operated as trigger input. The programming of the masks and the multi purpose I/O behaviour is shown in the chapters before.

TTL Trigger Mode

Please find the multi purpose TTL trigger input modes below. A detailed description of the modes follows in the next chapters..
Register Value Direction Description
SPC_TRIG_EXT1_AVAILMODES 40501 read Bitmask shwoing all available trigger modes for external 1 (Ext1) = multi purpose X0
SPC_TRIG_EXT2_AVAILMODES 40502 read Bitmask shwoing all available trigger modes for external 2 (Ext2) = multi purpose X1
SPC_TRIG_EXT1_MODE 40511 read/write Defines the external trigger mode for the multi purpose X0 MMCX connector trigger input. The trig-
SPC_TRIG_EXT2_MODE 40512 read/write Defines the external trigger mode for the multi purpose X1 MMCX connector trigger input. The trig-
SPC_TM_NONE 00000000h Channel is not used for trigger detection. This is as with the trigger masks another possibility for disabling channels.
SPC_TM_POS 00000001h Trigger detection for positive edges
SPC_TM_NEG 00000002h Trigger detection for negative edges
SPC_TM_BOTH 00000004h Trigger detection for positive and negative edges
SPC_TM_HIGH 00000008h Trigger detection for HIGH levels
SPC_TM_LOW 00000010h Trigger detection for LOW levels
ger need to be added to either OR or AND mask input to be activated.
ger need to be added to either OR or AND mask input to be activated.
For all external edge and level trigger modes, the OR mask must contain the corresponding input, as the following table shows:
Register Value Direction Description
SPC_TRIG_ORMASK 40410 read/write Defines the OR mask for the different trigger sources.
SPC_TMASK_EXT1 4h Enable multi purpose X0 external trigger input for the OR mask
SPC_TMASK_EXT2 8h Enable multi purpose X1 external trigger input for the OR mask

Edge and level triggers

Rising edge TTL trigger
This mode is for detecting the rising edges of an external TTL sig­nal. The board will trigger on the first rising edge that is detected after starting the board. The next triggerevent will then be detect­ed, if the actual recording/replay has finished and the board is armed and waiting for a trigger again.
Register Value Direction Description
SPC_TRIG_EXT1_MODE 40511 read/write Sets the trigger mode for multi purpose X0 trigger input.
SPC_TRIG_EXT2_MODE 40512 read/write Sets the trigger mode for multi purpose X1 trigger input.
SPC_TM_POS 1h Sets the trigger mode for external TTL trigger to detect positive edges.
Example on how to set up the board for positive TTL trigger:
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_POS);// Set up ext. TTL trigger to detect positive edges
96 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers External (TTL) trigger using multi purpose I/O connectors
HIGH level TTL trigger
This trigger mode will generate an internal gate signal that can be very good used together with a second trigger mode to gate the trigger. If using this mode as a single trigger source the card will detect a trigger event at the time when entering the high level (act­ing like positive edge trigger) or if the trigger signal is already at high level at the start it will immediately detect a trigger event.
The trigger input is continuously sampled with the selected sample rate. The trigger event will be detected if the trigger input is at TTL high level.
Register Value Direction Description
SPC_TRIG_EXT1_MODE 40511 read/write Sets the trigger mode for multi purpose X0 trigger input.
SPC_TRIG_EXT2_MODE 40512 read/write Sets the trigger mode for multi purpose X1 trigger input.
SPC_TM_HIGH 8h Sets the trigger mode for external TTL trigger to detect HIGH levels.
Negative TTL trigger
This mode is for detecting the falling edges of an external TTL sig­nal. The board will trigger on the first falling edge that is detected after starting the board. The next triggerevent will then be detect­ed, if the actual recording/replay has finished and the board is armed and waiting for a trigger again.
Register Value Direction Description
SPC_TRIG_EXT1_MODE 40511 read/write Sets the trigger mode for multi purpose X0 trigger input.
SPC_TRIG_EXT2_MODE 40512 read/write Sets the trigger mode for multi purpose X1 trigger input.
SPC_TM_NEG 2h Sets the trigger mode for external TTL trigger to detect negative edges.
LOW level TTL trigger
This trigger mode will generate an internal gate signal that can be very good used together with a second trigger mode to gate the trigger. If using this mode as a single trigger source the card will detect a trigger event at the time when entering the low level (acting like negative edge trigger) or if the trigger signal is already at low level at the start it will immediately detect a trigger event.
The trigger input is continuously sampled with the selected sample rate. The trigger event will be detected if the trigger input is at TTL low level.
Register Value Direction Description
SPC_TRIG_EXT1_MODE 40511 read/write Sets the trigger mode for multi purpose X0 trigger input.
SPC_TRIG_EXT2_MODE 40512 read/write Sets the trigger mode for multi purpose X1 trigger input.
SPC_TM_LOW 10h Sets the trigger mode for external TTL trigger to detect LOW levels.
(c) Spectrum GmbH 97
Channel Trigger Trigger modes and appendant registers
Positive and negative TTL trigger (both edges)
This mode is for detecting the rising and falling edges of an ex­ternal TTL signal. The board will trigger on the first rising or falling edge that is detected after starting the board. The next trigger­event will then be detected, if the actual recording/replay has fin­ished and the board is armed and waiting for a trigger again.
Register Value Direction Description
SPC_TRIG_EXT1_MODE 40511 read/write Sets the trigger mode for multi purpose X0 trigger input.
SPC_TRIG_EXT2_MODE 40512 read/write Sets the trigger mode for multi purpose X1 trigger input.
SPC_TM_BOTH 4h Sets the trigger mode for external TTL trigger to detect positive and negative edges.

Channel Trigger

Overview of the channel trigger registers

The channel trigger modes are the most common modes, compared to external equipment like oscilloscopes. The huge variety of different channel trigger modes enable you to observe nearly any part of the analog signal. This chapter is about to explain the different modes in detail. To enable the channel trigger, you have to set the channel trig­germode register accordingly. Therefore you have to choose, if you either want only one channel to be the trigger source, or if you want to combine two or more channels to a logical OR or a logical AND trigger.
For all channel trigger modes, the OR mask must contain the corresponding input channels (channel 0 taken as example here):.
Register Value Direction Description
SPC_TRIG_CH_ORMASK0 40460 read/write Defines the OR mask for the channel trigger sources.
SPC_TMASK0_CH0 1h Enables channel0 input for the channel OR mask
The following table shows the according registers for the two general channel trigger modes. It lists the maximum of the available channel mode registers for your card’s series. So it can be that you have less channels installed on your specific card and therefore have less valid channel mode registers. If you try to set a channel, that is not installed on your specific card, a error message will be returned.
Register Value Direction Description
SPC_TRIG_CH_AVAILMODES 40600 read Bitmask, in which all bits of the below mentioned modes for the channel trigger are set, if available.
SPC_TRIG_CH0_MODE 40610 read/write Sets the trigger mode for channel 0. Channel 0 must be enabled in the channel OR/AND mask.
SPC_TRIG_CH1_MODE 40611 read/write Sets the trigger mode for channel 1. Channel 1 must be enabled in the channel OR/AND mask.
SPC_TM_NONE 00000000h Channel is not used for trigger detection. This is as with the trigger masks another possibility for disabling channels.
SPC_TM_POS 00000001h Enables the trigger detection for positive edges
SPC_TM_NEG 00000002h Enables the trigger detection for negative edges
SPC_TM_BOTH 00000004h Enables the trigger detection for positive and negative edges
SPC_TM_POS | SPC_TM_REARM 01000001h Trigger detection for positive edges on lebel 0. Trigger is armed when crossing level 1 to avoid false trigger on noise
SPC_TM_NEG | SPC_TM_REARM 01000002h Trigger detection for negative edges on lebel 1. Trigger is armed when crossing level 0 to avoid false trigger on noise
SPC_TM_LOW 00000010h Enables the trigger detection for LOW levels
SPC_TM_HIGH 00000008h Enables the trigger detection for HIGH levels
SPC_TM_WINENTER 00000020h Enables the window trigger for entering signals
SPC_TM_WINLEAVE 00000040h Enables the window trigger for leaving signals
SPC_TM_INWIN 00000080h Enables the window trigger for inner signals
SPC_TM_OUTSIDEWIN 00000100h Enables the window trigger for outer signals
98 M3i.48xx / M3i.48xx-exp Manual
Trigger modes and appendant registers Channel Trigger
If you want to set up a two channel board to detect only a positive edge on channel 0, you would have to setup the board like the following example. Both of the examples either for the single trigger source and the OR trigger mode do not include the necessary settings for the trigger levels. These settings are detailed described in the following paragraphs.
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH_ORMASK0, SPC_TMASK0_CH0); // Enable channel 0 in the OR mask spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH0_MODE, SPC_TM_POS ); // Set triggermode of channel 0 to positive edge
If you want to set up a two channel board to detect a trigger event on either a positive edge on channel 0 or a negative edge on channel 1 you would have to set up your board as the following example shows.
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH_ORMASK0, SPC_TMASK0_CH0 | SPC_TMASK0_CH1); // Enable channel 0 + 1 spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH0_MODE, SPC_TM_POS ); // Set triggermode of channel 0 to positive edge spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH1_MODE, SPC_TM_NEG ); // Set triggermode of channel 1 to negative edge

Channel trigger level

All of the channel trigger modes listed above require at least one trigger level to be set (except SPC_TM_NONE of course). Some modes like the window triggers require even two levels (upper and lower level) to be set.
After the data has been sampled, the upper N data bits are compared with the N bits of the trigger levels. The following table shows the level registers and the possible values they can be set to for your specific card.
As the trigger levels are compared to the digitized data, the trigger levels depend on the channels input range. For every input range available to your board there is a corresponding range of trigger levels. On the different input ranges the possible stepsize for the trigger levels differs as well as the maximum and minimum values. The table further below gives you the absolute trigger levels for your specific card series.
10 bit resolution for the trigger levels:
Register Value Direction Description Range
SPC_TRIG_CH0_LEVEL0 42200 read/write Trigger level 0 channel 0: main trigger level / upper level if 2 levels used -511 to +511
SPC_TRIG_CH1_LEVEL0 42201 read/write Trigger level 0 channel 1: main trigger level / upper level if 2 levels used -511 to +511
SPC_TRIG_CH0_LEVEL1 42300 read/write Trigger level 1 channel 0: auxiliary trigger level / lower level if 2 levels used -511 to +511
SPC_TRIG_CH1_LEVEL1 42301 read/write Trigger level 1 channel 1: auxiliary trigger level / lower level if 2 levels used -511 to +511
Trigger level representation depending on selected input range
Input ranges
Triggerlevel ±200 mV ±500 mV ±1 V ±2 V ±2.5 V ±5 V ±10 V
Path 0 (Buffered) x x x x n.a. x x
Path 1 (HF, 50 Ohms) n.a. x x n.a. x x n.a.
511 +199.6 mV +499.0 mV +998.0 mV +1.996 V +2.495 V +4.99 V +9.98 V
510 +199.2 mV +498.0 mV +996.0 mV +1.992 V +2.490 V +4.98 V +9.96 V
256 +100.0 mV +250.0 mV +500.0 mV +1.00 V +1.25 V +2.50 V +5.00 V
2 +0.8 mV +2.0 mV +4.0 mV +7.8 mV +9.8 mV +19.6 mV +39.0 mV
1 +0.4 mV +1.0 mV +2.0 mV +3.9 mV +4.9 mV +9.8 mV +19.5 mV
0 0 V0 V0 V0 V 0V0 V0 V
-1 -0.4 mV -1.0 mV -2.0 mV -3.9 mV -4.9 mV -9.8 mV -19.5 mV
-2 -0.8 mV -2.0 mV -4.0 mV -7.8 mV -9.8 mV -19.6 mV -39.0 mV
-256 -100.0 mV -250.0 mV -500.0 mV -1.00 V -1.25 V -2.50 V -5.00 V
-510 -199.2 mV -498.0 mV -996.0 mV -1.992 V -2.490 V -4.98 V -9.96 V
-511 -199.6 mV -499.0 mV -998.0 mV -1.996 V -2.495 V -4.99 V -9.98 V
Step size 0.4 mV 1.0 mV 2.0 mV 3.9 mV 4.9 mV 9.8 mV 19.5 mV
The following example shows, how to set up a one channel board to trigger on channel 0 with rising edge. It is assumed, that the input range of channel 0 is set to the the ±200 mV range. The decimal value for SPC_TRIG_CH0_LEVEL0 corresponds then with 16.0 mV, which is the resulting trigger level.
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH0_MODE, SPC_TM_POS); // Setting up channel trig (rising edge) spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH0_LEVEL0, 40); // Sets triggerlevel to 16.0 mV spcm_dwSetParam_i32 (hDrv, SPC_TRIG_CH_ORMASK0, SPC_TMASK0_CH0); // and enable it within the OR mask
(c) Spectrum GmbH 99
Channel Trigger Trigger modes and appendant registers
Reading out the number of possible trigger levels
The Spectrum driver also contains a register that holds the value of the maximum possible different trigger levels considering the above men­tioned exclusion of the most negative possible value. This is useful, as new drivers can also be used with older hardware versions, because you can check the trigger resolution during run time. The register is shown in the following table:
Register Value Direction Description
SPC_READTRGLVLCOUNT 2500 r Contains the number of different possible trigger levels meaning ± of the value.
In case of a board that uses 8 bits for trigger detection the returned value would be 127, as either the zero and 127 positive and negative values are possi­ble.The resulting trigger step width in mV can easily be calculated from the re-
Trigger step width
Input Range
---------------------------------------------------------------------------------------------------------------------= Number of trigger levels 1+
max
turned value. It is assumed that you know the actually selected input range.
To give you an example on how to use this formula we assume, that the ±1.0 V input range is selected and the board uses 8 bits for trigger detection.
Trigger step width
+1000 mV
---------------------------------------------= 127 1+
The result would be 7.81 mV, which is the step width for your type of board within the actually chosen input range.

Detailed description of the channel trigger modes

For all channel trigger modes, the OR mask must contain the corresponding input channels (channel 0 taken as example here):
Register Value Direction Description
SPC_TRIG_CH_ORMASK0 40460 read/write Defines the OR mask for the channel trigger sources.
SPC_TMASK0_CH0 1h Enables channel0 input for the channel OR mask
Channel trigger on positive edge
The analog input is continuously sampled with the selected sample rate. If the programmed trigger level is crossed by the channel’s signal from lower values to higher values (ris­ing edge) then the trigger event will be detected.
These edge triggered channel trigger modes correspond to the trigger possibilities of usual oscilloscopes.
Register Value Direction set to Value
SPC_TRIG_CH0_MODE 40610 read/write SPC_TM_POS 1h
SPC_TRIG_CH0_LEVEL0 42200 read/write Set it to the desired trigger level relatively to the channel’s input range. board dependent
Channel trigger on negative edge
The analog input is continuously sampled with the selected sample rate. If the programmed trigger level is crossed by the channel’s signal from higher values to lower values (fall­ing edge) then the trigger event will be detected.
These edge triggered channel trigger modes correspond to the trigger possibilities of usual oscilloscopes.
Register Value Direction set to Value
SPC_TRIG_CH0_MODE 40610 read/write SPC_TM_NEG 2h
SPC_TRIG_CH0_LEVEL0 42200 read/write Set it to the desired trigger level relatively to the channel’s input range. board dependent
100 M3i.48xx / M3i.48xx-exp Manual
Loading...