From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run slef test from within CVI?

Hello to all,
 
I am developing an application under CVI using a PCI-CAN card... I remark that sometimes I cannot reconnect to my card (usually after break my software or after some bad manipulations)... The only wait to reconnect is to run the Self-Test from the Measure and automation explorer... Is their a way to actually run a self-test from my application? I believe this will be very helpful...
 
Thank you for your time
Malo
0 Kudos
Message 1 of 5
(3,704 Views)
There is no way to do this programatically through CVI. If you completely close CVI then get back into your project, you should then be able to use your CAN device. As far as a way to do this programatically, there's no way to do so yet.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 2 of 5
(3,690 Views)
just a thought, but have you tried running NI-spy in the background and doing a self-test?  I get 18 calls, i'm sure your reset can be pared down from that list to find the calls needed to get the same response...
0 Kudos
Message 3 of 5
(3,686 Views)
Hi Robert,

NI-Spy is a good idea, however in this case it might not work completely. When the self-test is performed trough MAX, it is checked whether any application (CVI, LabVIEW, etc.) still has open handles/references/tasks to the CAN card. If that is the case, the self-test cannot be performed, as it could potentially reset the card configuration while an application is still running.
You might have noticed that the self-test sometimes returns
“Cannot test the device as it is still in use….”
That message comes up when an application is actively using the CAN card, or even if there are just some references not closed. When the ADE (LabVIEW, CVI, etc.) is closed a cleanup of all open connection is performed and with that any pending/lost references are closed.

The reset that the self-test performs, requires that no ADE is active as otherwise the NI-CAN driver can’t close all references. It might work sometimes, but most times you just need to close the application

-B2k
0 Kudos
Message 4 of 5
(3,682 Views)
Thank you all...
 
Restarting the application does not fix my problem, I soon as I break the communication, even MAX can not do a simple Who...
I had check with the NI-Spy and I came to the same conclusion that all handles must be freed before doing so...
Right now, as a quick and dirty solution, I reset the board every time my application start (ncReset) as I am sure (in my case) that this is suppose to be the only software accessing the board... I sure whish this handles had a lease or something to avoid that kind of manipulation...
 
Thank you again for all the answers...
0 Kudos
Message 5 of 5
(3,680 Views)