libftdi Archives

Subject: Re: [libftdi 0.18] SPI with CBUS Bit-banging FT232H

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 4 Jul 2011 16:43:36 +0200
>>>>> "Alex" == Alex Stefan <alexandru.stefan@xxxxxxxxxxx> writes:

    Alex> On Tue, 2011-06-28 at 15:06 +0200, Uwe Bonnes wrote:
    >> >>>>> "Alex" == Alex Stefan <alexandru.stefan@xxxxxxxxxxx> 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.

-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread