Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-485 (RX Latency)

I have used a basic RS232 to 485 converter for many years without any communication problems and have tried without success to replace this with the NI USB-485 converter.  A change is necessary as there are now very few laptops which come with a 'True RS232' port.

 

Working Configuration with RS232

 

Com port settings are:- Baud Rate:9600, Parity:n, DataBits:8, StopBits:1, Handshaking:none.  Normally the RX buffer is set to 1.

Operation:- As can be seen from the setting data is transmitted and received using two wire with no handshaking.  The product I am communicating with will reply between 3 and 10mS (typically 3.5mS).  The received data can easily be of a random nature hence CRC's are handled within the software.  The receive timeout can be set as low as 20mS although in practice it is set a little higher.  The application is performing a binary tree scan looking for devices hence typically there is no reply and the receive timeout is invoked.

 

The Problem with the NI USB-485

 

It is necessary to set the Receive timeout to a value of at least 70mS which when performing a binary tree scan slows the application to approximately 1/2 the speed achieved with the RS232 port.  There is no problem with the received data, hence internally the USB-485 is quite happily receiving the data within the typical product response time of 3.5mS.  What I believe is happening is there is a delay before windows OS or there hardware driver polls the USB Com port hence there is an additional delay before the application knows there is data in the receive buffer.

 

Solution

 

I would like a com port driver which provides better control of TX/RX threading or IRQ's to enable the perceived latency to be reduced.  The alternative is to write drivers to communicate directly using DLL's etc.  The disadvantage is that this would not provide a 'drop in solution' as it could at the moment where the end user simply has to load the NI driver then select a different com port.   

 

 

Message 1 of 3
(4,236 Views)

KAB,

 

I've always been convinced that the delay is caused by the OS - USB layer and in particular the virtual port part of the driver.  I'm starting to wonder if the NI-USB functions could be used to directly control the USB-485 adapter.  I wonder if NI would be willing to divulge the info necessary?

 

I have noticed that this delay is about half when a PCMCIA serial device is used.

0 Kudos
Message 2 of 3
(4,233 Views)

Hello KAB,

 

What version of the NI-Serial driver are you using with the NI USB-485.  Driver version 3.4 fixed several major latency problems with the NI Serial USB products including the USB-485.  I would recommend upgrading to at least that version of the driver to get the best performance from your hardware.

 

Also, please remember that the RS232 to RS485 converter is completely different from the USB-485.  The RS232 to RS485 converter probably uses a circuit to change the voltage levels from RS232 to RS485 differential signals.  This will mean that there is virtually no time lost in converting this the data. 

 

USB itself has extremely high latency, so this contributes to the overall time you are seeing.

 

Thanks,

Steven T.

0 Kudos
Message 3 of 3
(4,179 Views)