118
M2i.60xx / M2i.60xx-exp Manual
Software Interface
Option Star-Hub
Now the program has to check both star-hubs:
In case of the above mentioned cabling this program except will return:
For the following examples we will assume that 4 cards in one system are all connected to one star-hub to keep things easier.
Setup of Synchronization and Clock
The synchronization setup only requires two additional registers to enable the cards that are synchronized in the next run and to select a clock
master for the next run.
The enable mask is based on the logical index explained above. It is possible to just select a couple of cards for the synchronization. All other
cards then will run independently. Please be sure to always enable the card on which the star-hub is located as this one is a must for the
synchronization.
One of the enabled cards must be selected to be the clock master for the complete system. If you intend to run cards with different clock
speeds the clock master must have the highest clock as all other cards will derive their clock by dividing the master clock. The locally selected
clock source from the clock master is routed throughout the complete synchronized system.
When using external clock please be sure that the external clock stays within all limits of all synchronized
cards. Please take special care regarding the minimum and maximum frequencies as offending these may
damage components on the cards!
In our example we synchronize all four cards and select card number 2 to be the clock master:
When running the slave cards with a divided clock it is simply necessary to write the desired sampling rate to this card. The synchronization
will automatically calculate the matching divider and set up all details internally:
for (j = 0; j < lStarhubCount; j++)
{
spcm_dwGetParam_i32 (hSync[j], SPC_SYNC_READ_SYNCCOUNT, &lSyncCount);
for (i = 0; i < lSyncCount; i++)
{
spcm_dwGetParam_i32 (hSync[j], SPC_SYNC_READ_CA i, &lCardIdx);
printf ("star-hub %c logical index %d is connected with card %d\n“, (!j ? ’A’ : ’B’), i, lCardIdx);
}
printf ("\n");
}
star-hub A logical index 0 is connected with card 2
star-hub A logical index 1 is connected with card 4
star-hub A logical index 2 is connected with card 5
star-hub B logical index 0 is connected with card 0
star-hub B logical index 1 is connected with card 3
Register
Value
Direction
Description
SPC_SYNC_ENABLEMASK
49200
read/write
Mask of all cards that are enabled for the synchronization
Register
Value
Direction
Description
SPC_SYNC_CLKMASK
49220
read/write
Mask of the card that is the clock master, only one bit is allowed to be set
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
// set the clock master to 1 MS/s internal clock
spcm_dwSetParam_i32 (hCard[2], SPC_CLOCKMODE, SPC_CM_INTPLL);
spcm_dwSetParam_i32 (hCard[2], SPC_SAMPLERATE, MEGA(1));
// set all the slaves to run synchronously with 1 MS/s
spcm_dwSetParam_i32 (hCard[0], SPC_SAMPLERATE, MEGA(1));
spcm_dwSetParam_i32 (hCard[1], SPC_SAMPLERATE, MEGA(1));
spcm_dwSetParam_i32 (hCard[3], SPC_SAMPLERATE, MEGA(1));
// set the clock master to 1 MS/s internal clock
spcm_dwSetParam_i32 (hCard[2], SPC_CLOCKMODE, SPC_CM_INTPLL);
spcm_dwSetParam_i32 (hCard[2], SPC_SAMPLERATE, MEGA(1));
// set all the slaves to run with 100 kS/s only
spcm_dwSetParam_i32 (hCard[0], SPC_SAMPLERATE, KILO(100));
spcm_dwSetParam_i32 (hCard[1], SPC_SAMPLERATE, KILO(100));
spcm_dwSetParam_i32 (hCard[3], SPC_SAMPLERATE, KILO(100));