Skip to content

Commit

Permalink
squash! Enable FT230X support, set hwspi pinout for it
Browse files Browse the repository at this point in the history
Mention whole FT-X family. Also allow to change default pinout based on chip type
  • Loading branch information
lorf committed Mar 28, 2018
1 parent cf16f84 commit d991d4e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ LIBUSB ?= ./libusb
CPPFLAGS += -DSPI_STATS
# Enable LEDs
CPPFLAGS += -DENABLE_LEDS
# FT230X support is available since libftdi-1.1
CPPFLAGS += -DENABLE_FT230X
# Support for FT-X family chips is available since libftdi-1.1
CPPFLAGS += -DENABLE_FT_X

# Fixes compilation on Debian/Ubuntu with mingw-w64 < 3.0.
# See: http://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/[email protected]/
Expand Down
4 changes: 2 additions & 2 deletions Makefile.wine
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ STDCXX_LIB ?= /usr/lib/gcc/i686-linux-gnu/$(WINEGCC_VER)
CPPFLAGS += -DSPI_STATS
# Enable LEDs
CPPFLAGS += -DENABLE_LEDS
# FT230X support is available since libftdi-1.1
CPPFLAGS += -DENABLE_FT230X
# Support for FT-X family chips is available since libftdi-1.1
CPPFLAGS += -DENABLE_FT_X
CPPFLAGS += $(shell libftdi1-config --cflags) $(shell env PKG_CONFIG_PATH=$(I386_LIB)/pkgconfig pkg-config --cflags libusb-1.0)

# Compile with debugging
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ KiCad schematic for a dedicated programmer can be found in

The following FTDI chips are reported working with programmer driver: FT232R
(including counterfeits, even "bricked" ones), FT2232H, FT4232H. There is
experimental support for the following chips: FT2232C, FT2232D, FT232H, FT230X.
Please report the working status via
experimental support for the following chips: FT2232C, FT2232D, FT232H, FT220X,
FT221X, FT230X, FT231X, FT234XD, FT240X. Please report the working status via
[GitHub issues](https://github.com/lorf/csr-spi-ftdi/issues).

FT230X has only four primary GPIO pins and does not support default pinout. The
pinout for FT230X is set to `hwspi` on initialization, see `FTDI_PINOUT`
[option](#options).
Some FT-X family chips (FT220X, FT230X, FT234XD) have only four primary GPIO
pins and don't support default pinout. To use such chip You'll need to set
`hwspi` pinout using `FTDI_PINOUT` [option](#options).

### Counterfeit FT232RL chips

Expand Down Expand Up @@ -250,13 +250,13 @@ variables or using the -TRANS option to most CSR commandline apps.
* `default` - default pinout as described in [Using FT232RL breakout board as
a programmer](#using-ft232rl-breakout-board-as-a-programmer).
* `noleds` - this is the same as `default` but without LEDs.
* `hwspi` - pinout for use with MPSSE chips (FT2232, FT4232, FT232H), uses
the same pins as hardware SPI. Note that hardware SPI capability is not
used, just the same pinout is used for convenience. This pinout can be used
with adapters like [TIAO
TUMPA](http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User's_Manual).
The pinout is as follows: `CS` - `CTS#` (`D3`), `CLK` - `TXD` (`D0`), `MOSI` -
`RXD` (`D1`), `MISO` - `RTS#` (`D2`).
* `hwspi` - pinout for use with MPSSE (FT2232, FT4232, FT232H) and FT-X
chips, uses the same pins as hardware SPI. Note that hardware SPI
capability is not used, just the same pinout is used for convenience. This
pinout can be used with adapters like
[TIAO TUMPA](http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User's_Manual).
The pinout is as follows: `CS` - `CTS#` (`D3`), `CLK` - `TXD` (`D0`),
`MOSI` - `RXD` (`D1`), `MISO` - `RTS#` (`D2`).
* `hwspi+leds` - this is the same as `hwspi` but adds read and write LEDs on
`DTR#` (`D4`) and `DSR#` (`D5`) pins respectively.
* `sparkfun` - pinout for use with adapters with TX, RX, DTR and CTS
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.3-a3
0.5.3-a4
16 changes: 9 additions & 7 deletions spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ static struct ftdi_device_ids ftdi_device_ids[] = {
{ 0x0403, 0x6010, "FT2232" }, /* FT2232H/C/D */
{ 0x0403, 0x6011, "FT4232" }, /* FT4232H */
{ 0x0403, 0x6014, "FT232H" }, /* FT232H */
#ifdef ENABLE_FT230X
/* FT230X support is available since libftdi-1.1 */
{ 0x0403, 0x6015, "FT230X" }, /* FT230X */
#ifdef ENABLE_FT_X
/* FT-X family support is available since libftdi-1.1. This includes
* FT220X, FT221X, FT230X, FT231X, FT234XD and FT240X */
{ 0x0403, 0x6015, "FT-X FAMILY" }, /* FT-X family */
#endif
};

Expand Down Expand Up @@ -781,14 +782,15 @@ int spi_open(int nport)
ftdi_type_str = "FT232H";
ftdi_buf_size = 2048;
break;
#ifdef ENABLE_FT230X
/* FT230X support is available since libftdi-1.1 */
#ifdef ENABLE_FT_X
case TYPE_230X:
ftdi_type_str = "FT230X";
ftdi_type_str = "FT-X FAMILY";
ftdi_buf_size = 1024;
/* If pinout was not set via spi_set_pinout() */
/* Change default pinout if pinout was not set via spi_set_pinout() */
/*
if (!spi_pinout_set)
spi_set_pinout(SPI_PINOUT_HWSPI);
*/
break;
#endif
default:
Expand Down

0 comments on commit d991d4e

Please sign in to comment.