130
M3i.48xx / M3i.48xx-exp Manual
Software Interface
Option Star-Hub (M3i and M4i only)
SH-Direct: using the Star-Hub clock directly without synchronization
Starting with driver version 1.26 build 1754 it is possible to use the clock from the star-hub just like an external clock and running one or
more cards totally independent of the synchronized card. The mode is by example useful if one has one or more output cards that run con-
tinuously in a loop and are synchronized with star-hub and in addition to this one or more acquisition cards should make multiple acquisitions
but using the same clock.
For all M2i cards is is also possible to run the „slave“ cards with a divided clock. Therefore please program a desired divided sampling rate
in the SPC_SAMPLERATE register (example: running the star-hub card with 10 MS/s and the independent cards with 1 MS/s). The sampling
rate is automatically adjusted by the driver to the next matching value.
What is necessary?
• All cards need to be connected to the star-hub
• The card(s) that should run independently can not hold the star-hub
• The card(s) with the star-hub must be setup to synchronization even if it’s only one card
• The synchronized card(s) have to be started prior to the card(s) that run with the direct star-hub clock
Setup
At first all cards that should run synchronized with the star-hub are set-up exactly as explained before. The card(s) that should run indepen-
dently and use the star-hub clock need to use the following clock mode:
When using SH_Direct mode, the register call to SPC_CLOCKMODE enabling this mode must be written before
initiating a card start command to any of the connected cards. Also it is not allowed to be 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_dwGetErrorInfo_i32. Please see the example in
the card error handling chapter to see how the error handling is done.
Register
Value
Direction
Description
SPC_CLOCKMODE
20200
read/write
Defines the used clock mode
SPC_CM_SHDIRECT
128
Uses the clock from the star-hub as if this was an external clock
// setup of the generator card
spcm_dwSetParam_i32 (hCard[0], SPC_CARDMODE, SPC_REP_STD_SINGLE);
spcm_dwSetParam_i32 (hCard[0], SPC_LOOPS, 0); // infinite data replay
spcm_dwSetParam_i32 (hCard[0], SPC_CLOCKMODE, SPC_CM_INTPLL);
spcm_dwSetParam_i32 (hCard[0], SPC_SAMPLEATE, MEGA(1));
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_ORMASK, SPC_TM_SOFTWARE);
spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, 0x0001); // card 0 is the generator card
spcm_dwSetParam_i32 (hSync, SPC_SYNC_CLKMASK, 0x0001); // ...
// Setup of the acquisition card (waiting for external trigger)
spcm_dwSetParam_i32 (hCard[1], SPC_CARDMODE, SPC_REC_STD_SINGLE);
spcm_dwSetParam_i32 (hCard[1], SPC_CLOCKMODE, SPC_CM_SHDIRECT);
spcm_dwSetParam_i32 (hCard[1], SPC_SAMPLEATE, MEGA(1));
spcm_dwSetParam_i32 (hCard[1], SPC_TRIG_ORMASK, SPC_TMASK_EXT0);
spcm_dwSetParam_i32 (hCard[1], SPC_TRIG_EXT0_MODE, SPC_TM_POS);
// now start the generator card (sync!) first and then the acquisition card 2 times
spcm_dwSetParam_i32 (hSync, SPC_TIMEOUT, 1000);
spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER);
spcm_dwSetParam_i32 (hCard[1], SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY);
spcm_dwSetParam_i32 (hCard[1], SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY);