background image

48

M3i.48xx / M3i.48xx-exp Manual

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
 

 

Summary of Contents for M3i.4830

Page 1: ...Y PHONE 49 0 4102 6956 0 FAX 49 0 4102 6956 66 E MAIL info spec de INTERNET http www spectrum instrumentation com 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 Software Driver Manual English version November 21 2016 ...

Page 2: ...ruments 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 ...

Page 3: ... 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 I...

Page 4: ... 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 ...

Page 5: ...e 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...

Page 6: ...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...

Page 7: ...ncreased 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 ...

Page 8: ...ion 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 co...

Page 9: ...ing 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 ...

Page 10: ...lable 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 additio...

Page 11: ...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 producti...

Page 12: ...12 M3i 48xx M3i 48xx exp Manual Hardware information Introduction Hardware information Block diagram ...

Page 13: ...p 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 ...

Page 14: ...ts 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 Analog Input...

Page 15: ...79 2 79 3 77 8 77 4 77 7 75 3 83 4 77 7 47 8 SNR typ dB 73 1 73 3 73 4 71 9 71 4 72 8 73 1 71 1 72 8 68 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 7 11 7 11 7 11 5 11 4 11 6 11 5 11 5 11 6 7 6 ENOB bas...

Page 16: ...e 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...

Page 17: ...s 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 ...

Page 18: ...ert 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 i...

Page 19: ...Installation Installing the board in the system c Spectrum GmbH 19 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 ...

Page 20: ...t 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 v...

Page 21: ... 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 insert...

Page 22: ...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...

Page 23: ...his 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 ...

Page 24: ...ke 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 Version control If you want to check which driver version is installed in the system this can be eas ily done in th...

Page 25: ...ect 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 need...

Page 26: ...ry 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...

Page 27: ...ss 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...

Page 28: ...s 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...

Page 29: ...r 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 de...

Page 30: ...y 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 ...

Page 31: ...tall 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 need...

Page 32: ...xtract the files from the rpm matching your distribution 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 Run ldd spcm_con...

Page 33: ...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 ...

Page 34: ...neratorNETBOX 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 e...

Page 35: ... 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 cl...

Page 36: ...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 liste...

Page 37: ...ured 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 ...

Page 38: ...al 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 o...

Page 39: ...he 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 Accessin...

Page 40: ...ples 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 ...

Page 41: ...ile to have access to all driver functions A makefile may look like this 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...

Page 42: ...unction 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...

Page 43: ...SetParam Example 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...

Page 44: ...PCISERIALNO lSerialNumber printf Your card has serial number 05d n lSerialNumber 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 p...

Page 45: ...ate 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_dwD...

Page 46: ...nternally 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 Example uint32 _stdcall spcm_dwInvalidateBuf invalidate the transfer buffer drv_handle hDevice handle to ...

Page 47: ...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 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...

Page 48: ...ample 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...

Page 49: ...vice 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...

Page 50: ...e 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 Initializa...

Page 51: ...orer 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 Example for digitizerNETBOX and remotely installed cards namespace Spcm public class Drv DllImport spcm_win32 dll public static extern IntPtr spcm_hOpen string szDeviceName DllImport spcm_w...

Page 52: ...river object are available Please see the example in the directory JSharp as a start Example for digitizerNETBOX and remotely installed cards 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_PCISER...

Page 53: ...aram_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_dwSe...

Page 54: ...d 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...

Page 55: ... C compiler for Windows or Linux Complete C C Example 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 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 in...

Page 56: ...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 lo...

Page 57: ...er 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 One of the following ...

Page 58: ... 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 Card type Card type as defined in regs h Value hexadecimal Value decimal Card type Card type as defined in regs h Value hexadecimal Value decimal M3i 4830 TYP_M3I4830 54830h 346160 M3i 4141 TYP_M3...

Page 59: ...sks below to get information about one certain feature 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_E...

