I have a problem with the FT232HL FTDI ic.
Windows application send data to the chip via USB and the chip send the data out with one SPI channel.
I did check with a logic analyser, the bytes are correctly sent out and the SPI clock match the settings. However, between each byte, there is a 64uS delay so it means that no matter how high is the SPI clock, the data transfer takes minutes instead of seconds.
I imagined maybe playing with the channelConf.LatencyTimer would help, but it shows no difference no matter the value used (10, 128, 255), delay remain 64uS between consecutive bytes.
There must be something to fix because there are numerous examples of people reaching high transfer rates. Also, delay between bytes should be a setting somewhere.
I've used sample code provided with sample-dynamic.c
The byte stream is sent with a single call to p_SPI_Write() with total length of 2048 bytes. I've tried other length (256, 8192, etc) no change.
Here is the configuration used:
channelConf.ClockRate = 5000*1000;
channelConf.LatencyTimer= 10;
channelConf.configOptions = SPI_CONFIG_OPTION_MODE0| SPI_CONFIG_OPTION_CS_DBUS3/*|*/ ;
channelConf.Pin = 0x00000000; /* FinalVal-FinalDir-InitVal-InitDir (for dir: 0=in, 1=out) */
OS: windows7 X64
Compiler: GCC
Library and code from: http://www.ftdichip.com/Support/SoftwareExamples/MPSSE/LibMPSSE-SPI.htm
FYI: I've contacted FTDI support, they asked me to update the libraries to latest one (which I did), then they would not provide further support.
Any help appreciated.
Thank you.
Best Answer
I usually work with the FT2232H chip, but I dug out an FT232HQ chip out just so I could check out this issue you were having. It's the same chip as the FT232HL chip you have, just in a QFN package instead of a QFP.
I tried to recreate the problem you describe, but I wasn't able to exactly. This is what it looked like on my logic analyzer when I output 6 bytes at once at a clock rate of 5MHz. There is is a small delay between bytes, but nowhere near as large as 64us.
Here are some things to check.
p_SPI_Write()
, useSPI_Write()
. If you make a single call, add the appropriate chip select enable and disable flags (see below). If you make multiple calls, make sure to add the chip select flags to the first and last calls in the series.SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES
flag.Here is some quick example code on how to send multiple data bytes in case it helps.