Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I eliminate delays in transmitting buffered CAN data?

My application using the PCI-CAN Series 2 card is programming automotive modules in a time-critical environment using a MSVC++ application running on Win2000. We need to send about 1.4 Mb of data to the module as quickly as possible, preferably less than 70 seconds. We are communicating with the modules at 500 Kbaud using standard frames (not extended).
Looking at the CAN bus on a scope, we see that the frames themsevles are about 240 microseconds wide, but after each frame of data, there is roughly 300 microseconds of delay.
In my C++ implementation, I have created a transmit object with a transmit queue size of 225 frames. The transmit object is configured to transmit "by call" and the period att
ribute has been set to 0. Using this configuration, I would assume that data would be sent as fast as possible. I am certain that the transmit queue is being filled faster than it can send the data out. What is producing the delays between frames, and how do I eliminate them?
(Attached file contains transmit object configuration and frame writing routine.)
0 Kudos
Message 1 of 3
(3,344 Views)
Hey Glenn,

If all you want to do is transmit as fast as possible, I would recommend using the network interface object rather than a CAN object. This will reduce the overhead and should improve your performance. Use a large transmit queue length on the network interface object, and try to keep the queue full. This should maximize the output of the CAN card. Other things to be aware of: what is your total bus utilization? If other devices are transmitting on the bus and the CAN card is losing arbitration, you could see a big performance hit. Also, make sure you are using the latest NI-CAN driver (2.2). There have been performance increases over older drivers (1.6 and previous specifically).

NI-CAN v2.2: http://digital.ni.com/softlib.nsf/websearch/C
98C33F3DB0459BE86256EBD004B6ED0?opendocument&node=132070_US

Hope this helps.

Scott B.
Applications Engineer
National Instruments
Message 2 of 3
(3,343 Views)
Your suggestions were right on target. I changed the transmit code to use a network interface object instead of a CAN object and saw noticeable improvement in throughput. Also, I upgraded to version 2.2 and saw even more improvement. Thanks!
0 Kudos
Message 3 of 3
(3,344 Views)