On Mon, 2011-07-04 at 16:43 +0200, Uwe Bonnes wrote: > >>>>> "Alex" == Alex Stefan <[email protected]> writes: > > Alex> On Tue, 2011-06-28 at 15:06 +0200, Uwe Bonnes wrote: > >> >>>>> "Alex" == Alex Stefan <[email protected]> writes: > >> > Alex> Hello, I am working on implementing a SPI protocol using > Alex> bit-banging on the CBUS interface of a FT232H chip. The purpose > Alex> would be to program another chip's flash memory via USB. > >> > Alex> The one I can't figure out is how to correctly time the SPI > Alex> operations. I mean, how can I output a precise clk signal on SCK > Alex> using bit-banging. > >> Why do you want do bitbang with the FT232H? MPSSE mode is much > >> easier to use. > >> > >> Bye > > Alex> I need to use CBUS bitbang because the MPSSE pins will be used for > Alex> UART communication afterwards. > > Alex> Anyway, I have implemented everything, works correctly, but not > Alex> fast enough. My SPI tx/rx function runs at an approximate rate of > Alex> 300 BPS which translates into a huge amount of time to flash a 30 > Alex> KB image to the chip. > > Alex> Has anyone encountered this problem so far? From what I can tell, > Alex> the problem is with the USB driver functions in the kernel, but I > Alex> can't figure out how to solve it. Any ideas? > > If you don't need UART and SPI at a time, which is not possible with the > single channel FT232H, consider multiplexing the MPSSE pins and some > non-MPSSE pin as multiplexer control. > > How did you implement SPI. Do you assemble large transfer trunks and read > back large traunks or do you send small chunks and read often? Remember that > USB is manged by 1 ms/125 us Frames and each write/read transaction takes at > least one or two frames. > > Otherwise, does the FTDI libspi also work with bitbanging? What is the speed > of that solution. > Thanks for your reply.
It's not my call whether to connect the SPI and UART together on the MPSSE port. I will forward your suggestion. >From what I saw in the CBUS bitbang examples of the libftdi library, I can't make use of any "buffering" system and I must make a call to 'ftdi_set_bitmode()' everytime I need to chage the state of a pin. I have talked to the developers of FTDI lipspi and they said that their current version only supports MPSSE SPI, not bit-banging. Could you please offer some more details on the USB timing? How can I set the interval between 2 USB frames (from 1ms to 125 uS) ? Regards, Alex -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
