120
M2i.60xx / M2i.60xx-exp Manual
Software Interface
Option Star-Hub
This example shows the complete setup and synchronization start for our four cards:
Using one of the wait commands for the star-hub will return as soon as the card holding the star-hub has
reached this state. However when synchronizing cards with different sampling rates or different memory siz-
es there may be other cards that still haven’t reached this level.
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.
Excluding cards from trigger synchronization
When synchronizing cards with the Star-Hub option it is possible and most likely to synchronize clock and trigger. For some applications it
can be useful to synchronize the sampling clock only for one or multiple cards. This can be useful, when acquisition cards are synchronized
together with one or multiple generation cards. When these cards are used to feed a DUT (device under test) with signals and the result/
reaction is to be recorded, it is often necessary that the generation is in progress before the acquisition can begin.
For such applications it is possible to exclude one or multiple of the synchronized cards from receiving the Star-Hub trigger:
The following example shows, how to exclude certain cards from receiving the synchronization trigger:
By default all cards that are enabled for synchronization are set to take part in clock and trigger synchronization.
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.
spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, 0x000F); // all 4 cards are masked
spcm_dwSetParam_i32 (hSync, SPC_SYNC_CLKMASK, 0x0004); // card 2 is selected as clock master
// to keep it easy we set all card to the same clock and disable trigger
for (i = 0; i < 4; i++)
{
spcm_dwSetParam_i32 (hCard[i], SPC_CLOCKMODE, SPC_CM_INTPLL);
spcm_dwSetParam_i32 (hCard[i], SPC_SAMPLERATE, MEGA(1));
spcm_dwSetParam_i32 (hCard[i], SPC_TRIG_ORMASK, SPC_TM_NONE);
}
// card 0 is trigger master and waits for external positive edge
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_ORMASK, SPC_TMASK_EXT0);
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_EXT0_MODE, SPC_TM_POS);
// start the cards and wait for them a maximum of 1 second to be ready
spcm_dwSetParam_i32 (hSync, SPC_TIMEOUT, 1000);
spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER);
if (spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_WAITREADY) == ERR_TIMEOUT)
printf ("Timeout occured - no trigger received within time\n")
Register
Value
Direction
Description
SPC_SYNC_NOTRIGSYNCMASK
49210
read/write
Bitmask that defines which of the connected cards is using it’s own trigger engine as trigger source
instead of using the synchronization trigger. If set to 1, a card only uses the synchronization clock,
when set to 0 the card uses also the synchronization trigger. By default this mask is set to 0 for all
cards.
spcm_dwSetParam_i32 (hSync, SPC_SYNC_NOTRIGSYNCMASK, 0x00000005); // Exclude cards 0 and 2 from sync trigger