ftdi (vcp or d2xx) forward (from PC to ftdi device) latency

2k views Asked by At

As documented on FTDI website, to receive bytes from FTDI device to PC, because of this 64-byte USB packet issue, it can have delays 16ms (timeout) + 1ms (or more, USB scheduler time).

If I understand it correctly, the best one can do (to avoid 16ms timeout delay), in terms of continuous streaming of data (without flow control) from FTDI chip (FTDI_232 or FTDI_245) to PC, is to ask for:

62-byte every 1ms, if USB scheduler dispatches driver reliably every 1ms; 124-byte every 2ms, if USB scheduler dispatches driver reliably every 2ms; ... 372-byte every 6ms, if USB scheduler dispatches driver reliably every 6ms;

My question is how fast one can send bytes from PC to FTDI chip? It certainly will subject to this USB scheduler latency. But is there also some 64-byte packet issue?

In other words, to be able to continuously stream data from PC to FTDI chip. Shall I send 62-byte at a time?

2

There are 2 answers

0
spatial On

The 16ms USB Bulk IN latency is indeed to flush partial 64 byte blocks of data from the chip back to the PC. On their knowledge base there is information about changing this value i.e. you can set a minimum latency timer of 1ms meaning that after each ms any data in the chip's internal will be sent back to the PC.

The latency timer only affects data coming from the chip to PC; it does not affect data going in the opposite direction.

The maximum throughput of the device will be affected by the baud rate you have set for your UART. I'd speak with them about what the theoretical limit would be.

0
Paul Jurczak On

I just read that document and my understanding is that FTDI device timer role is to force flashing not yet full buffer to the PC. Otherwise, if you had a peripheral, which sends only a few bytes per hour without event characters or status line change, you would have to wait a day to fill the 64 bytes device buffer and get the data on PC end.

It seems to affect only reading and maybe writing data packets smaller than FTDI device buffer. If you want to stream to FTDI device at the maximum throughput, use the maximum 4K packet and keep pushing the data. The timeout setting should have no effect.