2

An acquisition system based on a FPGA and a micro-controller is using two FTDI (FT2232H) devices. Basically, the FPGA is generating data (as fast as possible) and sending to a system processor via the FT2232H (asynchronous FIFO mode). Also, the micro-controller is connected to the system processor via another FTDI device in UART mode.

System Diagram description (clickable, from http://postimg.org/image/ovpov6ujv/)

The whole system is already working on Windows platform with success, reaching ~95MB/s in the FTDI mode using the D2XX driver. The other FTDI device IC is connected using Virtual COM driver and the data throughput is not measured (don't need to go fast).

On Linux the results are different. For both devices (UART and FIFO mode) the FTDI's D2XX direct driver is used.

The data transmitted via FIFO mode IC is droping byte (about 10% of the total data, 30MB). The received data from the UART mode IC contain unexpected values. The function FT_GetQueueStatus return without error and the field RxBytes greater than zero (0) even if the micro-controller don’t send any data via UART. The data received usually is something like 0x01 and 0x60, multiples times. The frequency change when the latency time change. Below the test case details.

Setup the device:

ftStatus |= FT_ResetDevice(*ftHandle);   //Reset USB device
   ftStatus |= FT_Purge(*ftHandle, FT_PURGE_RX | FT_PURGE_TX); // Purge transmit and receive buffers
   ftStatus |= FT_SetUSBParameters(*ftHandle, USB_TRANSFER_SIZE, 0); //Set USB request transfer size
   ftStatus |= FT_SetTimeouts(*ftHandle, 100, 100);       //Sets the read and write timeouts in milliseconds for the FT2232H
   ftStatus |= FT_SetLatencyTimer(*ftHandle, 4);   //Set the latency timer

// For the device using UART mode, the following function are also executed:

   if(serial) {
          ftStatus |= FT_SetBitMode(*ftHandle, 0x00, 0); //Turn off bit bang mode
          ftStatus |= FT_SetBaudRate(*ftHandle, 9600);    // Set baud rate to 9600
          ftStatus |= FT_SetDataCharacteristics(*ftHandle, FT_BITS_8, FT_STOP_BITS_1, FT_PARITY_NONE); // Set to communicate at 8N1
          ftStatus |= FT_SetFlowControl(*ftHandle, FT_FLOW_NONE, 0, 0); // Disable hardware / software flow control
   }

Read data:

dwNumInputBuffer = USB_TRANSFER_DATA_SIZE;
   ftStatus = FT_Read(ftHandle, &InputBuffer, dwNumInputBuffer,
                 &dwNumBytesRead); //Read out the data from input buffer
   if (ftStatus != FT_OK) {
          printf("Fail reading from USB device!\n");
          done = 1;
   }
   if (dwNumBytesRead > 0) {
          // move the data to other location memory (and process once all the expected data is received)
   }

The system specification:

  • Windows 7 64 bit, 64GB RAM, SSD hard disk:
    • FIFO mode IC: D2XX library release date: 2014-09-29
    • UART mode IC: VCP Drivers release date: 2014-09-29
  • Ubuntu 14.04 64bits, 8GB RAM, standard hard disk:
    • FIFO mode IC: D2XX library release date: 2012-06-29, 1.1.12
    • UART mode IC: D2XX library release date: 2012-06-29, 1.1.12

The D2XX library is used for both FTDI devices because the USB-SERIAL driver need to be shutdown according with FTDI suggestions FTDI Drivers Installation Guide for Linux. When using one (1) UART mode FTDI device and USB-SERIAL driver (standard with Linux Kernel) the application don't receive unexpected results.

Thanks for any suggestions.

JACB
  • 33
  • 5

0 Answers0