Automotive and Embedded Networks

Showing results for 
Search instead for 
Did you mean: 

Synchronize CAN PXI-8512/2 and DAQ PXI-6220

Go to solution



I have read some examples and other posts about the topic "syncronization", but I need some more information.


I am using a PXI-8512/2 with an old application, based on the Frame API. Multiple frames are transmitted and received periodically, and I need to capture a single arbitration ID which has a cycle of ~5 ms.

Parallel I need to run a DAQ task (analog input) with a sample rate of 1000 Hz.


The challenge is, that I need to have the same timebase for analog input and CAN.

As far as I understood, the CAN timestamps are created in the PXI-8512. The start timestamp of the DAQ tasks is based on the OS time (Windows).

The CAN transmission/reception should be running always (to keep the ECU alive), and the DAQ task will be triggered manually.


I found the example "\nican\Frame - Basic with NI-DAQmx.llb\CAN Frame API Input DAQmx". Does it match my requirements? There is a comment saying: "The AI Start uses the same sample rate as CAN". What does it mean? The sample rate of my CAN basically is different from DAQ. But I have to be able to associate every DAQ sample to a CAN frame (same timebase).


Thanks for any any information helping to clarify.



0 Kudos
Message 1 of 10



The documentation states "...Both boards are using the DAQ Start Trigger and share the DAQ Timebase..." (at least in LabVIEW 2013). What bothers me is this sentence: "...This example requires an NI E-Series or M-Series Multifunction I/O (MIO) device...." You have a X-series device. I guess it should work anyway - otherwise you would receive an error.


But I would prefer to use the more advances X-NET driver instead of the CAN driver. With this driver comes the example "Synchronize XNET CAN with X series DAQ". This example definately meets your requirements: "This example demonstrates how to synchronize the NI-XNET timebase with a NI X Series timebase to ensure the input value timestamps are correlated."


Happy Christmas





0 Kudos
Message 2 of 10

... see the attachment...

0 Kudos
Message 3 of 10

Thank you!

It should be possible to migrate the NI-CAN source to NI-XNET.

But the example you mentioned is about a X-Series DAQ card, but my DAQ PXI-6220 is M-Series. It should work too?

0 Kudos
Message 4 of 10
Accepted by topic author flowschi
08-27-2015 04:09 PM



sorry, I don't know why I thought you had an X-Series. There is also an example for the other series with the XNET driver:


Synchronize PXI-CAN with DAQmx Analog Input (Using PXI-Clk10).vi


Kind regards 


Message 5 of 10

Thank you. Smiley Happy
The examples are showing how to simultaneously start the DAQ Task and the XNET Session, and they will be stopped together.


Is it possible to sync the timebase of the DAQ card and the CAN card "always", independent from starting/stopping tasks or sessions?



edit: I want to to be more exact:


Currently I am using the PXI-8512 with the XNET drivers to handle my restbus and diagnostics (using Frame In Stream and Frame Out Stream). I've got all the signals I need. But simultaneously I need to run an AIN task with the PXI-6220, while the XNET sessions should just continue running. The timebase of the AIN waveform should be synced with the CAN timebase.


What would be correct way to wire up things? If possible, I don't want/need to use the StartTrigger for starting simultaneously.

Do I just need to import the PXI_Clk10 to the AIN tasks's RefClk.Src and .Rate?

0 Kudos
Message 6 of 10



I have things working like I mentioned in the previous post. The XNET session is running always in the background. I am starting the DAQ tasks on demand, where I import the PXI_Clk10 to the RefClk.Src.

It's working, but I am  not sure if the timebase is really synced. So again my question: The start trigger from the example "Synchronize PXI-CAN with DAQmx Analog Input (Using PXI-Clk10)" is optional and not necessary to have the same timebase?



0 Kudos
Message 7 of 10

A start trigger is not necessary to have the same timebase (if both of them are connected to PxiClk10, the timestamps will increase at the same rate). A start trigger can be used to help you align the two waveforms.

Message 8 of 10

Thank you. What other options do I have to align the waveforms?

Currently my CAN stream in session is running all the time. When a AIN task is stated, I am logging all CAN frames. Afterwards I am subtracting the AIN's t0 from the CAN timestamps. The result is "almost aligned", there's a gap of ~100 ms, but I don't know how much it should be.

0 Kudos
Message 9 of 10



I got it working. I am using another XNET Session which imports the start trigger, exported by the AIN tasks (shown in example "Synchronize PXI-CAN with DAQmx Analog Input (Using PXI-Clk10)"). 

The result is perfect, thank you all!



0 Kudos
Message 10 of 10