Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i synchronize multiple S-series devices?

I am trying to synchronize two S-series devices to run from the same MasterClock. The devices are the PCI6133 and PCI6115 respectively. I want want to use its internal clock, 20MHzTimeBase, and the other to phase lock to this clock. The devices are connected via an RTSI cable. The cable is defined in MAX, so no problem there. I want to send a signal from the ao of the 6115. I want this signal to trigger the ai of the 6133. I have succeeded in routing the start trigger from the ao to trigger the ai via RTSI. I am programming the software directly using c-commands. For example, to route the ao start trigger to trigger the ai, I used the DAQmxExportSignal command to export the ai start trigger to the RTSI, then set the ao trigger input to look at the RTSI. But I cannot figure out which C-command to use to set the source of the MasterClock of the ai. There is a DAQmxCfgSmpClkTiming command to set the terminal of the sample clock(s), but I don't see anything equivalent for setting the source of the MasterClock(s). I have found a command that is DAQmxSetRefClkSrc that might be what I need, but there is very limited documentation on it in the DAQmx C-reference manual. Is this the command I need? Alternatively, is it possible to export the sampleclock from one device to RTSI, then to use that line to trigger the sample acquisition of the other line? If so, is it then necessary to synchronize the MasterClocks of the 2 devices ? Because if the devices are sampling simultaneously, wouldn't they be synchronized by definition?
0 Kudos
Message 1 of 10
(5,422 Views)
Hi,

So far, you are doing things correctly. You can share the master timebase over RTSI line 7 according to the S Series User Manual on pages 3-29 and 11-4. Another valuable resource is the installed examples, and there is a C example for synchronizing multiple devices. The function call you want to make is "DAQmxSetMasterTimebaseSrc", and it's found in the example below:

ContinuousAI.c
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Synchronization\Multi-Device\Continuous AI

S Series User Manual

If you only share a start trigger, then each device will start acquiring at the same time, but since they aren't sharing clocks, there will be some drift between the two even if they're set to the same rate. So, when synchronizing devices, it's important to share both the clock and the trigger.

The Master Timebase is the on-board 20MHz or 80MHz timebase, so this is the best clock to share. The analog input sample clock is derived from the Master Timebase with a reserved counter, and while you could share the sample clock instead, sharing the Master Timebase is best. Finally, the Reference Clock only makes sense for DSA boards and is often called the Oversample Clock by others. These ideas are discussed in the NI-DAQmx Help file.

Please let me know if you'd like further clarification.

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 2 of 10
(5,406 Views)
Thanks Joe for the superb suggestions. The "DAQmxSetMasterTimebaseSrc" command solved my problems with the timebase synchronization. Currently I have my code configured to use the AO as the Master. That means the 12 channels of AI (8 on the 6133 and 4 on the 6115) are slaved to the clock to the Master clock of the 6115, via the AO. That is, I export the AO 20MHzTimebase to rtsi7 and and the AI task (all 12 channels) connect to that. It seems to work fine. In terms triggering I have one or two questions. I set the AI to trigger off the ao/SampleTrigger which I export to another of the rtsi lines. I set the AI task to trigger from this line and then start it. Then I use the "DAQmxWriteAnalogF64" command to send the output signal to the AO line (only using on in this case). The write command also triggers the AO task, which then triggers the AI task. This lso seems to work fine, except I notice that the 4 AI lines native to the 6115 read 8 fewer samples than the other 8 AI lines (native to 6133). The timing is correct, meaning all 12 lines start simultaneously, but the 6115 AI lines seem to run out of data to read too early. Any ideas? Also, I tried to figure out a way to start the AO task without triggering it. The way that occurred to me to do this was to issue the AO write command, "DAQmxWriteAnalogF64," while turning the autostart off (autostart=0). Then to issue the "DAQmxStartTask" command to start the AO task. The task indeed starts but the output is not what is expected. If I start the task first then issue the write command with the autostart on, is that better? Both the AO write and AI read will be in a loop. Thanks again.
0 Kudos
Message 3 of 10
(5,397 Views)
Hi,

I'm glad you've started sharing clocks and triggers. I'm confused, too, about why your 6115 analog input channels are 8 samples short.

