Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization of 2 CAN Ports with an M-series DAQ Card

Hi all

 

I am trying to synchronize 2 CAN ports (each 2-series card in different PXI slot of same chasis) with a PXI-6255 DAQ Card.

 

I tried the example code by NI.

 

little modified to see the trigger frames of both the ports. they failed to match (differe by few msec)

 

i am attaching the code here...

 

can anyone tell me why they dont match? 

0 Kudos
Message 1 of 6
(6,905 Views)

Both CAN ports are handled by one onboard processor. Since he can timestamps, all incoming messages sequentialy you can see some ms difference. But you can assume that both ports are synchronized and just remove the offset for thye second port.

 

DirkW

0 Kudos
Message 2 of 6
(6,903 Views)

Hi DirkW,

 

i am sorry that i have not narrated the problem well...

 

here it is:

 

i use 2 PXI-8461 CAN Cards (each one with 1 port series 2) and a PXI-6255 DAQ Card (M-Series) to send the start trigger to both the CAN Cards.

i am logging the Start trigger frame of both the CAN Cards just to verify whether  they match.

 

they did not when i tried the example given in NI. i slightly modified to log start trigger frames.

they differ by few msec roghly 6-9 msec which is not acceptable in my application. i would not be able to correlate the data from port-1, port2 and DAQ.

 

In PXI chasis - 1033 with MXI4  copper cable:

DAQ card is in Slot-2

CAN-1 is Slot-4 

CAN-2 is Slot-6

 

even if there is propagation delay of trigger signal...i dont think there is msec delay....is it there?

 

i am not able to figure it out why so much delay...

 

can you please help me? 

 

 

0 Kudos
Message 3 of 6
(6,873 Views)

Hi Share_Good,

I'm looking at your code and I don't see where you are logging the start trigger, can you tell me which VI you are talking about in specific? The only time references I see are the ones in the Multiple CAN Cards Single DAQmx Card Input.vi, in which the code is running sequentially. Since you are reading one after the other, there will be a delay on how long the first read takes. 

Is there a reason why you are using two CAN ports instead of hooking everything up in one? Are you using these to mimic instruments? One CAN port should be able to read all the frames via one VI.

 

Thanks

Can Wong
0 Kudos
Message 4 of 6
(6,852 Views)

Hi Can W,

 

I am sorry that have attached a wrong VI.

 

please find the right one now in the attachements. this is nothing but an NI example. I have modified the code a little,

so that i can use for time stamp comparison and trigger using SCC-Module channel through NI-DAQ Card.

 

to your question, i have a reason to use 2 networks as the networks are operated at different baudrates.

i just want to listen to both the netwroks and compare the frame based on time after synchronization with DAQ Card.

problem is that the time difference is more if i use single port CAN cards in different PXI slots.

 

the time difference is tolerable when i used a 2 port CAN Card.

my question is why is so much difference between 2 can cards when they are triggered by the same triggering signal ?

 

(i dont think reading the start trigger frames in sequence doest not effect the time stamps as the time stamps are attached by the CAN controller but not windows...right?)

 

 

 

 

0 Kudos
Message 5 of 6
(6,848 Views)

Hi,

 

The time difference has a simple reason. Since every NI CAN board has one timing source, you have two different sources if you try to synchronize two NI CAN boards.

The timing source becomes initialized when the ncopen function is called. But because the open function is called twice for both boards approx 5 to 10 ms appart, you can see this difference within the timestamps.

But the good part is you have the start trigger frame timestamps and the timebases are synchronized. That means the gap between the timestamps should be constant and can be subtracted from the later one.

On a two port board the timing source is the same and the difference is only the processing time in assigning the timestamps onboard.

Hope that helps.

 

DirkW

0 Kudos
Message 6 of 6
(6,842 Views)