libftdi Archives

Subject: Re: write/read syncronization

From: Matthias Janke <janke@xxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 8 Feb 2010 17:04:45 +0100
Hi,

sorry for the silence I had an imap problem.

Am Fri, 5 Feb 2010 10:11:25 +0100 (CET)
schrieb "Dr. Igor Nikitin" <igor.nikitin@xxxxxxxxxxx>:


> >     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); usleep(10000);
>         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 can confirm this behaviouted a program/script [2], but beware that
its kernel version dependant.

Another way to get the first byte written on a "old" device is to open
an close it with D2XX prior to libftdi stuff. But that's rather
inelegant.

I tried to investigate father with usbmon and wireshark ( including
Uwe's hint [3]), but didn't come to a solution. I think the difference
lies in the open function of D2XX. If I remember correctly I didn't
observe this behaviour with a FT245, but don't count on it. Hopefully
this helps someone with better usb debugging skills/tools.

Cheers,
Matthias

[1]
http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg00002.html
[2]
http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg00289.html
[3]
http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg00293.html

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

Current Thread