LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView VISA open resets Arduino (DTS disabling possible?)

Hi,

 

I'm setting up a hardware project where some digital I/O control lines are handled by an arduino which I want to control via LabView by serial writing and reading simple byte control commands.

The communication itself is working quite good, however I noticed an unwanted behaviour on opening the serial communication port to the microcontroller via LabView VISA VIs.

 

It seems LabView always sets the DTS pin on the serial port, which in turn causes Arduino to reset (and thereby resetting the output states of the digital I/O lines for a short moment).

This might not seem like the super most important topic of all times... 🙄

But imagine there is my hardware (which is a robot arm machine-controller in my case) listening to control signals on the arduino digital lines and then going into some unwanted state just because I re-open the VISA session via LabView.... could lead to a quite dangerous situation at some point 😉

 

So is there a way to prevent LabView from asserting DTS/DTR ?
I can use hterm terminal for testing the serial com and there I can connect and re-connect as much as I want without interfering with the running Arduino. So it's not like it is fundamentally impossible to realize this on a software level.

 

 

For the sake of completeness, here's the absolute minimum example causing the "problem".

Running the LabView Vi causes Arduino reset and turns off the LED on digital Pin 2 for a moment.

itchy00_0-1673262975151.png

 

 

PS: I am aware of this older thread, but I still haven't found a (software-side) solution so far.
https://forums.ni.com/t5/LabVIEW/Labview-VISA-Open-Close-Session-Asserts-Serial-DTS/td-p/1163857 

 

Thanks for some help!!!

0 Kudos
Message 1 of 4
(1,578 Views)

VISA changes the settings to force the DTR line to go high when opening the serial port. This is really ugly, because it also affects other applications.

 

This issue is one of the reasons, why I developed my own serial interface for labview some years ago. 

You can download the 32bit and 64bit windows versions and also the complete source code from

https://www.mhst.de/downloads.php 

 

The usage is similar to VISA. Use the context help (Ctrl+h) for some more information about each VI (or look into the sourcecode for all details).

 

Because VISA forces windows to always set the DTR line high, you have to execute "comm flow control.vi" or "comm configure.vi" to force windows to return to normal behavior.

 

 

some more details needed?  

The normal way is to open the serial port, read the comm port state (the DCB structure / all important settings). From this point, the application can change the settings as needed. I han't tested how VISA really acts, but it seems that VISA sets the fDtrControl flag to DTR_CONTROL_ENABLE which then forces windows to set the DTR line to TRUE when opening the serial port (even if another application opens the port).

 

 

0 Kudos
Message 2 of 4
(1,530 Views)

Hi Martin

 

Nice! This sounds like it could be what I was looking for.

I'll definitely going to try that out!

 

Thanks a lot 🙂

0 Kudos
Message 3 of 4
(1,493 Views)

Another option is different hardware. I believe Adafruit Arduino clones have a jumper that can be removed to prevent the DTS reset.

 

In reality you should really only be using an actual Arduino as a development board. Once your project is mature you should just use a the Atmel chip in your project. They can be had for like $3 with the Arduino bootloader already installed. Then you can keep the DTS disconnected or put a jumper in for when you need to update firmware.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 4
(1,484 Views)