Hello,
I am currently working with an FT232H that is connected to an FPGA that
generates the data that is sent to a PC over the FT232H.
The setup works, I can receive data with no data loss. However, the
transmission speed is well below the advertised 40 MBytes/sec. I am currently
receiving around 28 MBytes/sec. The FPGA is sending data as soon as the TXE
line goes low, so I assume the bottleneck lies within the USB connection
between the FT232H and the PC.
I am running Arch Linux and have installed libftdi from the packet sources. The
version is reported as 1.4-2. Has anyone experienced this behavior before and
knows a solution?
Below is the code I use. I do check return values, I just removed the checks to
keep this message short.
Best regards,
Laurenz Kamp
==================== CODE =================
fifo = ftdi_new();
//Open FIFO Channel
ftdi_set_interface(fifo, INTERFACE_A);
ftdi_usb_open(fifo, 0x0403, 0x6014);
//Reset FT
ftdi_usb_reset(fifo);
ftdi_usb_purge_buffers(fifo);
//Bitmode Reset
ftdi_set_bitmode(fifo, 0xFF, BITMODE_RESET);
//Set FT 245 Synchronous FIFO mode
ftdi_set_bitmode(fifo, 0xFF, BITMODE_SYNCFF);
//Set Latency Timer
ftdi_set_latency_timer(fifo, 2);
//Set USB Parameters
ftdi_read_data_set_chunksize(fifo, 64 * KiB);
ftdi_write_data_set_chunksize(fifo, 64 * KiB);
//Set Flow Control
ftdi_setflowctrl(fifo, SIO_RTS_CTS_HS);
//Set timeouts
fifo->usb_read_timeout = 100;
fifo->usb_write_timeout = 1000;
size_t bytes_read;
uint8_t last_byte = 0;
uint8_t buf[4 * KiB];
while(1) {
bytes_read = ftdi_read_data(fifo, buf, 4 * KiB);
if(bytes_read > 0) {
total_bytes += bytes_read;
for (int i = 0; i < bytes_read; i++) {
if (buf[i] != ((last_byte + 1) & 0xff)) {
missed_bytes++;
}
last_byte = buf[i];
}
}
}
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|