From: ghelbig on
Hi,

I'm trying to use the GPI calls in FTDI's FTCSPI library, and I can't
seem to make it work. My biggest headache is that I can't find any
documentation on the following:

--------------------------
FTC_STATUS Status = FTC_SUCCESS;
FTC_HANDLE ftHandle;
FTC_CHIP_SELECT_PINS ChipSelectsDisableStates;
FTC_INPUT_OUTPUT_PINS HighInputOutputPins;

// Set chip select pin states (ADBUS3 - ADBUS7)
ChipSelectsDisableStates.bADBUS3ChipSelectPinState = false;
ChipSelectsDisableStates.bADBUS4GPIOL1PinState = false;
ChipSelectsDisableStates.bADBUS5GPIOL2PinState = false;
ChipSelectsDisableStates.bADBUS6GPIOL3PinState = false;
ChipSelectsDisableStates.bADBUS7GPIOL4PinState = false;

// Set GPIO pin states (ACBUS0 - ACBUS3)
HighInputOutputPins.bPin1InputOutputState = true;
HighInputOutputPins.bPin1LowHighState = false;
HighInputOutputPins.bPin2InputOutputState = true;
HighInputOutputPins.bPin2LowHighState = false;
HighInputOutputPins.bPin3InputOutputState = true;
HighInputOutputPins.bPin3LowHighState = false;
HighInputOutputPins.bPin4InputOutputState = true;
HighInputOutputPins.bPin4LowHighState = false;

Status = SPI_SetGPIOs(ftHandle, &ChipSelectsDisableStates,
&HighInputOutputPins);
--------------------------

What I can't find is a definition of what these structure members do.
For example, does setting ChipSelectDisableState to false mean that it
is not disabled, AKA enabled? And if 'false' for InputOutput state
mean input, or output?

If someone could shed some light on this, or point me to some
examples, I would appreciate it.

TIA,
G.


From: Paul Carpenter on
<ghelbig(a)lycos.com> wrote in message
news:8808e6ea-6018-4ac9-8061-5a672d0110a4(a)b5g2000pri.googlegroups.com...
> Hi,
>
> I'm trying to use the GPI calls in FTDI's FTCSPI library, and I can't
> seem to make it work. My biggest headache is that I can't find any
> documentation on the following:

By the looks of things you are rying to use a FT2232 device.

I have a VB6 example up on my site (see sig). The code may help with
getting flow sorted.


> --------------------------
> FTC_STATUS Status = FTC_SUCCESS;
> FTC_HANDLE ftHandle;
> FTC_CHIP_SELECT_PINS ChipSelectsDisableStates;
> FTC_INPUT_OUTPUT_PINS HighInputOutputPins;

I don't understand your problem with the above definitions, as they are
defined in the Appendix of FTDI SPI Programming Guide, which I believe
you must have.

> // Set chip select pin states (ADBUS3 - ADBUS7)
> ChipSelectsDisableStates.bADBUS3ChipSelectPinState = false;
> ChipSelectsDisableStates.bADBUS4GPIOL1PinState = false;
> ChipSelectsDisableStates.bADBUS5GPIOL2PinState = false;
> ChipSelectsDisableStates.bADBUS6GPIOL3PinState = false;
> ChipSelectsDisableStates.bADBUS7GPIOL4PinState = false;
>
> // Set GPIO pin states (ACBUS0 - ACBUS3)
> HighInputOutputPins.bPin1InputOutputState = true;
> HighInputOutputPins.bPin1LowHighState = false;
> HighInputOutputPins.bPin2InputOutputState = true;
> HighInputOutputPins.bPin2LowHighState = false;
> HighInputOutputPins.bPin3InputOutputState = true;
> HighInputOutputPins.bPin3LowHighState = false;
> HighInputOutputPins.bPin4InputOutputState = true;
> HighInputOutputPins.bPin4LowHighState = false;
>
> Status = SPI_SetGPIOs(ftHandle, &ChipSelectsDisableStates,
> &HighInputOutputPins);
> --------------------------
>
> What I can't find is a definition of what these structure members do.
> For example, does setting ChipSelectDisableState to false mean that it
> is not disabled, AKA enabled? And if 'false' for InputOutput state
> mean input, or output?

From memory, this sort of documentation is weak on FTDI software
along with a few other aspects. They have a habit of putting
UNDOCUMENTED examples in their guides assuming you know
what everything means, without saying what the result is.

I have not had to use the pin structures to get SPI working to 16 SPI
devices.

