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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa close won't return

Hello NI community,

 

While developing my LabVIEW application I encounter the following problem:

If I call the VISA Close I occasionally have the problem that the call won't return. Below are screenshots from NI-IO Trace.

NI I_O Trace.pngVISA Close.pngVISA Read.png

As visible on the 2nd screenshot the "output" tab is missing. Also a start time is filled-in but the finish and call duration are missing (as in the 3rd image)

 

The hardware setup is a FTDI FT232RL connected via USB. From this a board based on a RS485 is connected.

The drivers of the FTDI chip are version 2.8.30.0 (latest VCP drivers on FTDI web-site and Microsoft update)

 

Edit:

As long as the VISA close won't return my program hangs so it is not possible to quit in any orderly fashion (except for a reboot)

 

Do you have any suggestions where I can start debugging this problem?

0 Kudos
Message 1 of 13
(3,226 Views)

You need to post screenshots that are readable.  Trying attaching the full size images to the message as attachments.

0 Kudos
Message 2 of 13
(3,221 Views)

I guess a stupid mistake Smiley Embarassed

 

The pictures are uploaded on full resolution and in my album here on the NI forums. The direct links:

  1. http://forums.ni.com/t5/image/serverpage/image-id/121635iE02D6364D94BA6E7/image-size/original
  2. http://forums.ni.com/t5/image/serverpage/image-id/121637iC37A9258A8E4E357/image-size/original
  3. http://forums.ni.com/t5/image/serverpage/image-id/121639i0FEEB35B53F1EF65/image-size/original

@NI moderators/administrators Is there a way that you can make the pictures clickable so that once you click on them you'll get a pop-up with the full-size image?

0 Kudos
Message 3 of 13
(3,187 Views)

Your VISA read calls return a status indicating that there might still be characters left in the transfer buffer.

Are you sure that the buffer doesnt encounter an overflow?

 

I understand that this hang does not occur every time. Correct?

What makes situations where the hang occurs "unique" (e.g. long duration of communication, large amount of command/data transfer, ...)

What happens during the hang if you unplug the USB cable?

Does VISA report a correct error if you unplug the cable during a "normal" communication?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 13
(3,179 Views)

It's correct that the Labview *thinks* that there are characters left in the buffer. I ask for 16 and I get 16. So since there is no timeout and I don't check if there are *only* 16 characters in the buffer I get this warning. (my read code)

Visa read

It is correct that the hang doesn't occur every time. It was (I'll get back to that) about every 3/4 closures. After that a reboot is required.

So there is nothing unique to it.

If I unplug the cable nothing happens (no change, the hang remains)

A unplug during normal communication I just tested and below are the results:

Error.pngNI I_O Trace 2.png

 

So all seems normal.

 

However I have to admit that there were some changes to my set-up.

Since I didn't have this problem before I decided to uninstall all virtual com port drivers and also remove their presence in the system. 

After this no hangs happened *so far*.

 

If it's useful I can do a write of my process (the only question is where?)

0 Kudos
Message 5 of 13
(3,171 Views)

"If it's useful I can do a write of my process (the only question is where?)"  Here would be as good as anywhere. These threads are most useful to others when the solution is identified and described.

 

Thanks, in advance.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 6 of 13
(3,152 Views)

Without seeing code, I would hazard a guess that the I/O isn't properly implemented.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 13
(3,136 Views)

Before reading and after writing flush the buffer. Try one more thing, Instead of using 16 byte use property node of no of byte available. use some timeout also because by default it is 10sec. hence it will be waiting although it shouldn't. Bit of strange

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 8 of 13
(3,122 Views)

See this also

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 9 of 13
(3,121 Views)

So here is my write-up of the fix I used (it worked so far).

 

Note:

!!!These actions might damage your system, may break your computer or do other unwanted stuff. You are responsible for the result (nor me nor NI)!!!

Note 2:

This will remove the drivers so make sure you have a copy of them before proceeding.

With that out the way here are the instructions for windows 7 (vista and 8 should look the same, XP might be a bit different), the OS language is Dutch but the locations of the buttons is the same:

Part of these of the instructions are from this document 

1st add the option to show all disconnected devices by opening the system Environment Variables:

right mouse button on "my computer" and select properties.

step 1.png

In the system property select "Advanced system settings"

Step 2.png

If requested accept the UAC prompt.

Select the advanced tab, Select the Environment Variables.

Step 3.png

In the Environment Variables window select the lower New button

Step 4.png

Add the variable "DevMgr_Show_NonPresent_Devices" (without quotes) and a value of 1.

Step 5.png

Ok all dialogs and open the device manager.

In the device manager select view and select "Show Hidden Devices"

Step 6.png

The list will now get extra long since all devices that where ever connected to your computer will show up.

For the next step disconnect all (USB) serial ports from your computer.

All serial ports that where connected will now show up under "Ports (COM & LPT)" and under "Universal Serial Bus Controllers"

Step 7.png

For every "USB Serial Port (COMxx)" port and "USB Serial Converter" that is semi-transparent (disconnected) do the following steps:

Right-mouse button on the port or converter and select property's

Step 8.png

The general tab should give a code 45 that the device is not connected.

Select the "Driver" tab next and select "Remove"

Step 9.png

In the confirmation dialog select the checkbox (if present) and select "OK"

Step 10.png

Once this is done for all "USB Serial Port (COMxx)" ports and "USB Serial Converter" devices you should be good.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Optional part

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Download the FTClean tool from here: http://www.ftdichip.com/Resources/Utilities/FTClean.zip

unzip and run the tool (as administrator) more information can be found here.

http://www.ftdichip.com/Support/Knowledgebase/index.html?ftcleanutility.htm

 

Download the latest VCP driver from the FTDI web-site and install it. (although windows update should take care of this)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Optional part end

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Plug-in a USB serial converter and if everything went well you should be greeted with a "found new hardware" dialog and drivers should install automatically. (or you can re-install them manually)

 

This fixed the problem for me anyway.

Message 10 of 13
(3,110 Views)