Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring time between CAN0 output and CAN1 input

I am still learning the ropes of the PXI-8464 dual port card.  I have a DUT that will receive a CAN message from interface CAN0.  I need to monitor the bus using CAN1 and verify that I receive a response from the DUT within 10ms.  I am working in a C++ environment.

 

Currently this is my process:

- Use nctCreateMessage to setup both CAN0 and CAN1

- Start both interfaces

- Use nctWrite to transmit data to the DUT

- ?   ( this is where I am stuck )

 

I could use some help in understanding how to verify that I receive a response within 10 ms, specifically what commands to use.

 

Thanks in advance,

Mike

 

 

0 Kudos
Message 1 of 7
(7,612 Views)

See the examples that ship with the NI-CAN driver. It has a "Transmit Receive same port" example that transmits and receives on the same port.

if you need a second port, just initialize another one and use this handle for the receive process.

 

DirkW

0 Kudos
Message 2 of 7
(7,607 Views)
What I still dont understand is the mechanism by which I can measure the time between a send and receive, either on one port or 2. 
0 Kudos
Message 3 of 7
(7,590 Views)

Hello,

 

We have a few options to measure time.  If you use the example you can start a timer after the CAN send and stop it once the read was successful.  This discussion forum (http://forums.ni.com/ni/board/message?board.id=170&message.id=263702&requireLogin=False) describes three ways to use a timer.

Caleb W

National Instruments

0 Kudos
Message 4 of 7
(7,582 Views)

Mike,

 

You can enable the selfe reception feature and receive all your transmitted messages. Now that you have both the transmitted message and the received message, you could compare the timestamps.

You have to use the set attribute with self rception enable before you start communication.

Hope that helps.

 

Dirk W

0 Kudos
Message 5 of 7
(7,565 Views)
Thanks for the help everyone, the self-reception + timestamp comparison method is exactly what I needed.  Now, in looking at the spec of the CAN chip on the card, the receive buffer is 64 bytes.  If I am looking for a single message on a busy bus, then what I need to do is enable "filtering", otherwise the receive buffer would fill up with non-relevant data... that sound about right?
0 Kudos
Message 6 of 7
(7,559 Views)

Yes, that sounds right. Here is an example for a single filter.

 

DirkW

0 Kudos
Message 7 of 7
(7,549 Views)