Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Execution of a CVI application using NI CAN is ~6 seconds faster if NI MAX is opened as well

Hi,
I am currently developing a CVI (7.0) application to download some software to a module via a Series 2 CAN card (NI CAN Driver 2.2f) and have noticed the following.
 
When running under the CVI debugger the CAN interface will sometimes respond with the error code -1074388991 receive timeout when I try to communicate with the module after the download process. In all cases the first of two CAN frames is received and the second is lost.  If I start / open NI MAX and run the application, the error disappears. Increasing the timeout period does not cure the issue.
 
Furthermore if I compile the release executable and run it, the execution time is ~6 Seconds faster if NI MAX is open. When NI MAX is closed the execution time reverts to the original (longer) time. (This appears to be repeatable.) 
 
The above error does not occur when running the release executable.
 
Does anyone know why NI MAX appears to have this affect on the CAN Interface ?
 
Aid
0 Kudos
Message 1 of 9
(4,818 Views)

Hi Aid,

That sounds interesting. what else are you doing in your Application? Any other hardware calls?

DirkW

0 Kudos
Message 2 of 9
(4,766 Views)
Hi,
 
The CAN error code -1074388991 description is as follows: The timeout of a wait or notification function expired before any desired state occured. Solutions: Increase value of Timeout parameter; Verify your cable connections and operations of remote devices. But you have already had a go at increasing the timeout parameter and that didn't work.
 
If you have NI-CAN 1.5, then you can use the Bus Monitor by configuring it up to CAN0 and hooking up a device to see if any frames are being read. The Bus Monitor logs all traffic on the bus. If you can communicate using the Bus Monitor, then your cables are set up properly. Make sure you close the Bus Monitor before running your program.
 
The follwoing discussion forum may offer some helpful advise:
 
 
Kind Regards,
Kurt
 
 
0 Kudos
Message 3 of 9
(4,676 Views)

I'm also seeing speed differences.

When executing my CVI can appl when NI-max is opended it is faster.

Also when I open the CAN bus monitor it is faster.

 

NI-CAN15

NI-XNET16.1

CVI RTE2015 SP1

0 Kudos
Message 4 of 9
(3,529 Views)

too bad we didn't get any info on the differnce in speed for CAN XNET execution related to opening/closing NI-Max.

This doesn't seem to be the case in WIN10. Now it is always slow.. even slower than before..

0 Kudos
Message 5 of 9
(2,349 Views)

Hmm, maybe it could have something to do with the Windows timer resolution setting? It could be that other applications running in parallel (MAX, LV Runtime in case of XNET Bus Monitor) might increase this timer frequency.

You can find documentation on the web on this topic on how to monitor or even set this using external tools or code in your application.

Message 6 of 9
(2,346 Views)

@kayfh, Setting the Windows Timer resolution to 0.5 in Win7 does not give me the same execution speed as when NI Max is opened. 

 

Applying the same settings in Win10 increases execution speed, but still 1sec slower for sending 1000 bytes compared to Win7 with Max open. <damn..>

0 Kudos
Message 7 of 9
(2,342 Views)

Nice!

You could also try to change the power config if the system is not in High Performance mode.

I think with Win10 there were some changes to the Windows timers changing their performance characteristics (dynamic tick etc.).

I think there are some options you could try out using the bcdedit tool, but I don't know if they will make a difference here.

Message 8 of 9
(2,336 Views)

@kayfh, changing the settings with bcdedit made the Win10 pc 2x as fast as the Win7 pc before.

tscsyncpolicy Legacy
useplatformclock Yes
disabledynamictick No

 

We have our self-made XCP driver that is sending directly can-frames over XNET.

Sending 1000 frames (500kbs):

Win7 64bit = 2sec

Win10 64bit = 950ms

 

So, low-level it certainly is possible to tweak Win10 to behave fast.

(thanks for your help)

 

Unfortunatly, we also use the Ecu Meas and Calibration toolkit.

mcMeasurementWrite (1000 times)

Win7 64bit = 2sec

Win10 64bit = 4sec

 

So, there is something in the toolkit?

0 Kudos
Message 9 of 9
(2,307 Views)