Page 60: ...re averaging of data being recorded in segmented memory modes such as Multiple Recording or ABA 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_BITSPE...

Page 61: ...ead out the kernel and library version and how to print them This small program will generate an output like this 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 Register Value Direction Description SPC_GETKERNELVERSION 1210 read Gives information about the kernel driver version Driver Major Version Driver M...

Page 62: ...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...

Page 63: ...n be done directly after setting it or later like this Assuming that the two channels are available on your card the program will have the following output 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 ar...

Page 64: ...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...

Page 65: ...el 5000 5 V calibrated input range for the appropriate channel 10000 10 V 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 2500 2 5 V calibrated input range for the appropriate channel 5000 5 V calibrated input range for the appropriate channel Register Value Direction Descri...

Page 66: ...for the channel and the signal source is externally AC coupled This offset can be compensated for by setiing the compensation registers 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...

Page 67: ...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 If you want to make an offset and gain adjustment on all the channels and store the data to the ADJ_DEFAU...

Page 68: ...ds 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...

Page 69: ...r with the start command to enable trigger immediately or in a second call after some external hardware has been started M2CMD_CARD_FORCETRIGGER 10h This command forces a trigger even if none has been detected so far Sending this command together with the start command is similar to using the software trigger M2CMD_CARD_DISABLETRIGGER 20h The trigger detection is disabled All further trigger event...

Page 70: ...pending 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 val...

Page 71: ...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...

Page 72: ...en 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 tri...

Page 73: ...length of the transfer by two counters Loop and Segment size 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 Register Value Direction Description SPC_MEMSIZE 10000 read write Sets the memory size in samples per c...

Page 74: ... the maximum memory size figures will increase according to the complete installed memory All figures listed here are given in samples An entry of 32G 8 means 32 GSamples 8 34 359 738 360 samples 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_PRETRIGG...

Page 75: ...e Mem 2 64 MSample 128 MSample 256 MSample 512 MSample 1 GSample Mem 4 32 MSample 64 MSample 128 MSample 256 MSample 512 MSample 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 ...

Page 76: ... 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 als...

Page 77: ...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 r...

Page 78: ...ata 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 lByt...

Page 79: ...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 A returned sample value of for example 55 decimal would then convert to When converting samples that contain any additional data such as for example additional digital channels or overrange bits the extra information must be...

Page 80: ...ches 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 wi...

Page 81: ... 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 clo...

Page 82: ...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...

Page 83: ...mplete 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 t...

Page 84: ...ODE_DIGIN 00000004h Connector is programmed for digital input Digital channel X0 X1 is written as D14 D15 of data stream during 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 SPCM_XMODE_TRIGIN 00000010h Connector is prog...

Page 85: ...nel 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 cha...

Page 86: ...ption of the different trigger modes for the external trigger inputs will be shown in the dedicated passage within this chapter 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...

Page 87: ...ad 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 fo...

Page 88: ...0 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 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 mask are ...

Page 89: ...please take a look in the relating chapter about Acquisition Modes spcm_dwSetParam_i32 hDrv SPC_M2CMD M2CMD_CARD_FORCETRIGGER Force trigger is used 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...

Page 90: ...nal 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 be added to either OR or AND mask input to be activated 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 d...

Page 91: ...r 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 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 Register Value Direction Description Range SPC_TRIG_EXT_AVAIL0_MIN 42340...

Page 92: ...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 leve...

Page 93: ... 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 ev...

Page 94: ...en 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_MO...

Page 95: ...rigger event will be detected if the trigger input is inside the programmed trigger window 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 tri...

Page 96: ...t1 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 ger need to be added to either OR or AND mask input to be activated SPC_TRIG_EXT2_MODE 40512 read write Defines the external trigg...

Page 97: ...ode 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 ...

Page 98: ...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 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 Re...

Page 99: ...rigger level 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 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 s...

Page 100: ...ampled 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 Channel trigger on negative edge The analog input is continuously sampled with the selected sample rat...