I did some simulations today in LabVIEW (I know you're using C) and re-verified that DAQmx can auto-route triggers and clocks without manually exporting signals. You may want to try this for your application as well.

I set up two tasks in MAX: one analog input task for all 12 AI channels between the two boards and one analog output task for 1 AO channel. I had LabVIEW auto-generate the code for each task and made some simple modifications. I left the analog output task code alone, but modified the analog input code. I specified the source for the sample clock as the 6115's analog output sample clock. I also added a DAQmx Trigger VI and set a digital edge start trigger as the 6115's analog output sample clock. I ran the VI and it collected 100 samples from each analog input channel and the driver automatically routed the start trigger and clock over the RTSI bus. Note that this approach shares a sample clock and not the master timebase.

If you try something similar in C and it still doesn't work, let me know. It would also be helpful to have some more information about what you're trying to do. What is your overall objective -- are you testing some piece of hardware? Describe your input and output requirements: expected ranges and frequency content. Describe the tasks you've set up: what triggers and clocks are you using? I know you've already gone into this a little, but your last post was a little circular and it was difficult to parse it.

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 4 of 10
(5,383 Views)

Hi All-

You may also be interested to know that S Series devices have supported multi-device tasks since (if my recollection is correct) the NI-DAQmx 8.3.1 release.  This means that you don't have to worry about exporting signals, configuring timebases, etc.  If you have two (or more) S Series devices and a RTSI cable or PXI chassis configured in MAX that connects the two, you can simply create AI tasks using channel lists of the form "DevX/aiM:N, DevY/aiP:Q" or similar.  NI-DAQmx will handle all signal routing and synchronization behind the scenes. 

FYI, this feature is also supported for DSA boards but is not supported for MIO (i.e. M Series, E Series, B Series, etc). 

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 5 of 10
(5,367 Views)
Hi Tom,
 
As I mentioned, I am trying to synchronize and use S-6133 and S-6115 together.  I understand the synchronization bit you described in your reply to my original posting. I am a bit confused about something though. The voltage settings of the 6133 and 6115 are different. Meaning, for example, that on the 6115 there is a 1 V input range and on the S-6133 the minimum voltage range setting is 1.25 V. Thus, the values don't match. When I make a joint task for these instrument, how does the voltage assignment work?
 
For example let's say I use a channel list like "Dev1/ai:0:8,Dev2/ai0:4" for 12 channel analog input, where Dev1 is the 6133 and Dev2 is the 6115. In the command to create the task, the string Dev1/ai:0:8,Dev2/ai0:4" is one of the input parameters. Another parameter is the minimum and maximum voltage settings. If I am creating a single analog input task for these two devices, which voltage range setting do I use, +/-1.25, or +/-1?
 
Thanks,
Shane 
0 Kudos
Message 6 of 10
(5,049 Views)
You don't have to add all the channels with a single channel VI.  You can explicitly create the task, add the 6115 channels with one VI and then add the 6133 channels with another VI.  That way you can use different settings for each!
------
Zach Hindes
NI R&D
0 Kudos
Message 7 of 10
(5,023 Views)
Thanks Zach. Unfortunately, I am not using LabView. I interfacing with the instruments using the NiDAQmx functionality (via matlab). There are commands for doing this. For example, the command I use for this is something like 'CreateAnalogInputChannel' (not sure of the exact name though because I am not in front of the experiment computer). This command takes as inputs the task, the max voltage, the min voltage, and a few other parameters. My confusion stems from the fact that I created a single task for 2 different devices, the 6133 and the 6115. Each has different voltage range settings (i.e. none of the ones I want are shared). But in the command I mentioned above, there is a single task and a single set of voltage range inputs to the command. So, my interpretation is that the voltage range settings are being associated with the task rather than the individual devices involved in the task. Am I making sense? Anyway, if you hve any thoughts on how this works even in the case of LabView, I'd appreciate it, so that I can have a better understanding of how the interface between the task and its devices operates. thanks again.
0 Kudos
Message 8 of 10
(5,019 Views)

Hi Shane,

 

It shouldn't matter if you're using LabVIEW or not. The C API of NI-DAQmx has the same functionality as it does in LabVIEW. As long as you're using this or whatever 3rd party tool you're using calls into the C API for NI-DAQmx, you'll be able to do what Zach mentioned. The NI-DAQmx C Reference Help can be found from the Start Menu>>Programs>>National Instruments>>NI-DAQ>>NI-DAQmx C Reference Help.

 

In there, you'll find the function that you've already been using, DAQmxCreateAIVoltageChan. This function allows you to specify physical channels, set the min and max voltage, as well as other things. As you can see in the reference help, it states that the taskHandle input is, "The task to which to add the channels that this function creates." As you can see, the voltage settings are being associated with the channel and not the task, so you can call DAQmxCreateTask to create your task and then add multiple channels to the task by calling DAQmxCreateAIVoltageChan multiple times. The rest of your NI-DAQmx calls, such as DAQmxCfgSampClkTiming,  should take the task handle. I hope that clarifies Zach's post a little bit for you.

0 Kudos
Message 9 of 10
(5,004 Views)

lion-o...

 

Now I get it. Very nice description. Thanks. I will give it a shot.

 

Shane 

0 Kudos
Message 10 of 10
(5,001 Views)