Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-VISA has a bug in configuration retrieval for serial port baud rate

Solved!
Go to solution

Steps to duplicate:

1. Use NI-Max to configure serial port with Name(alias) and Baud rate = 115200.

2. Verify values are saved to "C:\ProgramData\National Instruments\NIvisa\visaconf.ini"

3. Failure #1 - Use Open VISA Test Panel to communicate with instrument.  Port settings do not reflect Baud rate = 115200.

4. Open instrument with pyVISA using NI-VISA backend.  pyVISA properly see alias set in NI-Max but baud rate = 9600 (default)

    pyVISA Serial port setting work with Keysight and R&S VISA backends and associated configuration utilities.

5. Somewhat annoying that VI_ATTR_RSRC_IMPL_VERSION = 0x1600500 (is this correct or should it be 0x2200500NI-MaxNI-MaxpyVISApyVISA?)

 

Additional info:

C:\WINDOWS\system32\nivisa64.dll
Comments: 2022/07/01 17:45:56, nivisa64/win64U/x64/msvc-14.0/release
InternalName: NIVISA_CORE 22.5.0f60
ProductName: NIVISA_CORE
CompanyName: National Instruments Corporation
LegalCopyright: Copyright © 2000-2022 National Instruments Corporation. All Rights Reserved.
ProductVersion: 22.5.0f60
FileDescription: NI-VISA Library
LegalTrademarks: None
PrivateBuild: None
FileVersion: 22.5.0f60
OriginalFilename: nivisa64.dll
SpecialBuild: NI-Spy

0 Kudos
Message 1 of 4
(1,160 Views)

Default Port configuration settings are set using Windows Device Manager.  The MAX database does not override that setting because there is no cross platform means to override OS specific settings that are stored in HKEYs on Windows.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(1,101 Views)

I am not talking about the Windows "default" port settings.  I am talking about the VISA instrument configuration settings.  Once the serial port settings for the instrument are configured in NI-MAX I would expect these setting to be propagated to any application accessing the NI-VISA DLL.  This is the way that Keysight and R&S VISA configurations work.

 

If this was not the intended behavior, why are the serial port settings stored in the NI-VISA ini file?

0 Kudos
Message 3 of 4
(1,096 Views)
Solution
Accepted by dhaas

This is not a bug even though NI-VISA serial setting work different from Keysight and R&S VISA. This NI-VISA behavior is more consistent with the VISA library spec VPP-4.3 rev. 7.2.

 

NI-VISA Serial help indicates: 

If you have configured the settings to a different value in the NI-VISA configuration utility (MAX on Windows, visaconf on UNIX), then you must pass the value VI_LOAD_CONFIG (4) as the AccessMode parameter to viOpen(). This parameter will cause the configured settings to be used; otherwise, if the AccessMode is 0 or VI_NULL, the default settings will be used.

 

Tested on pyVISA with:

instr = rm.open_resource(key, access_mode=constants.VI_LOAD_CONFIG)
NI-VISA configured setting are passed to the serial instrument when it is opened this way.

 

Message 4 of 4
(1,090 Views)