10-14-2014 03:19 PM - edited 10-14-2014 03:21 PM
I have a wireless data collection device my company makes that I am trying to use to test one of our other wireless products. The device sends serial data to a PC through a USB port. I have written an automated LabVIEW program to test all the functions of my new product. However, after pulling in data, I have realized that the serial data comes in very fast and requires that I change the default Windows latency time for the COM port from 16ms to 2ms to not miss anything. This is easy enough for me to do locally on my machine, but much harder for me to spec for an offsite CM.
Is there a way to have my LabVIEW program change the latency time of the Windows COM port from 16ms to 2ms automatically?
Solved! Go to Solution.
10-14-2014 05:05 PM
@EricBSEE wrote:
I have a wireless data collection device my company makes that I am trying to use to test one of our other wireless products. The device sends serial data to a PC through a USB port. I have written an automated LabVIEW program to test all the functions of my new product. However, after pulling in data, I have realized that the serial data comes in very fast and requires that I change the default Windows latency time for the COM port from 16ms to 2ms to not miss anything. This is easy enough for me to do locally on my machine, but much harder for me to spec for an offsite CM.
Is there a way to have my LabVIEW program change the latency time of the Windows COM port from 16ms to 2ms automatically?
I've never heard of this being an issue before. Would you mind uploading your code so that we can see where the problem lies?
Thanks! 🙂
10-15-2014 05:26 AM
Are you talking about the FTDI driver? I know they allow such changes through registry settings. So the approach would be probably to have a small registry script that updates the according setting. Most likely this will need to be run with elevated priviliges as these settings typically reside in the HKLM or HKCR hive rather than the HKCU one.
10-15-2014 07:14 AM
You are right rolfk. For some reason I thought the latency value was from some Windows setting, but the 16ms time is actually from an FTDI driver.
From FTDI's website:
The default value for the latency timer is 16ms. This value may be customised by adding or changing the following entries in the FTDIPORT.INF file of the driver before installation.
[FtdiPort232.NT.HW.AddReg]
HKR,,"LatencyTimer",0x00010001,50
This example will set the default latency timer value to 50ms. The valid range for the latency timer is 1ms - 255ms, although 1ms is not recommended as this is the same as the USB frame length.
The latency timer value is held in the registry under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\FTDIBUS\{Device VID, PID and serial number}\0000\Device Parameters\LatencyTimer
Using this information, I will see if i can modify the FTDI driver installation file and send that to the CM along with my test software package.
However, this does bring up a new question for me. You mention writing a script to change the registry.
Is it possible to make changes to Windows registry values from within LabVIEW?
I understand that this may be contingent on the elevated privileges you mentioned.
10-15-2014 07:27 AM
I should have just done a quick search before adding my last question.
It looks like LabVIEW can make changes to the registry:
http://zone.ni.com/reference/en-XX/help/371361J-01/glang/windows_registry_access_vi/
10-15-2014 07:28 AM
10-15-2014 08:47 AM
Actually it ended up being extremely easy to just add to my LabVIEW program's Initialization to check the driver setting and change the latency to 2ms if it wasn't already set that way.