Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When sending only few bits of data via FTDI USB-Serial cable to the PC, you have to wait for one of the following conditions to occur before you get your data according to FTDI's AN232B-04, Data Latency Flow:

  1. The buffer is full
  2. One of the RS232 status lines has changed
  3. An event character had been enabled and was detected in the incoming data stream
  4. A timer integral to the chip has timed out.

I want to use option 3, enable an event character and also define it. How do I do that in Windows 7? I can't find any documentation on it. I don't want to have to write code to do it, I just want to know where in my operation system (Windows 7) I could change these settings.

share|improve this question

migrated from electronics.stackexchange.com Apr 12 '12 at 13:27

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

2 Answers 2

It is specified in the Device Control Block on Win32. See the EvtChar member.

share|improve this answer
    
I don't see it as a coding question, as i ideally don't want to write code to set the EvtChar. I just want to change the setting somewhere in my OS (Windows 7). If possible. –  evsc Mar 21 '12 at 17:19
3  
@evsc: Applications can choose to leave the setting unchanged, but most do not. There is no global setting, because this value can potentially break applications. –  Ben Voigt Mar 21 '12 at 17:40
    
ok. make sense. thanks for the info! –  evsc Mar 21 '12 at 18:08

I realise the original question was in regards to Windows, but here are instructions for other operating systems:

Mac OS-X

For the latency timer - After installing the driver, make a backup copy and edit the file /System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist. Find the section for your device, eg

    <key>FTDI2XXBM</key>
    <dict>
        <key>CFBundleIdentifier</key>
        <string>com.FTDI.driver.FTDIUSBSerialDriver</string>

And add the following after the above

        <key>ConfigData</key>
        <dict>
            <key>LatencyTimer</key>
            <integer>1</integer>
        </dict>

I suspect this would also work for the event character, but I'm not sure of the correct <key> to use.

Linux

The Linux kernel that comes with Ubuntu 14.04 (Linux 3.13.0-24-generic) already sets the latency timer to 1ms by default. However the parameters are available to change via sysfs. Locate your device under /sys/bus/usb-serial/devices

$ ls /sys/bus/usb-serial/devices/
ttyUSB0
$ ls /sys/bus/usb-serial/devices/ttyUSB0
driver  event_char  latency_timer  port_number  power  subsystem  tty  uevent

You can set the event character by echoing a value to event_char. The value is the ASCII value of the event character (eg 'A' is 65) plus 256 (this sets the 9th bit to 1 which enables event character support) - so for 'A' the value is 65 + 256 = 321:

$ sudo -i
<authenticate>
# echo 321 > /sys/bus/usb-serial/devices/ttyUSB0/event_char

To use 0x00 as the event character, simply pass the value 256, while to disable the event character, pass the value 0.

You should also be able to modify the latency timer this way, but it didn't work for me:

# echo 4 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
# cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
1

I guess this is not a big deal as it defaults to the minimum 1ms.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.