Reply by jomegatau December 28, 20102010-12-28
>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. >
I had the same problem. Maybe you have already given up with the FT2232D but I just posted this to help anyone else who may have this problem again ( it should be on the FTDI web page under their support FAQ's ). I asked Future Technologies for help but I did not even get a reply from the support webpage. I get the impression they are not very good for support or anything else. They make nice chips, but its a pity that they don't even read support questions. I finally found the reason why the second device would not respond to the SPI call to SPI_Write. The reason was that the first call used a positive edge clock and the second call used a negative edge clock. When you change the edge polarity you better change the dwell clockPinState to be consistent with the clock edge polarity. For Example if you are using a negative edge then set bClockPinState=TRUE if you are using a positve edge bClockPinState=FALSE. After I changed this the second slave call to SPI_Write worked. I can now program several SPI slaves with different clock edges and chip enable polarities. It took me days to figure this out by trial and error. Hope this helps jomegatau --------------------------------------- Posted through http://www.EmbeddedRelated.com
Reply by April 17, 20082008-04-17
On Apr 17, 3:01 am, "Paul Carpenter"
<p...@pcserviceselectronics.co.uk> wrote:
> <ghel...@lycos.com> wrote in message > > news:8808e6ea-6018-4ac9-8061-5a672d0110a4@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...@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.
Reply by Paul Carpenter April 17, 20082008-04-17
<ghelbig@lycos.com> wrote in message
news:8808e6ea-6018-4ac9-8061-5a672d0110a4@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@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
Reply by April 15, 20082008-04-15
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.