LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Clear operations to Arduino occasionally crash NI VISA Server on OS X

(This is a continuation of a discussion I had with NI Application Engineers over email and they recommending posting it here. It's support request #7426805 for any NI folks reading this)

The setup I have is an Arduino Uno running the LIFA firmware (I can't easily use LINX because I need servo support), connected via USB to a Mac Mini running OS X 10.9.5 and NI-VISA 14.0. I have NI VISA Server running on this machine so that other systems on the network can access the Arduino (and other instruments attached to the server).

Connecting to the server from both Mac and Windows clients (running Labview 2014 and 2010 respectively, both using the last version of the LIFA package), running the LIFA Init routine repeatedly will eventually cause the server process to crash. Thus, extended access to the Arduino across multiple runs of the client ocde will eventually end with a crash of the server process. 

The attached VI demonstrates the issue; it initializes a connection with the Arduino and then closes it, and the process repeats every two seconds until an error is thrown. Fairly consistently, at about 300 iterations the server process crashes. Looking at the call stack in the crash report, the crashing point is a call to VISA Clear (used in the first stage of the Init routine). Once the server crashes, the client code of course immediately throws an error.

Running this stress-test routine directly on the server, i.e. a standard VISA serial-device connection with no tunneling over the network, runs very reliably (I ran it overnight for about 25,000 iterations without a problem).

As a workaround, I'm redoing my application code on the clients to minimize the number of times a session is opened and closed, but that only goes so far and ideally I'd like to find a way to just fix the problem...

Any thoughts, suggestions, or advice would be greatly appreciated.

Best,

Daniel

0 Kudos
Message 1 of 5
(4,697 Views)

Could you post the VI for LabVIEW 2013?

0 Kudos
Message 2 of 5
(3,074 Views)

Sure, no problem. See attached.

0 Kudos
Message 3 of 5
(3,074 Views)

Have you tried ruling out LIFA? Simply do some simple VISA functions that include VISA Clear.

0 Kudos
Message 4 of 5
(3,074 Views)

I spent a while yesterday testing exactly that, and it does seem to be intrinsic to VISA rather than particular to LIFA. Specifically, I was able to reproduce the problem using an RS232 connection to a test instrument and just sending raw VISA Clear commands.

So, looks like blaming the Arduino firmware wasn't the right thing to do.

As a workaround, in the off chance that someone else has this same problem, I edited the LIFA Init vi by disabling the call to VISA Clear in the first loop. The iniitializer still seems to work without first clearing the buffers, and it runs over the server link for thousands of iterations without causing a crash of the server process.

Message 5 of 5
(3,074 Views)