Page 101: ...ssed from higher to lower values the trigger engine is armed and waiting for trigger If the programmed trigger level is crossed by the channel s 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 preven...

Page 102: ...grammed level at the start it will immediately detect a trigger event The channel is continuously sampled with the selected sample rate The trigger event will be detected if the analog signal is above the programmed trigger level Register Value Direction set to Value SPC_TRIG_CH0_MODE 40610 read write SPC_TM_WINENTER 00000020h SPC_TRIG_CH0_LEVEL0 42200 read write Set it to the upper trigger level ...

Page 103: ...ode 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 leaving the window defined by the two trigger levels acting like leaving window trigger or if the signal is already outside the programmed window at the start it will immediat...

Page 104: ... in FIFO Mode is similar to the Multiple Recording in Standard Mode In contrast to the standard mode it is not nec essary to program the number of samples to be recorded The acquisition is running until the user stops it The data is read block by block by the driver as described under FIFO single mode example earlier in this manual These blocks are online available for further data process ing by ...

Page 105: ...the card s trigger modes can be used except the software trigger For detailed information on the avail able trigger modes please take a look at the relating chapter earlier in this manual Trigger Counter The number of acquired trigger events in Multiple Recording mode is counted in hardware and can be read out while the acquisition is running or after the acquisition has finished The trigger event...

Page 106: ... Multiple Recording in standard mode The following example shows how to set up the card for Multiple Recording in FIFO mode spcm_dwSetParam_i32 hDrv SPC_CARDMODE SPC_REC_STD_MULTI Enables Standard Multiple Recording spcm_dwSetParam_i32 hDrv SPC_SEGMENTSIZE 1024 Set the segment size to 1024 samples spcm_dwSetParam_i32 hDrv SPC_POSTTRIGGER 768 Set the posttrigger to 768 samples and therefore the pre...

Page 107: ... s a timeout in milli seconds for waiting of an reference clock edge SPC_TIMESTAMP_AVAILMODES 47001 read Returns all available modes as a bitmap Modes are listed below SPC_TIMESTAMP_CMD 47000 read write Programs a timestamp mode and performs commands as listed below SPC_TSMODE_DISABLE 0 Timestamp is disabled SPC_TS_RESET 1h The counters are reset If reference clock mode is used this command waits ...

Page 108: ...starting the card the counter counts continuously The timestamps of one recording are referenced to the start of the recording This mode is very useful for Multiple Recording and Gated Sampling see according chapters for detailed information on these two optional modes The following table shows the valid values that can be written to the timestamp command register Register Value Direction Descript...

Page 109: ...IMEOUT register Example for initialization of timestamp reference clock and synchronization of a seconds signal with the PC clock Register Value Direction Description SPC_TIMESTAMP_STARTTIME 47030 read write Return the reset time when using reference clock mode Hours are placed in bit 16 to 23 minutes are placed in bit 8 to 15 seconds are placed in bit 0 to 7 SPC_TIMESTAMP_STARTDATE 47031 read wri...

Page 110: ...tself Extra data transfer shares the command and status register with the card control data transfer commands and status information The DMA based data transfer mode is activated as soon as the M2CMD_EXTRA_STARTDMA is given Please see next chapter to see how the polling mode works Register Value Direction Description SPC_M2CMD 100 write only Executes a command for the card or data transfer M2CMD_E...

Page 111: ...ith 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 buffer is completely used 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 func...

Page 112: ...xecuted Definition of the transfer buffer is similar to the above explained DMA buffer transfer The value notify size is ignored and should be set to 4k 4096 Buffer handling The buffer handling is also similar to the DMA transfer As soon as one of the registers SPC_TS_AVAIL_USER_LEN or SPC_ABA_AVAIL_USER_LEN is read the driver will read out all available data from the hardware and will return the ...