I would suggest trying a few combinations to see what setting
one pin to all combinations does.

> If someone could shed some light on this, or point me to some
> examples, I would appreciate it.
>
> TIA,
> G.
>
--
Paul Carpenter | paul(a)pcserviceselectronics.co.uk
<http://www.pcserviceselectronics.co.uk/> PC Services
<http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
<http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
<http://www.badweb.org.uk/> For those web sites you hate



From: ghelbig on
On Apr 17, 3:01 am, "Paul Carpenter"
<p...(a)pcserviceselectronics.co.uk> wrote:
> <ghel...(a)lycos.com> wrote in message
>
> news:8808e6ea-6018-4ac9-8061-5a672d0110a4(a)b5g2000pri.googlegroups.com...
>
> > Hi,
>
> > I'm trying to use the GPI calls in FTDI's FTCSPI library, and I can't
> > seem to make it work. My biggest headache is that I can't find any
> > documentation on the following:
>
> By the looks of things you are rying to use a FT2232 device.
>
> I have a VB6 example up on my site (see sig). The code may help with
> getting flow sorted.
>
> > --------------------------
> > FTC_STATUS Status = FTC_SUCCESS;
> > FTC_HANDLE ftHandle;
> > FTC_CHIP_SELECT_PINS ChipSelectsDisableStates;
> > FTC_INPUT_OUTPUT_PINS HighInputOutputPins;
>
> I don't understand your problem with the above definitions, as they are
> defined in the Appendix of FTDI SPI Programming Guide, which I believe
> you must have.
>
>
>
> > // Set chip select pin states (ADBUS3 - ADBUS7)
> > ChipSelectsDisableStates.bADBUS3ChipSelectPinState = false;
> > ChipSelectsDisableStates.bADBUS4GPIOL1PinState = false;
> > ChipSelectsDisableStates.bADBUS5GPIOL2PinState = false;
> > ChipSelectsDisableStates.bADBUS6GPIOL3PinState = false;
> > ChipSelectsDisableStates.bADBUS7GPIOL4PinState = false;
>
> > // Set GPIO pin states (ACBUS0 - ACBUS3)
> > HighInputOutputPins.bPin1InputOutputState = true;
> > HighInputOutputPins.bPin1LowHighState = false;
> > HighInputOutputPins.bPin2InputOutputState = true;
> > HighInputOutputPins.bPin2LowHighState = false;
> > HighInputOutputPins.bPin3InputOutputState = true;
> > HighInputOutputPins.bPin3LowHighState = false;
> > HighInputOutputPins.bPin4InputOutputState = true;
> > HighInputOutputPins.bPin4LowHighState = false;
>
> > Status = SPI_SetGPIOs(ftHandle, &ChipSelectsDisableStates,
> > &HighInputOutputPins);
> > --------------------------
>
> > What I can't find is a definition of what these structure members do.
> > For example, does setting ChipSelectDisableState to false mean that it
> > is not disabled, AKA enabled? And if 'false' for InputOutput state
> > mean input, or output?
>
> From memory, this sort of documentation is weak on FTDI software
> along with a few other aspects. They have a habit of putting
> UNDOCUMENTED examples in their guides assuming you know
> what everything means, without saying what the result is.
>
> I have not had to use the pin structures to get SPI working to 16 SPI
> devices.
>
> I would suggest trying a few combinations to see what setting
> one pin to all combinations does.
>
> > If someone could shed some light on this, or point me to some
> > examples, I would appreciate it.
>
> > TIA,
> > G.
>
> --
> Paul Carpenter | p...(a)pcserviceselectronics.co.uk
> <http://www.pcserviceselectronics.co.uk/> PC Services
> <http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
> <http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
> <http://www.badweb.org.uk/> For those web sites you hate

Paul,

Yes, it's a 2232. I should have said so.

I'm not having trouble with the SPI part. In my circuit, I need to
wiggle some bits to enable the SPI on the slave device; that is what
is not working.

I have no problem with the structure definitions, but the member
values are eluding me. Sigh.

Yes, the undocumented example is more confusing than useful. And the
function names in the examples (version 1.0) do not exactly match the
function call names in the library (version 1.0). Double sigh.

Right now it seems that the set_GPIOs call works only once per device
open. The 1st call does something related to the structure elements,
but subsequent calls do nothing until the device is closed and re-
opened. Unfortunately, closing and re-opening sets the GPIOs to
default, which wonks-up the sequence I need to do.

I will take a look at your examples. Thanks!

G.