LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Serial Port configuration

I am troubleshooting communication between a product and LabVIEW using the serial port.

 

I have a tool created by the engineering team for debug that was written in C, that works.  

 

I have found a work around, I install the Keysight IO Library as a secondary VISA, and then I can use LabVIEW just fine to communicate to the device.  But I shouldnt have to do this, since this is a simple configuration.

 

Serial Port ConfigSerial Port Config

 

Another observation using the Device Monitoring Studio when looking at the Serial Port Lines. 

 

Engineering Tool:  RTS and DTR are green, CTS, DSR, DCD and RI are red

LabVIEW: RTS and DTR are green, CTS, DSR, DCD and RI are grey

 

Question: How can I correctly set the values to match the debug tool, since I have been unable to locate the properties via LabVIEW ?  Queue Length, Flow Control, timeouts, wait mask and clear DTR.  It also seems the CTS, DSR, DCD and RI are set to unasserted, but the help file seems to indicate that NI only allows that via NI Serial hardware, and I am using a stock serial port on the PC.

 

Below are the differences between the two tools when checking the serial port lines.

 

Engineering Tool Debug:

 

000075: I/O Request (DOWN): 2018-09-21 08:39:10.4101856 +0.0000016
IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
· Control lines = 0
· Flow control = 0
· Xon Limit = 1024
· Xoff Limit = 1024

 

000079: I/O Request (DOWN): 2018-09-21 08:39:10.4102112 +0.0000032
IOCTL_SERIAL_SET_TIMEOUTS: Set timeouts
· Read interval = 4294967295
· Read total multiplier = 4294967295
· Read total constant = 5000
· Write total multiplier = 0
· Write total constant = 5000

 

000083: I/O Request (DOWN): 2018-09-21 08:39:10.4103872 +0.0001264
IOCTL_SERIAL_SET_QUEUE_SIZE: Set queue size
· Input = 1024
· Output = 1024

 

000081: I/O Request (DOWN): 2018-09-21 08:39:10.4102592 +0.0000464
IOCTL_SERIAL_SET_WAIT_MASK: Set wait mask
· Wait Mask = SERIAL_EV_RXCHAR | SERIAL_EV_RXFLAG | SERIAL_EV_CTS | SERIAL_EV_DSR | SERIAL_EV_RLSD | SERIAL_EV_BREAK | SERIAL_EV_ERR | SERIAL_EV_RING (0x1fb)

 

Following commands are not not seen in LabVIEW Debug:

000097: I/O Request (DOWN): 2018-09-21 08:39:10.4104480 +0.0000016
IOCTL_SERIAL_CLR_DTR: Clear DTR


000098: I/O Request (UP): 2018-09-21 08:39:10.4104560 +0.0000080
IOCTL: IOCTL_SERIAL_CLR_DTR (0x1b0028)

 

000082: I/O Request (UP): 2018-09-21 08:39:10.4102608 +0.0000016
IOCTL: IOCTL_SERIAL_SET_WAIT_MASK (0x1b0044)

 

000090: I/O Request (UP): 2018-09-21 08:39:10.4104048 +0.0000000
IOCTL_SERIAL_GET_CHARS: Retrieve special characters
· EOF = 0x1a
· Error = 0
· Break = 0
· Event = 0x1a
· XON = 0x11
· XOFF = 0x13

 

LabVIEW Program:

 

000051: I/O Request (DOWN): 2018-09-21 09:37:53.3273936 +0.0000000
IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
· Control lines = SERIAL_DTR_CONTROL (0x1)
· Flow control = SERIAL_RTS_CONTROL (0x40)
· Xon Limit = 64
· Xoff Limit = 64

 

000055: I/O Request (DOWN): 2018-09-21 09:37:53.3274016 +0.0000016
IOCTL_SERIAL_SET_TIMEOUTS: Set timeouts
· Read interval = 4294967295
· Read total multiplier = 0
· Read total constant = 0
· Write total multiplier = 0
· Write total constant = 500

 

000053: I/O Request (DOWN): 2018-09-21 09:37:53.3274000 +0.0000016
IOCTL_SERIAL_SET_QUEUE_SIZE: Set queue size
· Input = 640
· Output = 640

 

000064: I/O Request (UP): 2018-09-21 09:37:53.3274240 +0.0000016
IOCTL_SERIAL_GET_CHARS: Retrieve special characters
· EOF = 0
· Error = 0
· Break = 0
· Event = 0
· XON = 0x11
· XOFF = 0x13

Kenny

0 Kudos
Message 1 of 5
(3,462 Views)

I am not sure where you are looking.

 

In my LabVIEW 2015 I see under VISA Advanced ---> VISA Property Node  a whole bunch of settings that are possible for Serial Settings .

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

On a DTE (data terminal equipment, i.e. a computer), CTS, DSR, DCD and RI are all inputs, so there's no way to assert them from within LabVIEW. Can you elaborate on what doesn't work with your LabVIEW code, what are the symptoms? What leads you to think that changing obscure settings like queue length will help?

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

The symptom was that the device was not waking up to communicate.

 

I have to send out 1000 bytes at the start of the communication to "wake up" the device,  I forgot to mention that for the buffer size. 

 

I was able to get this going, by toggling the DTR line.   Assert the RTS and DTR, wait 100 ms, unassert the DTR line, wait 100 ms, and then assert the DTR line again.

 

 

Kenny

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

VISA "queue length" is completely separate from buffer size, it has to do with queuing VISA events and most of the time there's no need to change it. There may not be a need to change the buffer size either. It's still unclear to me what the problem was and how you solved it, but if it's resolved then that's good.

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