Switch Hardware and Software

cancel
Showing results for 
Search instead for 
Did you mean: 

niSwitch_InitWithTopology Error 0x80040311

We are having a problem with our NI MUX boards (2532, 2434, 2576) when niSwitch_InitWithTopology() is called multiple times from the test application.  The test system we are having trouble with is a Windows 7 application using the NI hardware (ie. not LabWindows or LabView)

The test system supports multiple configurations using the same hardware and allows the configuration to be changed from the application.  When the configuration is changed, all hardware from the previous configuration is released and the system is reinitialized with the new configuration.  The system successfully comes up on the initial configuration, and even allows the first configuration change. On the second configuration change, however, niSwitch_InitWithTopology() fails giving return code 0x80040311, “The client process has been disconnected from the configuration server”.

To eliminate the new configuration as the problem, we can force the re-initialization with the same configuration and still get the same issue – works properly on the first 2 initializations the fails on all subsequent initializations.  Stopping and restarting the application it will work again for 2 initializations.  The card status in MAX is normal and does not change during this testing.

We are using the latest NI_SWITCH 4.6.1 drivers.  Here are the calls we are making to both initialize and release the MUX cards:

When a configuration is initialized:

BOOL CMuxCard2534::Start( void )
{
.
.

   ViConstString topology = NISWITCH_TOPOLOGY_2534_1_WIRE_8X32_MATRIX;
   status = niSwitch_InitWithTopology(resourceName, topology,VI_FALSE, VI_TRUE, &m_SwitchSession);

   if (status != VI_SUCCESS)               // VI_SUCCESS=0
   {
      SetHWStatus(FAILED);
      SetHwErrorText("NI_SWITCH 2534 not loaded or NI DLL's Not Found.");
      return FALSE;
   }

   SetHWStatus(INSTALLED);
   SetHwErrorText("Running");
.
.
.
    
  return TRUE;
}

When a configuration is released:

CMuxCard2534::~CMuxCard2534( )
{
   m_DeviceName.Empty();

   niSwitch_DisconnectAll(m_SwitchSession);
   niSwitch_Disable(m_SwitchSession);
   niSwitch_close(m_SwitchSession);
   m_SwitchSession = VI_NULL;
}

We did confirm in our testing that all of the niSwitch calls in the above destructor do return successfully.

Is there anything else we should be doing to prevent the 0x80040311 return from niSwitch_InitWithTopology() after multiple initializations?

0 Kudos
Message 1 of 10
(8,613 Views)

bhamman,

 

That error code appears to be an error caused by communication issues between the application, the device and max. I attempted to replicate this with hardware and was unable to see any errors.

 

Does this happen when using the same functionality outside of the main C code? [Take switch code out and put into its C file and see if the issue occurs]

How are you connecting? (scanning or using intermediate connect functions)

Why are you calling disable? While this should not cause an issue, as far as I know this is not needed for typical applications.

Frank,
National Instruments
Software Group Manager
0 Kudos
Message 2 of 10
(8,600 Views)

Hello.

 

Was there any resolution to this issue?

 

I'm running into a similar issue with my software. While not the same, it runs perfectly fine on XP but on Windows 7 it runs into this same error.

 

Thanks!

 

 

0 Kudos
Message 3 of 10
(8,403 Views)

Hello,

Just to keep continuity, here is the link to your particular issue that give the same error, but for an M Series card.

http://208.74.204.114/t5/Multifunction-DAQ/Seemingly-Random-Error-with-DAQMx-C-NI-6251-PCIe/td-p/251...

 

0 Kudos
Message 4 of 10
(8,390 Views)

James,

 

I am not aware of a resolution to the issue as the customer stopped responding however, it sounds to me like there is a max communication issue. Whether this is caused by an unstarted service or some other error I am unsure without more info from the original customer.

Frank,
National Instruments
Software Group Manager
0 Kudos
Message 5 of 10
(8,384 Views)

Hi Frank,

 

I was involved with the initial question posted by Bill Hammon, and this problem is not resolved.  One of the things that was not mentioned in the initial post was that this problem was found on a Window 7 test system.  At the time this was our only Windows 7 system (rest were XP) so this wasn't a show stopper.  Now that we are converting the rest of our test stations to Windows 7 we are anxious to get this thread moving again.

 

