From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown system error (VISA error code 1073807360) From .NET Library

Hello,

 

I am running into a  very difficult issue using the VisaNS library in C# .NET. I have created a class called FactoryInterface with the following constructor:

 

 

public class FactoryInterface : ICommonControl
    {
        protected MessageBasedSession _mbSession;

        public FactoryInterface(string com_port)
        {
            SerialSession ss;

            _mbSession = new SerialSession("COM14");
            ss = (SerialSession)_mbSession;

            ss.BaudRate = 57600;
            ss.DataBits = 8;
            ss.StopBits = StopBitType.One;
            ss.Parity = Parity.None;
            ss.Timeout = 1000;
            ss.TerminationCharacter = 0x0d;
        }
}

I then create an object of Factory interface and call the following function, SendCommand with the parameters "get netconfig\r" and false:

 

 

public void SendCommand(string cmd, bool getError)
{ _mbSession.Write(cmd + "\r"); }

Which returns the following exception:

Unknown system error (miscellaneous error).  VISA error code -1073807360 (0xBFFF0000), ErrorSystemError

In order to test the device I open VISA Test Panel. I configure the device with the same parameters as above and send the same string. The write completes without error.

 

When I capture both communications using NI I/O Trace, I see the following descriptions for the successful and unsuccessful communications, respectively:

2.  viWrite (ASRL14::INSTR (0x00C7DA10), "get netconfig.", 14 (0xE), 14 (0xE))
Process ID: 0x00005530         Thread ID: 0x000052C0
Start Time: 10:11:58.1070      Call Duration 00:00:00.0002
Status: 0 (VI_SUCCESS)
> 27.  viWrite (ASRL14::INSTR (0x00000001), "get netconfig.", 14 (0xE), 0 (0x0))
> Process ID: 0x00005404         Thread ID: 0x0000569C
> Start Time: 10:12:32.8867      Call Duration 00:00:00.0000
> Status: 0xBFFF0000 (VI_ERROR_SYSTEM_ERROR)

 

Any insight or lines of investigation would be greatly appreciated.

Thank you for your time.

 

 

0 Kudos
Message 1 of 6
(3,261 Views)

_mbSession  is protected variable in the class FactoryInterface

 

Is SendCommand a member of the FactoryInterface class? I can't tell with the code snippet.

0 Kudos
Message 2 of 6
(3,185 Views)

Yes, SendCommand is a member of FactoryInterface.

0 Kudos
Message 3 of 6
(3,180 Views)

This is not the only com port device which I am connecting to through the VISA library. I have notice that my failure disappears when I do not connect to my Korad power supply, and the failure returns when I am connected to the power supply.

 

I should say that not connecting to the power supply is not an acceptable workaround. I need to be able to connect to both the power supply and the factory interface at the same time.

0 Kudos
Message 4 of 6
(3,179 Views)

I am not sure how having another instrument is relevant.

Only one instrument can be connected to one serial port.

0 Kudos
Message 5 of 6
(3,170 Views)

I narrowed down the relationship to the power supply. In a setup routine, a FactoryInterface object is created. Then, the power supply is used to power cycle the device which is connected through the FactoryInterface  object. After the device is powered up, I send it a command. This communication is where the error occurs. The error does not occur if no power cycle is done.

So my follow up question is: how does power cycling a device which has a live serial connection disrupt the serial connection? Do I have to "close" the connection before powering off the device, then "open" the connection after it is powered up? This is the experiment I will try next.

0 Kudos
Message 6 of 6
(3,162 Views)