FTDI / USB Response time

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using an FTDI245B (parallel) chip with the FTD2XX dll interface at the PC and I have a "response time" problem.

With a PC receiver in a tight loop, when I send data there is always the same perceptible pause (400 msec??) before it is received. I was expecting something more like 20-50 msec - i.e. apparently instant. (Note that this is with NO traffic from the PC to the FTDI device.)

As performance is not yet important I've got the problem on a back burner - but I'd appreciate anyone who has had a similar experience giving me a clue of where to look next!

Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The FTDI D2XX has some quirks.
Our first attempt was to have two threads, one reading, one writing. Apparently sometimes something blocks in the DLL, and it hangs until timeout.
The working attempt uses the D2XX set-event-on-received-data function, and it seems to work. Also, don't read more characters than are available.

Set the timeout in the device to 0? or 1 ms (default is 16).

We get round trip times of around 2 ms for 50-byte packets.
With data-coming-from-the-outside, using the event, the timeout tweak, and the latest D2XX, the time is around 1 ms.

Something is definitely rotten in your app.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Also, don't read more characters than are available.

Thanks KKP - Now that I read the exact amount avaiable, I get the data "immediately."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This USB device has a FIFO buffer. If you don't completely fill the buffer, nothing happens right away - it sits there waiting for more data until the timeout, then it sends what it has. The trick is to pulse the SI/WU line to make it dump the buffer without waiting. There's probably a similar arrangement on the PC side, with an API call to dump the buffer, though I haven't checked.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

peret:

I am using the FTDI245BM since years now.

The default timeout is set to 16ms.
The transmit block size is 64 Bytes (i think) if equal or more than 64 Bytes are in buffer they will be transmitted immediately. The value can be adjusted.

On the PC side you can use PURGE to transmit immediately (as i undersand)

Sometimes i have trouble with high speed datatransmission in both ways at the same time. Besides of this everything is fine.

Klaus
********************************
Look at: www.megausb.de (German)
********************************

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to get it at the end of the post.

My problem was not milliseconds, it was a delay approaching one second.

As KKP suggested, it happens if you try to read more data than is available.