04-07-2025 02:21 PM
> Not to go off topic, but using the python daqmx library, I have no issue communicating with the PXIe-6341 DAQ in slot 2 of the PXI mainframe PXIe-1084, over the Thunderbolt interface PXIe-1084.
This is helpful. It means that your CPython can load other libraries just fine and call into them. So there's something specific to NI-DCPower. Unfortunately the error code coming back from the driver is fairly generic and thus may originate from and number of places or reasons.
The nidcpower Python library is fairly straighforward Python code. Would you be willing to try to step into it to see exactly which call to library.py returns 0xBFFA0000, and inspect to see that the arguments to it look ok?
04-07-2025 02:35 PM - edited 04-07-2025 02:55 PM
Ill give that a try.
Using VScode, so modify the json file to allow debugging outside my code.
04-07-2025 03:52 PM - edited 04-07-2025 04:22 PM
04-07-2025 04:10 PM
Is error_code being set to -1074135040?
If yes, do any of the arguments look suspicious to you? The signature of that function is:
ViStatus _VI_FUNC niDCPower_InitializeWithIndependentChannels(
ViRsrc resourceName,
ViBoolean reset,
ViConstString optionString,
ViSession *vi);
ViRsrc is a char*
ViBoolean is int16_t
ViConstString is const char*
ViSession is int32_t and should not be None.
I don't know why any of this would be a problem... this is widely deployed and well tested code. But you never know.
04-08-2025 07:08 AM - edited 04-08-2025 07:30 AM
So I ran my C# code, and do see the visession being set to a non zero value.
The code uses an alias "SMU2" for "PXI1slot<n>"
I do see that the C# code is pointing to a different NIDCPower DLL:
Assembly NationalInstruments.ModularInstruments.NIDCPower.Fx45
C:\Program Files (x86)\IVI Foundation\IVI\Microsoft.NET\Framework32\v4.5.50709\NationalInstruments.ModularInstruments.NIDCPower 21.5.0\NationalInstruments.ModularInstruments.NIDCPower.Fx45.dll
And this doesnt look right in the python code for the location it is setting up for the DLL: nidcpower_64.dll
which is sitting in this directory: C:\Program Files\IVI Foundation\IVI\Bin
04-08-2025 08:33 AM
> So I ran my C# code, and do see the visession being set to a non zero value.
This is another data point confirming that your NI-DCPower installation and hardware is fine. That's good.
The ViSession value is the return value of the initialize call, it is changed when the function executes correctly.
> The code uses an alias "SMU2" for "PXI1slot<n>"
What happens if you use "SMU2/0" as the resource_name in your Python code? In other words, try to replicate your functional C# initialize call as closely as possible.
> I do see that the C# code is pointing to a different NIDCPower DLL
That is the .NET assembly. Under the hood, the same nidcpower_64.dll is loaded and called into. You can confirm this by using something like Process Explorer.
04-08-2025 09:18 AM
Interesting.
The Python code is using the 64 bit version DLL and my C# code is using the 32 bit version DLL.
Python:
C# code:
04-08-2025 09:40 AM
We install both 32 and 64-bit versions of the user-mode libraries for NI-DCPower (and most other NI drivers).
The process may be 32-bit or 64-bit and must load the appropriate DLL.
Given this, I think we rule out an installation problem in which 64-bit driver fails to load 😞
04-08-2025 09:48 AM - edited 04-08-2025 09:48 AM
InstrumentStudio is working using the 64 bit version...
04-08-2025 09:59 AM
Just a clarification, the 64 bit python example is still failing.
Thankyou for all the debug steps. Very enlightening.