# Improving performance of X-USBDC (FTDI)

The [X-USBDC](https://www.zaber.com/products/accessories/X-USBDC) is a USB to Serial Converter cable that allows connecting X-Series products to the computer's USB port.
Inside the cable resides a chip manufactured by [FTDI](https://ftdichip.com/).
FTDI chips are commonly used way to convert serial (RS232) signals to USB with drivers available on most contemporary operating systems.

The driver has a setting called *Latency Timer* that can be adjusted to improve the latency (responsiveness) of the device.
However, most users of Zaber Motion Library don't need to be concerned with this as Zaber's firmware
already has features designed to deal with communication delay. [Streams](https://software.zaber.com/motion-library/docs/guides/device_features/streams.md) and [PVT Sequences](https://software.zaber.com/motion-library/docs/guides/device_features/pvt.md) both deliver continuous motion free of communication lag.
It's worth noting that even after changing the *Latency Timer* the remaining latency causes delays between individual movements
and the performance won't match that of Streams.
If you need to read data from the device at a high (or precise) frequency, we recommend using [Oscilloscope](https://software.zaber.com/motion-library/docs/guides/device_features/oscilloscope.md).

Lowering the *Latency Timer* reduces communication latency and increases bandwidth potentially up to twice the baseline.
This can improve the performance of certain applications that intensively communicate with the device.
We are not aware of any adverse effects of lowering the *Latency Timer*.
The default value is *16 ms*.
The lowest possible value is *1 ms* and is not recommended by FTDI's [documentation](https://www.ftdichip.com/Support/Knowledgebase/index.html?settingacustomdefaultlaten.htm).
We recommend setting the value to *2 ms*. Our tests confirmed that the value works well and yields no worse practical performance than *1 ms*.

Select your operating system to see instructions on how to change *Latency Timer*.

> **Windows:**
>
> On Windows, go to the Device Manager, find your serial port, and right-click on *Properties*.
> Then select *Port Settings* tab, click *Advanced*, and change the *Latency Timer* value.
> The new value applies only to the selected port and is kept when the device is reconnected or the computer restarts.
>
> ![Changing latency timer on Windows](https://software.zaber.com/dev-portal/motion-library/docs/guides/communication/ftdi_latency/latency_windows.gif)

> **Linux:**
>
> Open a terminal and paste the following commands. Change `ttyUSB0` to match your serial port name.
>
> ```sh
> cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
> echo 2 | sudo tee /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
> ```
>
> ## Making the change permanent
>
> The value set above is lost when the device is unplugged or the computer restarts.
> To apply it automatically every time the device is connected, create a udev rule:
>
> ```sh
> echo 'ACTION=="add", SUBSYSTEM=="usb-serial", DRIVERS=="ftdi_sio", ATTR{latency_timer}="2"' | sudo tee /etc/udev/rules.d/99-ftdi-latency.rules
> sudo udevadm control --reload-rules
> ```
>
> The rule applies to every FTDI serial device connected to the computer.
> Unplug and reconnect the device, then run the `cat` command above to confirm that the value is `2`.

> **Mac OS:**
>
> To the best of our knowledge, there is currently no way of changing *Latency Timer* on macOS.
