libftdi Archives

Subject: Foerwarded from "Matt" <lists@xxxxxxxxxxxxxxx>: I2C problem

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 28 Nov 2011 18:51:47 +0100
Hello,

Matt <lists@xxxxxxxxxxxxxxx> has problems to post to the list. So I forward
his mail to the list to check the mailer and perhaps get feedback for him:

msg ->
Hi all,

When reading from or writing to an eeprom connected to channel A on my
ft4232 minimodule via i2c (mpsse mode), I occasionally fail to read the
ack from the eeprom and ftdi_read_data or ftdi_write_data return 0. As a
result the read or write transaction is regarded as a failure. Trying the
same operation again immediately may work ok. Other times, it may only
work ok after a few attempts. There seems no pattern to it at all.

I've set the latency timer to 2 using ftdi_set_latency_timer() and I've
had a look at app note AN232B-04. I understand that the function may
return due to several cases being met but given the fact that it seems
'random' makes me suspicious.

I'm calling ftdi_usb_purge_rx_buffer() after every call to
ftdi_read_data() but not flushing the tx.

Is it recommended behaviour to flush tx and rx after use? If so, wouldn't
this affect reading variable sized data from a peripheral (eg read a known
amount to obtain a data structure including the length of the data, then
read the remainder). I suppose this is another question... :-)

I notice that libmpsse changes the values of (struct
ftdi_context).usb_read_timeout and (struct ftdi_context).usb_write_timeout
directly however the ftdi.h API seems to indicate that you shouldn't need
to mess with these...

I see messages from the kernel relating to auto-suspend of the 4232
device. I'm not sure if these are indicative of something which could be
contributing to what i see or not. Any ideas?

Here's a small example output from dmesg when I'm running my program. It
looks innocent enough.

[28359.356403] usb 1-1.6: usb auto-resume
[28359.393363] usb 1-1.6: finish resume
[28361.391793] usb 1-1.6: usb auto-suspend

I'm using linux 3.1.0, libftdi 0.19 and libusb 0.1.12.

Has anybody seen anything similar?

Thanks,
--  Matt

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