I did check out the thread referenced by EricE above, "Seemingly-Random-Error-with-DAQMx" but It doesn't look like there was a resolution, and I'm not sure if it is the same problem.  In the referenced thread the disconnection from the configuration server occurred randomly.  I can reproduce our problem every time by changing our system configuration as described in the initial post ... so it should be easy to debug!

 

The initial post specified the problem as being with the niSwitch API using the InitWithTopology() function for our MUX cards.  As you stated above, the issue is with the test application losing connection with the NI configuration server and is not specific to any of the APIs or cards.  It affects all of our NI cards and we get the same return code (0x80040311) from DAQmx using the GetSysDevNames() function call.

 

In the last few days I have done some more analysis of our code when we reconfigure the system.  I did find some potential problems in the destruction of the old configuration where we could be accessing a switch session or task that had already been closed (also removed the niSwitch_Disable as suggested in your first reply).  Even with these issues resolved the problem still occurs.

 

Our test application does not explicitly connect to the configuration server.  Is there a way that I CAN explicitly force the connection to the configuration server (or reset the existing connection) to ensure that it is available when I come up on a new configuration?

 

One more note ... we are developing our test application using VC++ under Microsoft Visual Studio 2010.  I noticed in your release notes for DAQmx that you only specifically support through Microsoft Visual Studio 2008.  Are there known issues between 2008 and 2010 that could lead to the loss of connection to the configuration server?

 

Brian

ACSS

 

0 Kudos
Message 6 of 10
(8,119 Views)

Hi Brian,

 

I'm not entirely familiar with connecting to the NI Configuration server, but I wanted to know what your services look like when you the error occurs. Are the NI device loader and NI configuration manager services running when you get this error? 

Gabriel M.
Product Marketing Engineer - Academic Courseware
National Instruments
0 Kudos
Message 7 of 10
(8,065 Views)

The following processes are running (from task manager)

 

nipxism.exe                           SYSTEM              NI PXI Service Manager

nimsx.exe                              SYSTEM              MXS Service

nimdnsResponder.exe            SYSTEM              National Instruments Zeroconf Service

niLxiDiscovery.exe                 SYSTEM              National Instruments LXI Discovery Service

nierserver.exe                        bjohnson              NI Error Reporting Server

nidmsrv.exe                           SYSTEM              nidmsrv

niDiscSvc.exe                        SYSTEM              National Instruments Network Discovery Service

nidevmon.exe                        bjohnson              NI-DAQ Device Monitor

nidevIdu                                SYSTEM              NI Measurements Device Loader SCM Plug-In

 

Doesn't seem to be any changes to these services before or after our reconfiguration.

 

- Brian

0 Kudos
Message 8 of 10
(7,969 Views)

OK.  This problem is back on the top of my queue and I have spent several more days trying to resolve it again.  Despite the fact that this goes in and out of our priorties - it is a real problem and we need a fix.

 

In my last round of debugging I found that we may have been focusing in the past on the wrong error code.  I found that on the first NI DAQ call we make following the second re-initialization, DAQmxGetSysDevNames(), the return code is 0xfff3b1f or -50401 "An unknown or unexpected communication fault occurred while attempting to read data from or write data to a device".  After that initial error, every other DAQ call then returns 0x80040311.

 

To recap some of the problem description from above - when we initially start our test system and specify a configuration everything works fine. We can then change the configuration and re-initialize to the new configuration (the first time) with no problem.  The re-initialization releases all cards, channels, sessions, tasks, etc. and then adds everything back for the new configuration.  If I then try to re-initialize to a new configuration again, all of the DAQ calls fail - apparently due to a communications problem.  This is not a random error, I can reproduce it every time.

 

It seems like something is not being released, and by the 2nd re-init we are out of resources.  I went back and double checked that we are releasing everything we are allocating from our side.  I also went back and added a call to DAQmxResetDevice as the last thing we do when we are cleaning up the card.

 

I found another forum thread that seemed similar and their work-around was to free the NI libraries after shutting everything down.  I added code to do this on our re-init (ie free the libraries after taking the configuration down and load them again before bringing up the new configuration) and it had no effect.

 

I'm out of things to try.  Any help will be appreciated!

 

Brian

ACSS

0 Kudos
Message 9 of 10
(7,276 Views)

Hello, Brian!

 

Thanks for the good information. I sent you a private message with a special tool that will give us more details on the root of the error - please take a look and we can move forward from there.

Will Hilzinger | Switch Product Support Engineer | National Instruments
0 Kudos
Message 10 of 10
(7,253 Views)