I have a simple vi (attached) that reads from a serial port (actually, a USB to serial converter) in a timed loop (in case you wonder why the vi is written the way it is, the instrument I'm trying to read sends status messages every 20 ms, but I only care to read one every 2 econds or so, so I can safely discard the others).
The vi starts fine, but after a randmom number of reads (can be tens, hundreds or thousands) it freezes, and neither the "stop" button programmed into the vi or the "abort" button can terminate it. However, LabView is still responsive at this point, and I can close the VI, which results in a message "resetting VI: [vi name]" being displayied by LV indefinitely. The only alternative is to force close LV using TaskManager. Unfortunately, when I subsequently try to acess the VISA resource using either LV or NI MAX, I get an error message:
Error opening resource:
ASRL3::INSTR
VISA: (Hex 0xBFFF0072) The resource is valid, but VISA cannot currently access it.
The only way of accessing the resource again is to completely reboot the system (even disconnecting and reconnecting the USB adapter seems to have no effect).
I found a number of similar posts in the forums, but none contained a solution. I tried to implement a few suggestions found there (like disabling power management on the USB controller and inserting a delay between subsequent read operations) without success (although since I inserted the delay the problem seems to appear after a longer time).
I also captured a trace of the VISA communication, that I'm attaching. You can see at line 138 that the read operation did not return. This is the point where the vi freezes. The subsequent messages are a result of me closing the vi, force closing LV and then trying to access the resource again.
Any idea?
Thanks
Giacomo