Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay on CAN virtual channels

I have two VIs, a "main" program and a "receiver" program that responds to CAN messages from the main program.

 

I am using Virtual CAN channels (256 and 257) for testing purposes.

 

I have noticed a lengthy delay between when the main program writes a message (and arbitration is successful), and the receiver program finds the message in the read queue. It seems to be consistently about 400-500 ms, even though both programs run a 10 ms loop time.

 

 

Here is a log from NI I/O Trace. 

 

nitracecan.jpg

 

This is the sequence of events:

 

line 160: Main program writes message

line 161: Arbitration successful for the written message

line 161-199: Receiver program checks read queue for messages - none found

line 200: Receiver program finds message in read queue

line 204: Receiver reads message

 

There is about 400 ms from when arbitration is successful to when the message is read. Is there a built-in delay for virtual CAN channels, and if so, is it configurable? Or is there something else going on that I don't understand?

 

Thanks

 

0 Kudos
Message 1 of 3
(5,314 Views)

you may check the NICAN manual chapter 6 regarding the Virtual Bus Timing.

 

I assume you should disable the timing by using ncSetAttr / Virtual Bus Timing =  FALSE


The Virtual Bus Timing sets the Virtual Bus Timing of the virtual device.

 

By turning Virtual Bus Timing off, the CAN bus simulation is disabled and CAN frames are copied from the write queue of one virtual interface to the read
queue of the second virtual interface. This setting is useful if you desire to only convert frames to channels or vice versa and not simulate actual CAN bus communication.

0 Kudos
Message 2 of 3
(5,306 Views)

Thanks for the reply. I did try this option, and there is some improvement, but there is still about 50 ms between when the message is written by the main program and when the receiver program finds a new message available to read.

0 Kudos
Message 3 of 3
(5,292 Views)