Page 113: ...96 void pcData 0 lBufSizeInBytes we start the polling mode dwError spcm_dwSetParam_i32 hDrv SPC_M2CMD M2CMD_EXTRA_POLL this is pur polling loop do spcm_dwGetParam_i32 hDrv SPC_TS_AVAIL_USER_LEN lAvailBytes spcm_dwGetParam_i32 hDrv SPC_TS_AVAIL_USER_POS lBytePos if lAvailBytes 0 printf We now have d new bytes available n lAvailBytes printf The available data starts at position d n lBytesPos we take...

Page 114: ...are no longer sign extended integer 64 values so that before using these stamps for calculations such as calcu lating the difference between two stamps one has to mask out the incremental counter and the Reference clock counter values of the stamps first Selecting the timestamp data format The selection between the different data format for the timestamps is done with a flag that is written to the...

Page 115: ...CARDMODE SPC_REC_STD_MULTI Enables Standard Multiple Recording spcm_dwSetParam_i32 hDrv SPC_SEGMENTSIZE 1024 Segment size is 1 kSample Posttrigger is 768 spcm_dwSetParam_i32 hDrv SPC_POSTTRIGGER 768 samples and pretrigger therefore 256 samples spcm_dwSetParam_i32 hDrv SPC_MEMSIZE 4096 4 kSamples in total acquired 4 segments setup the Timestamp mode and make a reset of the timestamp counter spcm_dw...

Page 116: ...e needs a second clock base As explained above the acquisition is not changing the sampling clock but runs the slower ac quisition with a divided clock The ABA memory setup including the divider value can be programmed with the following registers The resulting ABA clock is then calculated by sampling rate ABA divider Each segment can consist of pretrigger and or posttrigger samples The user alway...

Page 117: ...rd memory as listed below 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 SPC_REC_STD_ABA 8h Data acquisition to on board memory for multiple trigger events While the multiple trigge...

Page 118: ...s performed with the same command and status registers like the card control and sample data transfer It is possible to send commands for card control data transfer and extra FIFO data transfer at the same time setting the fast sampling clock as internal 100 MHz spcm_dwSetParam_i32 hDrv SPC_CLOCKMODE SPC_CM_INTPLL spcm_dwSetParam_i64 hDrv SPC_SAMPLERATE 100000000 enable the ABA mode and set the AB...

Page 119: ... DMA controller located on the card Even if the PC is busy with other jobs data is still transferred until the application buffer is completely used 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 cons...

Page 120: ...s executed Definition of the transfer buffer is similar to the above explained DMA buffer transfer The value notify size is ignored and should be set to 4k 4096 Buffer handling The buffer handling is also similar to the DMA transfer As soon as one of the registers SPC_TS_AVAIL_USER_LEN or SPC_ABA_AVAIL_USER_LEN is read the driver will read out all available data from the hardware and will return t...

Page 121: ...w 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 lBufSizeInBytes lAvailBytes lBufSizeInBytes lBytePos our do function get s a pointer to the start of the available data section and the length vProcessTimestamps pcData lBytesPos lAvailBytes the buffer section is now immed...

Page 122: ...n V2 06 or newer and firmware version V16 or newer M3i driver version V2 06 or newer and firmware version V6 or newer Please update your system to the newest versions to run this mode The programming details of the ABA mode and timestamp modes are each explained in a dedicated chapter in this manual normal timestamp setup e g setting timestamp mode to standard using internal clocking uint32 dwTime...

Page 123: ... the lines from outside the system to easily connect with external equipment The internal connectors are mounted on two locations on the base card The picture below shows the location of the MMCX connectors on the card the details of the connectors on the extra bracket are shown in the introductional part of this manual Different functions Asynchronous Digital I O This way of operating the option ...

Page 124: ...by a single 32 bit register If the register is read the actual pin data will be sampled Therefore reading the lines declared as outputs gives back the generated pattern The single bits of the digital I O lines correspond with the number of the bit of the 32 bit register Values written to the three upper bytes will be ignored Programming Example The following example shows how to program the lower ...

