libftdi Archives

Subject: Re: write/read syncronization

From: "Dr. Igor Nikitin" <igor.nikitin@xxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 5 Feb 2010 10:11:25 +0100 (CET)
Hi Uwe,

thank you for helpful answer. Sorry for HTML, I'll try to fix it.

> The FT fill up a buffer and sends it out when its full  or when the latency
> elapses. Set the latency low and sleep shortly between the
> ftdi_write_data() and ftdi_read_data()

It works, with latency=1 and sleep=10ms or greater.

>     Igor> "one" is almost always missed, not appearing in further output.

> I don't know. Maybe the uC is not out of reset? Maybe the FT takes some time
> to setup?  What happens if you loopback tx/rx at the FT232 without the uC
> ...

The same behavior if tx and rx on FT232 are directly connected.

        ftdi_write_data(&ftdi, (unsigned char*)str, strlen(str)+1);        
        rsiz=ftdi_read_data(&ftdi, buf, 1000);

The first message disappears, others are OK. Sleep 1sec
before the first write does not help. ftdi_usb_reset() before 
the first write does not help. Replugging USB cable helps
for one run of test program. It shows the first message, 
in further runs it disappears again.

I would not be so bothered with this problem, practically 
I can send a dummy first command and ignore the reply. 

One more question. If I choose the other way of interaction:
PC and uC send messages permanently to each other not waiting 
the reply. Then temporal lag between sending and receiving 
will be equal to timer latency, or fill time of the buffer, 
minimal of them. Am I right?

Cheers, Igor.

libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread