03-24-2009 10:44 AM
I am using Test Stand 4.1 for running the sequences. I am using NI 2569, 2529, 4070, 6229, 4110 PXI cards in my NI chassis 1045 and I am using my own COM server for the test stand. The COM server has the implementation for calling the driver APIs provided by NI for the different PXI cards. Now I have upgraded my driver versions of all of my PXI cards. Presently my driver versions are
NI Switch: 3.6
NI DMM: 2.7.2
NI Serial: 3.3
NI Daqmx: 8.6.1
NI Visa: 4.3
Traditional Daq: 7.4.4 (legacy).
Previously I was using the driver versions as:
NI Switch: 3.0
NI DMM: 2.5
NI Serial: 3.0
NI Daqmx: 8.0
NI Visa: 4.3
Traditional Daq: 7.4.1 (legacy).
Now the issue was when i am calling the niSwitch_Connect() function from my code, it used to connect the switches properly and returns success when I was using old driver versions. But after upgrading my driver versions now I am getting the error -1074130544 some times i.e. the niSwitch_Connect() is able to connect the switches once successfully but later on if I try to call the same function for different switches most of the switches are successfully getting closed but one switch gives the error.
Please let me know how I can proceed on this.
Solved! Go to Solution.
03-24-2009 11:00 AM
IVI Error Code: BFFA1190 (hex notation for -1074130544) is thrown when there is an invalid session to the switch device. This error occurs when a session cannot be opened to the instrument. Two things to check:
1. Verify the correct values are being used in the Initialize call to the device.
2. Verify there is only one Initialize call in your program. Only one session can be opened to your instrument at a time, so multiple Intialize VIs will produce this error.
It is interesting that the only change was the driver version. Was there any new code added?
Hope this helps!
Switch Product Support Engineer
NI - USA
03-25-2009 12:19 AM
I am initializing the 2569 PXI card using the function niSwitch_InitWithTopology(). This initialization has been done only once. This function returns the VI session which is being used later on. I am not calling the above function any time again. Everytime i try to do any operation on the switches then I use the VI session returned by the above function.
There is no change in the code related to NI Switches.
Yes it is interesting that the same code worked earlier with the old driver versions. But after updating our systems to new driver versions then I am seeing the issue of niSwitch_connect() fails in one case.
1. Initializing Switch PXI card. Get the VI session.
2. Based my requirement I am closing some switches.
3. Later I perform some operation on the switch matrix 2529 PXi and 2569 PXI. The operation would be like, I connect some rows and columns for my test case and also disconnect some channels on 2569 PXI. This is to simulate some test cases.
4. Then I revert back i.e. disconnecting the matrix changes and switch changes made in above Step 3. While doing this I am able to disconnect Matrix 2529 connections but on switch 2569 card one channel is not closing at all. I trying to closing the channels (or switches) which are opened in step 3, some thing like I open around 7 channels in step 3. Out of them I am able to close 6 channels and one channel (to name it directly the channel is 😎 does not close. It gives the error -1074130544.
Please let me know on this.
03-25-2009 10:32 AM
Is the session closed with niSwitch_close() before the last channel (channel 😎 connect command? This would result in error -1074130544. Perhaps there is a race condition between niSwitch_close() and that niSwitch_connect() call?
NI-Spy is installed with NI-Switch and should be available at Start>>Programs>>National Instruments>>NI Spy. It is an application that monitors, records, and displays National Instruments API calls made by applications. We can use NI Spy to quickly locate and analyze the NI-Switch API call error, and to verify that the communication with your instrument is correct. Can you configure NI Spy as shown in the attached picture, Start Capture, run your code, Stop Capture, Save the .spy file, and attach it to a forum post?
Let me know if you have any questions!
Switch Product Support Engineer
NI - USA
03-26-2009 07:31 AM
Thanks for the post. I guess we found the reason for the issue. As you referred I have used the NI Spy tool to capture all the APIs of NI being called from my program. I found that we are initializing the NI switch PXI card twice using the function niSwitch_InitWithTopology().
As you have already mentioned in your earlier post that if we try to open two sessions to card, this error might return.
Thing is that I am surprised to see that because I have not changed my code in this aspect i.e. I have been initializing the NI switch card twice and getting session to the card twice. This works fine with the old drivers which I mentioned in my first post to the forum, but with these new drivers it is failing.
So may be NI would have made some changes to be like this. So then I needed to change the way I implement?
I am attaching the NI Spy capture log. Please check it and let me know if what I think (regarding of opening two sessions with new driver not possible) is correct or not?
Thanks and regards
03-26-2009 09:32 AM
It is OK to open another session as many times as you want (although not a preferred way of programming for many reasons including situations like the one you've encountered)
However, the limitation is that you must always use the most recently acquired session handle. All previous session handles to the same device that were opened before will become invalid. That is what is happening in your program.
When you open another session make sure that from that point on you use that new session and not the old one. I'm not sure what program structure you have and how do you manage to use theold session, but that is something worth reviewing.
It is quite possible that the older version of the driver (if it was really OLD) ended up reusing the same session after double-open, so it would not matter to your other calls which session variable you passed to the connect calls. The last few versions of niSwitch driver give you a new session every time you open it, and hence the error you're seeing.
Hope this helps. The best course of action for you is to remove the double initialize calls, or make sure that you close the previous session if you really need to open it up again. I would recommend the former approach, since there is always a performance penalty that you incur when opening another new session...
03-27-2009 01:50 AM
Yes after using the NI Spy tool I came to know that the new driver version does not allow me to use the old VI session handle.
In my program I am initialzing the switch 2569 card twice i.e.
1. I initialize the 2569 card once when I want to program some default switch settings on the card (this is program is done in a .c file)
2. Second I reintialize the card again, but this time I do not reset the card while reinitializing i.e. while giving parameters to niswitch_initwithtopology() I say VI_FALSE for reset option and get the another session handle (this is done in another .c file).
3. So now I need to change my implementation to suit the new drivers.
May be for the point 3 I need to re implement in the format as:
for both the points 1 and 2 use a common session handle (removing second init of switch 2569 card) to avoid this kinda issue.
03-27-2009 07:50 AM
Yes, you are on a good track. There must be some main routine, some piece of code that invokes both procedures you have described. It is probably a good idea to open a session in that common piece of code, and pass it as a parameter to the two procedures in two distinct .c files, for these procedures to use.
03-31-2009 04:32 AM
Thanks for the support. I am able to run successfully on the new driver with small change in the program.