Page 125: ...25 This special sampling feature requires the option Timestamp to be installed Electrical specifications The electrical specifications of the BaseXIO inputs and outputs can be found either in the technical data section of this manual or in the datasheet ...

Page 126: ... is identical for all synchronized cards the sent out trigger of every single card depends on their trigger settings Star Hub clock engine The card holding the Star Hub is the clock master for the complete system If you need to feed in an external clock to a synchronized system the clock has to be connected to the master card Slave cards cannot generate a star hub system clock As shown in the draw...

Page 127: ...YNC_READ_SYNCCOUNT register to check whether the star hub has found the expected number of cards to be connected drv_handle hSync drv_handle hCard 4 for i 0 i 4 i sprintf s dev spcm d i hCard i spcm_hOpen s hSync spcm_hOpen sync0 spcm_vClose hSync for i 0 i 4 i spcm_vClose hCard i drv_handle hSync drv_handle hCard 2 for i 0 i 2 i sprintf s TCPIP 192 168 169 14 INST d INSTR i hCard i spcm_hOpen s h...

Page 128: ... be used on synchronization as well star hub logical index 0 is connected with card 0 star hub logical index 1 is connected with card 1 star hub logical index 2 is connected with card 2 star hub logical index 3 is connected with card 3 card Star Hub connection card handle star hub handle card index in star hub mask for this card in star hub card 0 dev spcm0 0 of star hub B 0x0001 card 1 dev spcm1 ...

Page 129: ... j 100 Register Value Direction Description SPC_M2CMD 100 write only Executes a command for the card or data transfer 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 internal settings like clock frequency and enabling ...

Page 130: ...modified later in the programming sequence to prevent the driver from calculating wrong sample rates Example In this example we have one generator card with the star hub mounted running in a continuous loop and one acquisition card running inde pendently using the SH Direct clock Error Handling The Star Hub error handling is similar to the card error handling and uses the function spcm_dwGetErrorI...

Page 131: ... new start menu entry in the Folder Spectrum GmbH to start the Remote Server To start the Remote Server automatically after login just copy this shortcut to the Autostart directory Linux Linux users find the versions of the installer for the different StdC libraries under under Install linux spcm_control_center as RPM packages To start the Remote Server type spcm_remote_server without quotation ma...

Page 132: ...t s not installed ERR_SEQUENCE 103h 259 Command sequence is not allowed Please check the manual carefully to see which command sequences are possible ERR_READABORT 104h 260 Data read is not allowed after aborting the data acquisition ERR_NOACCESS 105h 261 Access to this register is denied This register is not accessible for users ERR_TIMEOUT 107h 263 A timeout occurred while waiting for an interru...

Page 133: ...he PCI connector ERR_CARDNOSUPPORT 207h 519 The card that has been found in the system seems to be a valid Spectrum card of a type that is supported by the driver but the driver did not find this special type internally Please get the latest driver from http www spectrum instrumentation com and install this one ERR_FIFOHWOVERRUN 301h 769 Hardware buffer overrun in FIFO mode The complete on board m...

Page 134: ...tion is very simple everything works faster if the user buffer is not only virtually continuous but also physically continuous Unfortu nately it is not possible to get a physically continuous buffer for a user program Therefore the kernel driver has to do the job and the user program simply has to read out the address and the length of this continuous buffer This is done with the function spcm_dwG...

Page 135: ...fer 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 pd...

Page 136: ...onverters Single ended LVTTL sources All LVTTL sources be it 2 5V LVTTL or 3 3V LVTTL must be terminated with a 50 Ohm series resistor to avoid reflec tions and limit the maximum swing for the M3i card Differential LV PECL sources Differential drivers require equal load on both the true and the inverting outputs Therefore the inverting output should be loaded as shown in the drawing All PECL driv ...

Reviews: