Top

FTDI: interfacing FT1248/FT220x over SPI

FTDI: interfacing FT1248/FT220x over SPI

(2 votes, average: 4.50 out of 5)
Loading...

In my current project I want to interface the FT220x over 1-bit SPI with an TI piccolo TMS320F28027.
After some trouble and various cups of coffee I managed the whole thing by implementing the SPI in pure software.

I wasn’t able to get it working with the built in tri-wire hardware SPI as the FT uses MIOSIO and MISO to send/receive data and status respectively.

Because there is no sample code available on the web concerning this problem I decided to publish my library here. Take a look into the datasheet for further information!

Sending data over SPI to the FT1248/FT220x is quite easy: Just send a WRITE_REQ (0x00) followed by the payload on MIOSIO.

Reading is a bit more complicated: We need to know how many chars to read. Well, send a READ_REQ (0x02), evaluate MISO and read data on MIOSIO if the FIFO is not empty.
If MISO returns 0xFF, the FT’s FIFO is empty, cancel transmission immediately!
If MISO returns 0xFE while sending READ_REQ, there is data in the FIFO ready to be shifted out.
If MISO returns 0x7F while reading data, there is more data in the FIFO.

In my project there are other 4-wire SPI slaves, that’s why I need to toggle MIOSIO’s direction and MIOSIO/MOSI. Therefor I use the functions setSoftSpi4wire3wireOut() and setSoftSpi3wireIn().

libft220x.h

libft220x.c

  • Louie Zamora

    Thank you very much for this information~! I have been dying for days to look for a sample code on how to use the breakout board on this chip UMFT220XB-01 (TT_____TT)

    However, seems like the second attachment is out of format…