Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI VISA using USB gives a Parsing error

Solved!
Go to solution

Hi All,

 

I am trying to initialize Pacific Power AC Source using NI VISA, communication is TCP using USB to computer, if USB is disturbed Then I loose connection with Power Supply, I create a new session every time during initialization

 

Session session = (MessageBasedSession)resourceManager.Open(resourceName);
// session.Add(resourceName, (MessageBasedSession)session);

return (MessageBasedSession)session;

 

But I end up getting Parsing error as below -

RiddhiShah717_0-1679944896429.png

 

Please can someone suggest a idea or thoughts to resolve.

 

Thanks.

 

0 Kudos
Message 1 of 10
(2,581 Views)

Hello.

 

> communication is TCP using USB to computer

 

The address starting with "TCPIP" is the VISA address when connecting via LAN.
If it's USB, it starts with the string "USB".
See link below.

https://www.ni.com/docs/ja-JP/bundle/ni-visa/page/ni-visa/visaresourcesyntaxandexamples.html

0 Kudos
Message 2 of 10
(2,546 Views)

I use Virtual LAN but USB 2.0 A to B Cable.

 

I have had no problem in initializing, also as shown when connected to web page of device, Address string is embedded, can't change.

RiddhiShah717_0-1680038565447.png

Problem occurs when usb is interrupted, want to make application robust. Any suggestion.

 

Also, I have checked using USB as a string in place of TCPIP but I get same error.

 

Thanks,

Riddhi

0 Kudos
Message 3 of 10
(2,518 Views)

Try changing the host name in your VISA address to your IP address.

"TCPIP::x.x.x.x::inst0::INSTR" or "TCPIP::x.x.x.x::INSTR"

0 Kudos
Message 4 of 10
(2,505 Views)

@RiddhiShah717 wrote:

Problem occurs when usb is interrupted, want to make application robust. Any suggestion.


I just avoid USB as much as possible.  If available, use direct LAN.  But if you must use USB, go into the Windows Device Manager and into the properties for every USB hub and disable the option for Windows to "save energy" by randomly turning off the USB hub.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 10
(2,477 Views)

Yes, I had tried using TCPIP0::X.X.X.X::inst0::INSTR, but I get same error when interrupted, Does this string should end in "\r" or "\n"? Any other suggestions?

 

Thanks

0 Kudos
Message 6 of 10
(2,402 Views)

Verified in Device Manger, USB that I use don't see any option for disabling to "save energy" but also what does this option would do for me, I would like to enable once interrupted. Problem exists.

0 Kudos
Message 7 of 10
(2,465 Views)

@RiddhiShah717 wrote:

Verified in Device Manger, USB that I use don't see any option for disabling to "save energy" but also what does this option would do for me, I would like to enable once interrupted. Problem exists.


Disabling the option prevents the USB connection from being reset.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(2,458 Views)

I don't see that option to disable in properties. Anything else, you could suggest any other idea would be great. As I am still stuck with the same issue.

0 Kudos
Message 9 of 10
(2,423 Views)
Solution
Accepted by topic author RiddhiShah717

The problem was solved, it was the Firmware of the Power Source it self, Major firmware was updated that resolved the issue for disconnecting of USB, and a *RST command increased it's delay time during opening of session, that helped when initializing to reset hardware from 4sec to 5sec, minimum requirement is 4 sec.

 

Thanks for responses.

Message 10 of 10
(2,391 Views)