Switch Hardware and Software

cancel
Showing results for 
Search instead for 
Did you mean: 

niSwitch_Init error

Solved!
Go to solution
Yes that is the resource descriptors that I use.
0 Kudos
Message 11 of 20
(5,504 Views)

Hey Guy,

 

Can you post the code you're experiencing these issues with?  Thanks!

-John Sullivan
Problem Solver
0 Kudos
Message 12 of 20
(5,501 Views)

#include <iostream> using namespace std; #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <visa.h> #include "niswitch.h" void main() { ViStatus vifxn_stat; ViSession rly_s = VI_NULL; ViRsrc rly_rsrc="rly2567"; vifxn_stat = VI_SUCCESS; vifxn_stat = niSwitch_init(rly_rsrc,VI_TRUE,VI_TRUE,&rly_s); cout << "niSwitch return status = " << hex << vifxn_stat << endl; return; }

0 Kudos
Message 13 of 20
(5,496 Views)

Hey Guy,

 

Apologies you're having trouble getting this system up and running.  What you have should work, but let's try running the following code (which uses a different device syntax):

 

 

#include <iostream> using namespace std; #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <visa.h> #include "niswitch.h" void main() { ViStatus vifxn_stat; ViSession rly_s = VI_NULL; ViRsrc rly_rsrc="rly2567"; vifxn_stat = VI_SUCCESS; vifxn_stat = niSwitch_init(PXI1::4,VI_TRUE,VI_TRUE,&rly_s); cout << "niSwitch return status = " << hex << vifxn_stat << endl; return; }

 

If this doesn't work, let's shut down the chassis, remove and swap the cards and then reboot.  Placing the cards in a new slot will force the driver to reload the modules.  If, for some reason, the modules were not properly loaded before, this would resolve that issue.

 

Let us know what you find.

 

 

 

-John Sullivan
Problem Solver
0 Kudos
Message 14 of 20
(5,457 Views)

Guy,

can you also please throw in a call to niSwitch_GetError() in there? You can pass VI_NULL for the session, as it is Init function that failed and there is no session? You can cout<< the returned buffer. Please allocate char buf[1024]; and call niSwitch_GetError(0, &vifxn_stat, 1024, buf);

 

You'll also need to put quotes around the "PXI1::4" but you've figured that one out I'm sure. 

 

Another thing to try: running NI Spy while trying your program. It may offer additional information about the error.

 

0 Kudos
Message 15 of 20
(5,449 Views)

So I have two PXI Switch cards (PXI-2567 named to "rly2567" and PXI-2568 named to "scan2568"), so I took out 2567 from slot 4 and placed it into a slot 6.  I first tried the "PXI1Slot6", the default name, and I got no errors.  (return status of 0)  I then renamed it to "rly2567" and it returned no errors.  Which suggested John S. theory of modules not properly loaded might be correct. 

 

So I took out the the other PXI card (2568) from slot 3 and placed it in slot 4 (slot 4 was where 2567 was originally).  For the 2568, the default name "PXI1Slot4" worked but I got an error when I changed the name to "scan2568".  So I took out 2567 from slot 6 and placed 2568 in slot 6 and placed 2567 in slot 3.  As usual the defualt name, "PXI1Slot6", worked but the name "scan2568" did not work.  So then I realized that the only time cards seem to not work is when I use the names "scan2568" or "rly2567".  Except for the 2567 card when I place it in any other slot other than slot 4 this name seems to work.  So I'm not sure why this might be.

 

If I use a different name then both cards work in any slot.  I understand the solution seems to be to simply use a different name but, I would like to know why this is?  Is there something in MAX that needs to be done to completely remove these names from the system?

 

Srdan...since I have not tried using the niSwitch_GetError function nor did I try NI SPY yet.  If you feel these are still necessary and may help answer my above question I can try them out to see if I get additional information.

0 Kudos
Message 16 of 20
(5,426 Views)

Guy,

those (NI Spy and/or niSwitch_GetError function) traditionally give you better error description including elaboration that may give you and us more info about the problems you're encountering and may shorten the support time.

 

Now, for the specific names causing trouble, it may be caused by other ways to access the driver. One is VISA aliases. If you have created a VISA alias for something with the name you use, that may cause the trouble you have. Another place where you may get diverted is IVI configuration. If you have created a logical name with the same name, that too will take precedence over DAQmx name.

 

Both of these configurations can be found in max.

 

let us know if you've found something! 

 

 

 

Message 17 of 20
(5,422 Views)
Here is the error generated by using niSwitch_Init when using the name rly2567:
 

"Identification query failed.

Common errors when initializing a session: Mismatch between the device and topol
ogy; Resource descriptor is a device that is not a switch; Chassis not powered on"

 
I have also attached the SPY capture file.

 
There are no logical names defined.  I don't know if there are any VISA aliases defined.  How do I check this?
Message Edited by Guy04 on 03-09-2010 05:42 PM
0 Kudos
Message 18 of 20
(5,408 Views)
Solution
Accepted by topic author Guy04

Did you enable logging to file when using niSpy or did you just save your log to file with Save As... If you enable logging in Spy options, we are able to get more information here at NI. Also choose niSwitch and NI_VISA as APIs you want to spy on.

 

TO get VISA Aliases, in MAX, go to Tools>>NI-VISA>>VISA Options, and then in the right-side pane select General settings>>Aliases. Check the list to see if there are any rly2567 names or such. Delete any if there are. 

Message 19 of 20
(5,396 Views)
The VISA aliases did actually exist.  I removed the VISA alias names and now it is working correctly without returning any errors.  Thanks.
0 Kudos
Message 20 of 20
(5,384 Views)