Forums

FTDI chip interface problem with LPC2194 microcontroller

Started by vishal_arora82 April 25, 2007
Dear Fellow Members,

I am not quite sure that is it the good to post this question here in
this forum. But I have no other choice.

I am working on a project implementing FIFO interface between ftdi USB
chip (ft245bm) and LPC2194. I am using I/O Port 1 of LPC2194 for
databus and I/O Port0 for control bus. I hope anyone of you might have
worked on ftdi chips

Now I am really stuck on a very strange problem. When i transmit e.g.
a string byte by byte from micrcontroller into Tx buffer of USB, then
on PC side when I receive, some characters are received twice or
thrice. E.g
>From Microcontroller -> "Hallo World"
Received in PC <- "HHallo Woorldd"

Receiving bytes on microcontroller side from PC works fine.

The problem upto my understanding lies in configuring correctly the
USB 'WR' pin. The datasheet says WR must be strobbed high and then low
to write the byte when TXE# is low.

Can anybody please tell me the correct way of coding it in
microcontroller software. I am coding it as:
1. Setting the direction during initialization to output
2. Writing the bytes on databus pins
3. IOCLR0 |= (1< IOSET0 |= (1< or
3. IOSET0 |= (1< IOCLR0 |= (1< or
3. IOSET0 |= (1< IOCLR0 |= (1< IOSET0 |= (1<
I have already tried out many other possiblities and even playing with
delays. But of no use.

I would really appreciate any useful comments!

Regards
Vishal

An Engineer's Guide to the LPC2100 Series

--- In l..., "vishal_arora82"
wrote:
>
> Dear Fellow Members,
>
> I am not quite sure that is it the good to post this question here in
> this forum. But I have no other choice.
>
> I am working on a project implementing FIFO interface between ftdi USB
> chip (ft245bm) and LPC2194. I am using I/O Port 1 of LPC2194 for
> databus and I/O Port0 for control bus. I hope anyone of you might have
> worked on ftdi chips
>
> Now I am really stuck on a very strange problem. When i transmit e.g.
> a string byte by byte from micrcontroller into Tx buffer of USB, then
> on PC side when I receive, some characters are received twice or
> thrice. E.g
> From Microcontroller -> "Hallo World"
> Received in PC <- "HHallo Woorldd"
>
> Receiving bytes on microcontroller side from PC works fine.
>
> The problem upto my understanding lies in configuring correctly the
> USB 'WR' pin. The datasheet says WR must be strobbed high and then low
> to write the byte when TXE# is low.
>
> Can anybody please tell me the correct way of coding it in
> microcontroller software. I am coding it as:
> 1. Setting the direction during initialization to output
> 2. Writing the bytes on databus pins
> 3. IOCLR0 |= (1< > IOSET0 |= (1< > or
> 3. IOSET0 |= (1< > IOCLR0 |= (1< > or
> 3. IOSET0 |= (1< > IOCLR0 |= (1< > IOSET0 |= (1< >
> I have already tried out many other possiblities and even playing with
> delays. But of no use.
>
> I would really appreciate any useful comments!
>
> Regards
> Vishal
>
One thing that *might* be causing dificulty is that IOCLR is a WRITE
ONLY register, but the |= operator is a read-modify-write operation.
Since the code is reading a write only register, that *might* be
causing a problem for you. Since IOCLR is WO, why not just use the operator instead?

--Dave
Hi,

> I am not quite sure that is it the good to post this question here in
> this forum. But I have no other choice.

At last, a well-constructed question...

> Can anybody please tell me the correct way of coding it in
> microcontroller software. I am coding it as:
> 1. Setting the direction during initialization to output
> 2. Writing the bytes on databus pins
> 3. IOCLR0 |= (1< > IOSET0 |= (1< > or
> 3. IOSET0 |= (1< > IOCLR0 |= (1< > or
> 3. IOSET0 |= (1< > IOCLR0 |= (1< > IOSET0 |= (1<

I believe you should not be using |= but simply =, viz:

3. IOSET0 = 1< IOCLR0 = 1< IOSET0 = 1<
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
Firstly thanks to you people for your quick reply. Secondly, I am
really sorry for the inconveneince. The code I provided was from one
of my old files. I was mistakenly working on that code. In my new file
I have no |= instead i have only used = for IOCLR and IOSET.

But still the problem is the same. Even i thought two days back that
this might be the problem. So now the code is:
1. Setting the direction during initialization to output
2. Writing the bytes on databus pins
3. IOCLR0 = (1< IOSET0 = (1< or
3. IOSET0 = (1< IOCLR0 = (1< or
3. IOSET0 = (1< IOCLR0 = (1< IOSET0 = (1<
But I am sorry the problem is still the same!!!
Greetings...

Well, I am finally able to get through the solution. The problem was
in dealing with 'WR' pin of FT245BM since this pin is edge sensitive.

When I and my friends checked it with oscilloscope, we found out the
pin is floating for a long period of time, which shouldn't be. This
solution I got in a document discussing "debugging FT245BM design"
regarding data repetition. So I just placed a series resistance of
40ohms close to the controller to get ride of this disturbance.

Anyway once again thanks to those for their quick replies

Warm Regards
Vishal
Hi,
could you please give a link to the cited paper "debugging FT245BM
design"?

Thanks in advance
Fabio

--- In l..., "vishal_arora82"
wrote:
>
> Greetings...
>
> Well, I am finally able to get through the solution. The problem
was
> in dealing with 'WR' pin of FT245BM since this pin is edge
sensitive.
>
> When I and my friends checked it with oscilloscope, we found out
the
> pin is floating for a long period of time, which shouldn't be. This
> solution I got in a document discussing "debugging FT245BM design"
> regarding data repetition. So I just placed a series resistance of
> 40ohms close to the controller to get ride of this disturbance.
>
> Anyway once again thanks to those for their quick replies
>
> Warm Regards
> Vishal
>
Hi Fabio,

This link is to AN232B-06, Debugging FT232BM/FT245BM Designs:
http://www.ftdichip.com/Documents/AppNotes/AN232B-06_11.pdf

Cheers...

Dave

________________________________

From: l... [mailto:l...] On Behalf
Of bitman_2006
Sent: Wednesday, May 02, 2007 12:05 AM
To: l...
Subject: [lpc2000] Re: FTDI chip interface problem with LPC2194
microcontroller

Hi,
could you please give a link to the cited paper "debugging FT245BM
design"?

Thanks in advance
Fabio

--- In l... ,
"vishal_arora82"
wrote:
>
> Greetings...
>
> Well, I am finally able to get through the solution. The problem
was
> in dealing with 'WR' pin of FT245BM since this pin is edge
sensitive.
>
> When I and my friends checked it with oscilloscope, we found out
the
> pin is floating for a long period of time, which shouldn't be. This
> solution I got in a document discussing "debugging FT245BM design"
> regarding data repetition. So I just placed a series resistance of
> 40ohms close to the controller to get ride of this disturbance.
>
> Anyway once again thanks to those for their quick replies
>
> Warm Regards
> Vishal
>