Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronization of multiple CAN Board and a DAQ Board in PXI Chasis

Hi all,

i have tried testing the NI example given about syncing multiple CAN Cards and a DAQ Card.

I have a CAN Node (CANOpen SDO read write) that sends the voltage value over the network every 20 msec approx.

on the same network, i have configured a CAN (PXI-8461) just for listening and a PXI-6225 for aquiring the same voltage measument.

since they both are in sync as per the example, i expected the starting timestamps be same for both....

but they are different by few mSec.

can anyone tell me why is it so...?
0 Kudos
Message 1 of 11
(7,598 Views)
If your CANopen function uses the CANopen Library, you did not use a Start Trigger to sync start DAQ and CAN since the Library does not support this.
That could be the reason for the time difference between thye clocks.
Could you share a small example, so i can see what your code is?
 
DirkW
0 Kudos
Message 2 of 11
(7,580 Views)
hi dirk,

find the code in the attachment (.llb).

and i just used Can Network Vis and take the frames based on the SDO object- arbitration.
i am not using CANOpen Library.
i just used the VIs for synchronization such as DAQmx connect disconnect and ncconnect and ncdisconnect...thats all.

After programmatically connecting the terminals, shall i have to trigger the RTSI line to get synchronization?

or is it just achived because of the clock...?

i am using labVIEW 8.2.1 and CAN 2.5 drivers and DAQmx 8.


0 Kudos
Message 3 of 11
(7,569 Views)

Hi,

Your example works fine. keep in mind that your CAN frame transmits every 20 ms. That means if the start trigger occurs and we missed the CAN frame the maximum time elapses until we receive the next frame and create the timestamp is 20 ms. So as long as you are below 20 ms everything should be fine.

If you want the time when the start trigger occured you could log the trigger as frame to your queue. This frame should allways have the earliest timestamp compared to DAQ. See the attached modified VI.

DirkW

0 Kudos
Message 4 of 11
(7,561 Views)
Hi DirkW,

Thanks a lot for the help.
yes, the start trigger frame always have the time stamp earlier than DAQ-frist time stamp...
i also understand there is a difference of 3-4 ms, because 'DAQmx Start Task' vi takes 3-4 msec.
i have tested that. (find the VI in attachment)

why is this 3-4 msec delay for DAQ mx Start, when the DAQ card and CAN card are triggered to start at the same time and based on same clock in synchronization?





0 Kudos
Message 5 of 11
(7,550 Views)

Yes, thats the funny part. I didn't mention it explecitly, but DAQmx doesnt create a timestamp onboard. DAQmx just delivers the data  and a increment and then creates a t0 based on the windows timer. CAN allways attaches onboard timestamps to the messages based on a clock which starts on start/ncopen or on start trigger.\

Thus when the starttrigger occures the starttrigger frames tells you when DAQ and CAN have started and because the read VI executes a little later there is a 4-5 ms difference between DAQmx t0 and the start trigger frame.

But this difference is the offset between CAN and DAQmx clock and you can just remove this offset. The time difference should not change because both boards are synced.

DirkW

Message 6 of 11
(7,544 Views)
Hi DirkW,

Thanks a lot for sharing your knowledge...

this sounds absolutely beautiful, and i thought of programatically remove the offset for correlating both data.
i have tried that and i failed to match the offset through out the data.

this is how i tried....

i have CAN Node that sends a message on switching-on.
i have connected the differential voltage of CAN-H and CAN-L to a analog input channel.

both i acquired for 10 sec and in between i toggled the supply to CAN Node.
i do capture a startup message with the time stamp.
i have added the initial offeset to the time stamp and tried to match the DAQ sample which will have some good amplitude indicating the message transfer on the bus.
but they are not matching...(they differ by few msec)

now i dont know how to test the synchronization of CAN and DAQ...

is there any other way to test this?






0 Kudos
Message 7 of 11
(7,540 Views)
Hi DirkW,

i am sorry...just ignore my earlier reply...

i have tested it after configuring the port to be listen only. in that case my CAN node sends the startup message multiple times (i dont know its specification)

when i tried with listen mode removed, my CAN node sends the message exactly once and gets the message acknowledged by the Port.
i this case, the time stamps of DAQ first sample and CAN message match after removing the offset programmaticlly.
it matches to the msec precision.

thanks a lot for your help



0 Kudos
Message 8 of 11
(7,534 Views)
Hi DirkW,

i found it more interesting.

i have increased the sampling rate of DAQ and found it more beautiful.

now after removing the offset, the time stamps match to 10 microsecond precision...

really good to see...thanks a lot...
0 Kudos
Message 9 of 11
(7,531 Views)

Hi Dirk,

 

I have a new problem...

 

i need to sychronize 2 CAN (series-2) ports (each 1 in different slot of PXI chasis) with a M-series DAQ Card for data comparison.

they are triggered by aitrigger of PXI-6255 Board (M-series). 

 

I expected the start trigger to be the same for both the ports. but they are not...

they differ by few msec...on an average about 6-9 msec...(see attachment)

 

can you help me solving this....?

 

0 Kudos
Message 10 of 11
(6,988 Views)