Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN and AO sync

I need to syncronize a 1kHz AO signal with a 100Hz CAN output signal.  I am using a PXI E-series DAQ card and a PXI series 2 CAN card and I am using a shared clock (from DAQ device) over RTSI.  I started with using frame API and filling the buffer with data assuming 10ms increments.  This is nearly working correctly, but the timing seems to be off.  I create a CAN obj with a 10ms period, but after 20 seconds, the CAN data is about 200ms faster than the AO. 
 
I then tried using channel API.  The signals now stay in sync, but since I need to write 20 sec worth of data, the software loop waits until it has finished writing the entire buffer.  I then tried to put this into a loop where I write small chunks at a time, but then it gets further behind each loop iteration and by the end, the CAN data is really far behind.
 
I would like to use the frame API but I have only found examples for syncronizing CANnet and not CANobj.  Has anyone used precise output timing for CAN objects?
0 Kudos
Message 1 of 2
(4,831 Views)
Hi,

It sounds like you have everything configured correctly.  One reason that the DAQ and CAN card might not be staying synchronized could be the DAQ card only supports even integer multiples of the 20MHz time base and the CAN card does not.  The Time Drift using DAQ knowledgebase explains more about this and how to correct it.  To help calculate the sample rate for the CAN card I have also attached Determining the Actual Sample Rate of an Acquisition knowledgebase. 

You should be able to use the CANnet frame API example from the LabVIEW examples and change the CAN vis to CANobj.

Regards,
Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(4,804 Views)