Skip to content

Commit 989c8f8

Browse files
committed
ftdispi: lowlevel init/MPSSE configuration before pins manipulation (issue #519)
1 parent fbee81b commit 989c8f8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ftdispi.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ FtdiSpi::FtdiSpi(int vid, int pid, unsigned char interface, uint32_t clkHZ,
7474
(void)pid;
7575
(void)vid;
7676
(void)interface;
77+
78+
init(1, 0x00, BITMODE_MPSSE);
79+
7780
setMode(0);
7881
setCSmode(SPI_CS_AUTO);
7982
setEndianness(SPI_MSB_FIRST);
80-
81-
init(1, 0x00, BITMODE_MPSSE);
8283
}
8384

8485
FtdiSpi::FtdiSpi(const cable_t &cable,
@@ -96,6 +97,8 @@ FtdiSpi::FtdiSpi(const cable_t &cable,
9697
if (spi_config.wpn_pin)
9798
_wpn = spi_config.wpn_pin;
9899

100+
init(1, _cs_bits, BITMODE_MPSSE);
101+
99102
/* clk is fixed by MPSSE engine
100103
* but CS, holdn, wpn are free -> update bits direction
101104
*/
@@ -106,7 +109,6 @@ FtdiSpi::FtdiSpi(const cable_t &cable,
106109
setCSmode(SPI_CS_AUTO);
107110
setEndianness(SPI_MSB_FIRST);
108111

109-
init(1, 0x00, BITMODE_MPSSE);
110112
}
111113

112114
FtdiSpi::~FtdiSpi()

0 commit comments

Comments
 (0)