Sunday, August 5, 2018

FTDI Fast-Serial Mode with FPGA

FTDI USB devices FT2232H (& Co) have one interesting but rather seldom used interface type called "high-speed opto-isolated interface". While the name implies it was initially designed for opto-isolation there is no need to use the isolator, the interface can be used without it equally well. The benefits of the interface is that we only need 4 I/O Pins total for bidirectional data transfer (max clock rate 50MHz!).

I have been playing with the idea to use this interface in some projects for some while already. The first successful test was done within a few hours after I got an small nice and nifty board with FT2232H and small FPGA from China Gowin Semiconductor.

LittleBee board from Trenz Electronic
Needless to say the board is designed by me too. Well to test the interface as quick as possible I tried the "uart echo" approach, I connected the FSDO data from FT2232 back to FSDI input of FT2232 (with some clocks delay implemented as shift register) and provided some free running clock on FT2232H clock pin FSCLK. I hoped this would work as "echo" and indeed after programming the FT2232 Channel B to "fast serial" mode using FT_PROG utility from FTDI it really worked, I got echo using putty as UART terminal program.

This is of course no actual real use yet, but it shows that the simple way of using standard COM port drivers to send high speed data really works. If we want to talk to the "application" in the FPGA we use standard serial port drivers be it on Linux or Windows host (Virtual COM port drivers are provided by FTDI).

Next Step - some real use ? For this I need to write some more complex FPGA code than the serial loop-back I used for initial testing. I could continue using the LittleBee board. But I would prefer to use my favorite environment Vivado for the IP Core development. I have FPGA boards that include Xilinx FPGA and have FTDI Channel B connected to the FPGA I/O Pins (as example TE0723 Arduino-Zynq board) but well there could be problems when trying to connect to channel B fast-serial and at the same time use channel B as Vivado JTAG (actually I tried it once and really did face such problems). Also this usage would need FT_PROG to be used on TE0723 an action that would destroy the Xilinx JTAG License ID in the FT2232 User EEPROM.

Solution? Let's use TE0723 for FPGA development and debug but with FT2232H connected externally to the PMOD on TE0723. This can be easily done, there is not even need for flying wires for this, I can create a FT2232 "custom breakout" from say a Lattice FPGA board XO2000
XO2000 board from Trenz Electronic
I do have several REV 1 PCB's that are "not for resale" - utilizing one them as FTDI fast-serial to PMOD adapter would be good use. In order to "mate" properly I solder 2 row male pin-header from the bottom of the PCB. Hmmm - I should probably cut the VCC pins in order to not short-circuit the 3.3V supplies of the two boards? Yes it would have been easier to solder 2x5 header instead of 2x6 header in the first place.

Porting the code from Gowin to Lattice Diamond was done in less 30 minutes and "echo" test performed within an hour or so. So far so good.

Taking out the "echo" code and replacing it with "wiring only" code that directly connects signals from FTDI Channel B to PMOD pins takes another 30 minutes.

Done, now I can proceed with development with Vivado, the fast-serial interface comes from second FT2232 with no Xilinx JTAG license, so Vivado would not see it at all.

I guess the first step would be taking the echo loop-back code that is tested and working and implement it in Xilinx FPGA to verify the setup and pin-mapping is correct. Then it would be time to proceed with real IP Core development for the fast-serial mode.

(to be continued)

1 comment:

  1. I am glad to see you have found some use for FTDI and FPGA, that just seems very smart combination!

    ReplyDelete