From: Sven on
Hello all

I'm trying to read and write serial data with a FTDI chip (FT232R).

I'm using the IC in Synchronous Bit Bang Mode using D0 as a CLK output and
D1 as a DATA input/output.

First i shall shift out 16 bits on DATA and then change it to an input and
shift back 16 bits.

I have successfully shifted out DATA but i have trouble reading back.

Anyone here having any example code?





From: heindekock on
>Hello all
>
>I'm trying to read and write serial data with a FTDI chip (FT232R).
>
>I'm using the IC in Synchronous Bit Bang Mode using D0 as a CLK output
and
>D1 as a DATA input/output.
>
>First i shall shift out 16 bits on DATA and then change it to an input
and
>shift back 16 bits.
>
>I have successfully shifted out DATA but i have trouble reading back.
>
>Anyone here having any example code?
>
>
>

Have you looked at this:

http://www.ftdichip.com/Documents/AppNotes/AN232R-01_FT232RBitBangModes.pdf



---------------------------------------
This message was sent using the comp.arch.embedded web interface on
http://www.EmbeddedRelated.com
From: Sven on
> Have you looked at this:
>
Yes

But I don't understand the FT_Read() function.

Does the chip read all pinns during FT_Write() and then FT_Read() returns
all read values?

From: heindekock on
>> Have you looked at this:
>>
>Yes
>
>But I don't understand the FT_Read() function.
>
>Does the chip read all pinns during FT_Write() and then FT_Read() returns

>all read values?
>
>

Sorry - I just saw it implemented on a micro for in application
programming over USB, I didn't write the code myself so I can't help
you further.

Best of luck to you.


---------------------------------------
This message was sent using the comp.arch.embedded web interface on
http://www.EmbeddedRelated.com
From: Paul Carpenter on
In article <4aa6b821$0$293$14726298(a)news.sunsite.dk>, sven(a)sven.se
says...
> Hello all
>
> I'm trying to read and write serial data with a FTDI chip (FT232R).
>
> I'm using the IC in Synchronous Bit Bang Mode using D0 as a CLK output and
> D1 as a DATA input/output.

It is easier to use a SEPARATE pin for input and output.

Use FT_SetBitMode to determine which pins are input and output, once.

> First i shall shift out 16 bits on DATA and then change it to an input and
> shift back 16 bits.
>
> I have successfully shifted out DATA but i have trouble reading back.

Because it fifos the data as you change the output, inputs are read.
Using the Baud rate clock to clock out and in the values at the same
time. If you read data sheet mentioned below it does say it reads FIRST
ALL pins, so you will have to mask the bits to get the bit you want.

So data bit input must be PRELOADED before the write occurs.

You can ONLY read in that mode by writing at same time. You may have
to use GPIO of other pins to enable or disable external hardware, and
possibly

Write 16 bits (external device enabled for write)

Write 17 or 16 bits (external device DISabled for write)
Read the data back possibly discarding first byte if
using 17 bits for external data not preloaded.

Similar to FT2232.

I assume you have looked at data sheets for

AN232R-01 Bit Bang Modes for the FT232R and FT245R
D2XX programmers guide.

Yes their guides and examples leave a lot to be desired for things
missing, like timing diagrams for EACH mode and operation, as well
as basic programme flow for minimal operation.

> Anyone here having any example code?

Double check the FTDI site for ALL languages as they also do
not put examples for all modes in each language.

Don't even get me going on their pseudo I2C implementations.

--
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