-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the ECP5_BGA381_FT2232HQ_FIFO wiki!
The first step in the bring up process is to program the EEPROM of the FT2232HQ to enable synchronous FIFO operation on startup. This can be done by using the FTDI provided utilities: FT_PROG and MProg. I used FT_PROG, the older of the two. Note that you will need a Windows machine to run FT_PROG as it is the only platform supported for FT_Prog (and the newer MProg alternative). I did my bringup on Linux and I was able to modify the EEPROM/write example in the D2XX Driver download and successfully write the EEPROM. The essential settings to set in FT_PROG are as follows:
- Enable the Bus power operation with current up to the maximum of 500mA.
- Set Port A and Port B in '245 FIFO' mode.
- Set the Driver for Port A and Port B to D2XX.
Once all these settings are correctly set the press the EEPROM program button. You can find all the details of using FT_PROG in the FTDI User Guide for FT_PROG.
The next step is to program the FPGA with the basic loopback Verilog test code. This code simply loops back each byte received from the FT2232. The Verilog code is in the /hdl_test directory. Steps to follow:
- Download the open source oss-cad-suite 0.1.0, unpack it into a folder say "/home/gil/tools-oss-cad-suite-0.1.0/".
- Edit fpga.sh to update BIT_PATH and TRELLIS_DB script variables to point to the oss-cad-tools sub directories:
BIN_PATH="/home/gil/tools-oss-cad-suite-0.1.0/bin"
TRELLISD_DB="/home/gil/tools-oss-cad-suite-0.1.0/share/trellis/database"
- Run ./fpga.sh. Depending on how permissions are set on your machine you may have to enter your root password so that the openFPGALoader can write the bit stream to the FPGA RAM. The successfull outcome looks like this:
Jtag probe limited to 3MHz
Jtag frequency : requested 6000000Hz -> real 3000000Hz
ret 0
Open file: DONE
b3bdffff
Parse file: DONE
Enable configuration: DONE
SRAM erase: DONE
Loading: [==================================================] 100.00%
Done
Disable configuration: DONE
My hardware uses a green LED to indicate that the ECP5 bitstream was successfully written.
The instructions for setting up the FTDI D2XX Drivers are included in the D2XX Driver download for your specific platform. I followed the instructions for Linux and MacOSX and the drivers installed without any problems.
Note that the driver download contains source code for sample apps. I built the samples and as I mentioned earlier I used the EEPROM/read and EEPROM/write examples to test if I can read and write the EEPROM. The reason this was useful to me is that when I used FT_Prog in Windows I changed the Vendor ID in EEPROM and after that FT_Prog no longer dicovered my FT2232 device. The simple solution was to modify the EEPROM/write example by adding a call to FT_SetVIDPID with my Vendor ID and Product ID so that FT_Open would work then and setting the EEPROM fields (including VID and PID) to whatever values my application required. After successfully writing the EEPROM I was back to the default VID and PID.
In the host_test directory type make:
> make
cc main_loopback.c -o ft2232 -Wall -Wextra -lftd2xx -lpthread -lrt -Wl,-rpath /usr/local/lib -L/usr/local/lib
Finally run the app with ./run.sh.
> ./run.sh -c 64000 -p 128
[sudo] password for gil:
Send bytes: 64000, packet bytes: 128
Done sending 64000 bytes
==== Test successful ====
The reason I am using a script to run the host app is the two lines before the ft2232 command line (see run.sh):
sudo rmmod ftdi_sio
sudo rmmod usbserial
This eliminates the conflict between the D2XX drivers and the FTDI sio driver.