LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: DTR state while serial port init

For some reason it always changes the state of the DTR line when I run the "VISA Configure Serial Port (Instr).vi" with LabVIEW 2013.

I have tried to set the "Line DTR State" property before and after the VI call, but it does not help. I also have tried to call the "VISA Open" function before I set the property and I run the configure, but it ends up at the same.

 

I have an Arduino Mega connected to it and the DTR line triggers the reset on the Arduino what I would like to prevent. The DTR state should not change when I access the serial port.

Have you guys any idea how to get around this issue?

0 Kudos
Message 1 of 13
(2,584 Views)

@michaeluray wrote:

For some reason it always changes the state of the DTR line when I run the "VISA Configure Serial Port (Instr).vi" with LabVIEW 2013.

I have tried to set the "Line DTR State" property before and after the VI call, but it does not help. I also have tried to call the "VISA Open" function before I set the property and I run the configure, but it ends up at the same.

 

I have an Arduino Mega connected to it and the DTR line triggers the reset on the Arduino what I would like to prevent. The DTR state should not change when I access the serial port.

Have you guys any idea how to get around this issue?


For some reason means "by intentional design" here.  Cut the trace labeled RESET-EN


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 13
(2,545 Views)

@JÞB wrote:

For some reason means "by intentional design" here.  Cut the trace labeled RESET-EN

I actually need to be able to reset the Arduino via the DTR line to get into the bootloader and to download updates, but I don't want to perform a reset when I just start my normal communication to it by opening the serial port.

I want LabVIEW to open the serial port but without changing the DTR state during the port init.

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

@michaeluray wrote:

@JÞB wrote:

For some reason means "by intentional design" here.  Cut the trace labeled RESET-EN

I actually need to be able to reset the Arduino via the DTR line to get into the bootloader and to download updates, but I don't want to perform a reset when I just start my normal communication to it by opening the serial port.

I want LabVIEW to open the serial port but without changing the DTR state during the port init.


That's not the way a port initialize works.  you can probably get away without open VISA but, when you do use an Open VISA DTR will toggle.  Arduno counted on this behavior to force a device reset.  


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 13
(2,497 Views)

 

I run "VISA Configure Serial Port (Instr).vi" directly without any other action ("VISA Open") before and I also tried to set the property at first in the configure VI, but the DTR still gets changed.

 

2021-03-22_08-38-08_VISA_Configure_Serial_Port_(Instr).vi_Block_Diagra.png

 

 

Even when the first action is to clear the DTR, the DTR internally gets set for a short time period which resets the Arduino.

 

 

2021-03-22_09-06-56_Probe_Watch_Window.png

 

 

Read the property back on (11) says it got set properly to 0.

 

2021-03-22_09-07-09_Probe_Watch_Window.png

 

Is there no way to handle the interface on this way, that it does not touch the DTR line during the port init?

0 Kudos
Message 5 of 13
(2,466 Views)

Hi Michael,

 


@JÞB wrote:
Cut the trace labeled RESET-EN

Cut the trace on your Arduino pcb, then solder in a switch to enable it at will…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(2,463 Views)

@michaeluray wrote:

 

Is there no way to handle the interface on this way, that it does not touch the DTR line during the port init?


The underlying viOpen() function does a default initialization of the serial port and there is likely nothing you can change about that. And while VISA Open calls that viOpen() function internally, you gain nothing by omitting the VISA Open node, since LabVIEW calls viOpen() anyways the first time it encounters a VISA node that tries to access a specific resource. Each VISA resource name also stores internally the underlying VISA session handle that is ABSOLUTELY necessary in order for anybody to use any of the other VISA functions and the only way to receive such a session handle is by calling viOpen().

Rolf Kalbermatter
My Blog
Message 7 of 13
(2,457 Views)

Hi Michael,

I have the exactly same problem. Did you find any solution to solve the problem so far?

We tried the same way you did, but with no success so far.

 

0 Kudos
Message 8 of 13
(2,157 Views)

There isn't in terms of software. VISA allows control of those handshake lines. In order for that to work it needs to initialize these lines when opening the serial port under Windows. If it doesn't it can't later go and decide to want to control it anyhow if you use one of the property nodes. But when it tells Windows that it wants to control these lines eventually the Windows COMM system sets them explicitly to a state.

 

VISA either has to tell Windows that it wants to use those lines or it would have to jump later through hoops and loops to still be able to control them when you decide to use one of those modem line properties.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 13
(2,143 Views)

The arduino mega has 4 serial ports. You could connect the computer via a USB to TTL serial adapter on SERIAL 1,2 or 3 and it wont trigger the reset.

0 Kudos
Message 10 of 13
(2,135 Views)